
// 株式会社ALBERT
// ポップアップメニュー　ヘッダー用

// ポップアップメニュー入口

var openedMenu = null;
var submenuTimer;

function menuOvr(id){
  if (openedMenu && openedMenu != id){
    CloseMenu(id);
  }
  OpenMenu(id);
}

function OpenMenu(id){
  var pTop, pLeft;
  if(id == 'g-navi01') { pTop = 234;}
  if(id == 'g-navi02') { pTop = 234;}
  if(id == 'g-navi03') { pTop = 234;}
  if(id == 'g-navi04') { pTop = 234;}
  if(id == 'g-navi05') { pTop = 234;}
  if(id == 'g-navi06') { pTop = 234;}
  if(id == 'g-navi07') { pTop = 234;}
  if(id == 'g-navi08') { pTop = 234;}
  

  if ( document.all ){
    if(document.body.clientWidth > 830){
      pLeft = ((document.body.clientWidth - 830) / 2) + 25;
    }else{
      pLeft = 25 ;
    }
    document.all( id ).style.posTop = pTop; 
    document.all( id ).style.posLeft = pLeft; 
    document.all( id ).style.visibility = 'visible';
    
  }else if ( document.getElementById ){
	  if(innerWidth > 830){
	    pLeft = ((innerWidth - 830) / 2) + 17;
	  }else{
	    pLeft = 25;
	  }
    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 > 830){
	    pLeft = ((innerWidth - 830) / 2) + 24;
	  }else{
	    pLeft = 17;
	  }
    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;
}

// ポップアップメニュー　ここまで

// プリロードイメージ用　スクリプト入口

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

// プリロードイメージ用　スクリプトここまで
