var MENU={};

function T$(i){return document.getElementById(i)}


MENU.box=function(){
	var p,m,b,fn,ic,iu,iw,ih,ia,f=0,id;
	return{
		show:function(c,u,w,h,a,t){

			if(!f){
				p=document.createElement('div'); p.id='menubox';
				f=1;
				b=document.createElement('div'); b.id='menucontent';
				m=document.createElement('div'); m.id='menumask';
				b.style.cursor='pointer';
				document.body.appendChild(m); document.body.appendChild(p); p.appendChild(b);
			}
			
			m.onmouseover=function(){MENU.box.hide();};
			p.style.width=w;
			p.style.height=h;
			b.style.width=w;
			b.style.height=h;

			ic=''; iw=w; 

			if (c == "products") {
				ic = ic + '<div style="width:100px;height:42px"><a href="/jp/software/lm/">ListManager</a><a href="/jp/software/media-streams/">Media Streams</a></div>';

			} else if (c == "solutions")  {
				ic =  ic + '<div width=140 height=42><a href="/jp/solutions/email-marketing/">メールマーケティング</a><a href="/jp/solutions/hootsuite/">HootSuite + apps</a></div>';
			} else if (c == "about")  {
				ic =  ic + '<div width=130 height=64 ><a href="/jp/about/">会社概要</a><a href="/jp/about/news_releases/">ニュースリリース</a><a href="/jp/about/customers.htm">主な取引先</a><a href="/jp/about/partners.htm">ビジネスパートナー</a></div>';
			} else if (c == "contact")  {
				ic =  ic + '<div width=90 height=42 ><a href="/jp/contact/">お問い合わせ</a><a href="/jp/contact/support.htm">サポート</a></div>';
			}
		this.pos(c);





		},


		hide:function(c){
			if (f==1) {
				p.style.display='none';
				b.style.display='none';
				m.style.display='none';
			}

			f=0;
		
		},

		pos:function(c){

		    var topValue= 0,leftValue= 0;
			var obj = document.getElementById('products');

/*
		    while(obj){
				leftValue+= obj.offsetLeft;
				topValue+= obj.offsetTop;
				obj= obj.offsetParent;
		    }
*/
			do {
				leftValue += obj.offsetLeft;
				topValue += obj.offsetTop;
			} while (obj = obj.offsetParent);

			var top = 0; var left = 0;

			if (c == "products") {
				var top = 14;var left = 8;
			} else if (c == "solutions") {
				var top = 14;var left = -75;
			} else if (c == "about") {
				var top = 37;var left = -165;
			} else if (c == "contact") {
				var top = 14;var left = -265;
			}

			topValue = topValue - top;
			leftValue = leftValue - left;
			p.style.top=topValue+'px';
			p.style.left=leftValue+'px'
			b.innerHTML=ic;
			p.style.display='inline';
			b.style.display='inline';
			m.style.display='inline';

		}
	}
}();


