var openedMenu = null;
var submenuTimer;

//画像メニューにポインタがきた??
function menuOvr(id){

	// 開いているメニューと違うメニューであれば隠す。
	if (openedMenu && openedMenu != id){
		CloseMenu(id);
	}

	// サブウィンドウの表示
	OpenMenu(id);
}

//レイヤメニューの表示
function OpenMenu(id){
	var pTop, pLeft;
	if(id == 'fixedLay0') { pTop = 510;}
	if(id == 'fixedLay1') { pTop = 538;}
	if(id == 'fixedLay2') { pTop = 566;}
	if(id == 'fixedLay3') { pTop = 594;}
	if(id == 'fixedLay4') { pTop = 622;}
	if(id == 'fixedLay5') { pTop = 650;}
	if(id == 'fixedLay6') { pTop = 678;}
	if(id == 'fixedLay7') { pTop = 706;}
	if(id == 'fixedLay8') { pTop = 734;}
	if(id == 'fixedLay9') { pTop = 762;}
        if(id == 'fixedLay10') { pTop = 790;}
        if(id == 'fixedLay11') { pTop = 818;}
        if(id == 'fixedLay12') { pTop = 846;}
        if(id == 'fixedLay13') { pTop = 874;}
        if(id == 'fixedLay14') { pTop = 902;}
        if(id == 'fixedLay15') { pTop = 930;}
        if(id == 'fixedLay16') { pTop = 958;}
        if(id == 'fixedLay17') { pTop = 527;}
	if ( document.all ){
		if(document.body.clientWidth > 3855){
			pLeft = ((document.body.clientWidth - 3855) / 2) + 180 ;
		}else{
			pLeft = 180 ;
		}
		document.all( id ).style.posTop = pTop; 
		document.all( id ).style.posLeft = pLeft; 
		document.all( id ).style.visibility = 'visible';
	}else if ( document.getElementById ){
		if(innerWidth > 3855){
			pLeft = ((innerWidth - 3855) / 2) + 180;
		}else{
			pLeft = 180;
		}
		document.getElementById( id ).style.top = pTop +"px"; 
		document.getElementById( id ).style.left = pLeft +"px"; 
		document.getElementById( id ).style.visibility = 'visible';
	}else if ( document.layers ){
		if(innerWidth > 3855){
			pLeft = ((innerWidth - 3855) / 2) + 180;
		}else{
			pLeft = 180;
		}
		document.layers[ id ].moveTo(pLeft, pTop); 
		document.layers[ id ].visibility = 'show';
	}

	clearTimeout(submenuTimer);

	openedMenu = id;

}

//レイヤメニューの削除
function CloseMenu(){ 

	if ( document.all ){
		document.all( openedMenu ).style.visibility = 'hidden';
	}else if ( document.getElementById ){
		document.getElementById( openedMenu ).style.visibility = 'hidden';
	}else if ( document.layers ){
		document.layers[ openedMenu ].visibility = 'hide';
	}

	openedMenu = null;

}
