var in_menu = "";
var in_mado = "";
var in_menu_sub = "";
var in_mado_sub = "";
var subFlg = 0;

document.onclick = mado_out_all;

function mado_in(id_menu,id_mado,kaisou){

    if(kaisou!=9){          
        if(navigator.userAgent.indexOf("Firefox")!=-1)
        { 
            document.getElementById(id_mado).style.left = '0px';
        }        
		document.getElementById(id_mado).style.visibility='visible';
	}

	if(kaisou==2){
		sub_mado_set(id_mado);
		in_mado_sub=id_mado;
		in_menu_sub=id_menu;
		subFlg=1;
	}

	document.getElementById(id_menu).style.backgroundColor='#669966';
	document.getElementById(id_menu).style.border='2px inset #ffffee';

	if(kaisou==1){
		in_mado=id_mado;
		in_menu=id_menu;
	}
	if(kaisou==2){
		in_mado_sub=id_mado;
		in_menu_sub=id_menu;
		subFlg=1;
	}
}

function menu_in(id_menu){
	document.getElementById(id_menu).style.backgroundColor='#e1f9d5';
	document.getElementById(id_menu).style.border='2px inset #ffffee';
}

function menu_out(id_menu){
	if (id_menu!='') {
		if (document.getElementById(id_menu).style.visibility=='hidden') return;
	}

	document.getElementById(id_menu).style.backgroundColor='#BCBCBC';
	document.getElementById(id_menu).style.border='thin groove #ffffee';
}

function mado_out(id_menu,id_mado){
	if (id_menu!='') {
		if (document.getElementById(id_menu).style.visibility=='hidden') return;
	}
	if (id_mado!='') {
		if (document.getElementById(id_mado).style.visibility=='hidden') return;
	}

	subFlg=0;
	if(id_mado!=''){
		document.getElementById(id_mado).style.visibility='hidden';
	}
	document.getElementById(id_menu).style.backgroundColor='#BCBCBC';
	document.getElementById(id_menu).style.border='thin groove #ffffee';
}

function mado_out_all(){
	if(in_menu_sub!=""){mado_out(in_menu_sub,in_mado_sub);in_mado_sub="";in_menu_sub="";}
	if(in_menu!=""){mado_out(in_menu,in_mado);in_mado="";in_menu="";}
}

function mado_out_sub(){
	if(in_menu_sub!=""){	
		mado_out(in_menu_sub,in_mado_sub);
		in_mado_sub="";
		in_menu_sub="";
	}
}


function sub_mado_set(id_mado){

    var i, pos, doc_width = 800;
	if (id_mado!='') 
	{
		if (document.getElementById(id_mado).style.visibility=='hidden') return;
	}
	
	var opera  = (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById)? 1 : 0; 
	var ns4up = (navigator.userAgent.indexOf("Firefox")!=-1) ? 1 : 0;
	var ie4up = (document.all) ? 1 : 0;	
	
	if (ns4up) {
			doc_width = self.innerWidth;			
	} else if (ie4up || opera) {
			doc_width = document.body.clientWidth;
	}

	if ( id_mado != "sub20_10" ) 
	{
	    pos = doc_width / 2 + 170;
	} 
	else 
	{
		//放射線利用技術部		
        pos = doc_width / 2 + 260;		//右へ
        pos = doc_width / 2 - 15;		//左へ
	}
	
	document.getElementById(id_mado).style.left=pos;
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


<!--HPB_SCRIPT_CODE_40
// _ShowObj: オブジェクトを表示します
//
function _ShowObj(lId)
{
  var ob;ob=new Array;
  var appVer=parseInt(navigator.appVersion);
  var isNC=(document.layers && (appVer >= 4)); // Netscape Navigator 4.0 or later
  var isIE=(document.all    && (appVer >= 4)); // Internet Explorer  4.0 or later
  if (isNC)
  {
    w_str = "document." + lId;ob[lId] = eval(w_str);
    ob[lId].visibility = "show";
  }
  if (isIE)
  {
    w_str = "document.all.item(\"" + lId + "\").style";ob[lId] = eval(w_str);
    ob[lId].visibility = "visible";
  }
}
//-->

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}


<!--HPB_SCRIPT_CODE_40
// _HideObj: オブジェクトを非表示にします
//
function _HideObj(lId)
{
  var ob;ob=new Array;
  var appVer=parseInt(navigator.appVersion);
  var isNC=(document.layers && (appVer >= 4)); // Netscape Navigator 4.0 or later
  var isIE=(document.all    && (appVer >= 4)); // Internet Explorer  4.0 or later
  if (isNC)
  {
    w_str = "document." + lId;ob[lId] = eval(w_str);
    ob[lId].visibility = "hide";
  }
  if (isIE)
  {
    w_str = "document.all.item(\"" + lId + "\").style";ob[lId] = eval(w_str);
    ob[lId].visibility = "hidden";
  }
}
//-->
//----------------------------------------------------------------------------
//Finding the left position of the dom object
//----------------------------------------------------------------------------
function findPos(obj) {
 var curleft = curtop = 0; 
 if (obj.offsetParent) {
  curleft = obj.offsetLeft  
  curtop = obj.offsetTop
  while (obj = obj.offsetParent) {
   curleft += obj.offsetLeft
   curtop += obj.offsetTop
  }
 }
 return curleft;
} 
