//マウスのＸ座標を取得する
function getMouseX(e){
  //if(document.layers){ return e.pageX;} //for NN
  if(document.all){ return document.body.scrollLeft + e.clientX;} //for IE
}

//マウスのＹ座標を取得する
function getMouseY(e){
  //if(document.layers){ return e.pageY;}
  if(document.all){ return document.body.scrollTop + e.clientY;}
}


function getXY(e) {
     
     var win_width = document.body.offsetWidth;//ウィンドウ幅
     var win_height = document.body.offsetHeight;//ウィンドウ高さ
     //var hh = screen.availHeight;

   //ウィンドウ内にメニューを納める
   if(win_width - getMouseX(e) < 450){
     mx = win_width - 500;
   }else{
     mx = getMouseX(e) - 10;
     //mx = screen.availLeft + 100;
   }

//   if (win_height - getMouseY(e) < 400) {
//     alert("<400 / win_height - getMouseY = "+win_height+" - "+ getMouseY(e)+"= ???");
//     my = win_height - 100;
//   } else { alert("NOT <400");
     my = getMouseY(e) - 10;//alert("my="+my+" / mx="+mx);
//   }
 }

	var timeoutID = null;
  	function ShowMenu(Layer_ID) {

      		if(timeoutID != null) {
         		clearTimeout(timeoutID);
      		}
      		if (document.all){
	      		frm1.sel1.style.visibility = "hidden";
	      		frm1.sel2.style.visibility = "hidden";
	      		frm1.sel3.style.visibility = "hidden";
				document.all("Menu_"+Layer_ID).style.posLeft = mx;
				document.all("Menu_"+Layer_ID).style.posTop = my;
				document.all("Menu_"+Layer_ID).style.visibility="visible";
			}
			if ((document.layers) || (navigator.userAgent.indexOf("Netscape")!=-1)){
window.open("lang_menu.html#"+Layer_ID,Layer_ID,"toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=480,height=400,left=50,top=50");
			}
	}

  function lang_menu(){
window.open("lang_menu.html#9","","toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=480,height=400,left=50,top=200");
  }

  function howto_show(){
window.open("howto.html","","toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=600,height=600,left=200,top=200");
  }


  function HideMenu1(Layer_ID) {
     if(document.all){
      var hideObj = "HideMenu2('"+Layer_ID+"');";
      timeoutID = setTimeout(hideObj,200);
     }
  }

  function HideMenu2(Layer_ID) {
       if (document.all){
	      document.all("Menu_"+Layer_ID).style.visibility = "hidden";
	      frm1.sel1.style.visibility = "visible";
	      frm1.sel2.style.visibility = "visible";
	      frm1.sel3.style.visibility = "visible";
       }
  }


//聖書の種類選択プルダウンメニュー＆ラジオボタンの制御
function sel_chk(radio_num){
   // alert("sel1="+document.frm1.sel1.selectedIndex+" / radio="+document.frm1.radio[radio_num].checked);
   if (!document.frm1.radio[radio_num].checked){
      switch(radio_num){
        case 0:document.frm1.sel2[0].click();
               document.frm1.sel3[0].click();
               break;

        case 1:document.frm1.sel1[0].click();
               document.frm1.sel3[0].click();
               break;

        case 2:document.frm1.sel1[0].click();
               document.frm1.sel2[0].click();
               break;
        } 
        document.frm1.radio[radio_num].click();
    }
}


function show(){
   if (document.all) {//alert("start");
     wait.style.posLeft="300";
     wait.style.posTop= "300";
     wait.style.visibility= "visible";
   }
   if ((document.layers) || (navigator.userAgent.indexOf("Netscape")!=-1)){
     document.layers["wait"].visibility="show";
     document.layers["wait"].moveTo(300,300);
  }  
}

function hide() { 
     if (document.all) { 
     wait.style.visibility= "hidden";
     }
     if ((document.layers) || (navigator.userAgent.indexOf("Netscape")!=-1)){
     document.layers["wait"].visibility="hide";
    }
}

function reset999() { 
	document.frm1.Title.value="";
	document.frm1.Author.value="";
	document.frm1.Trans.value="";
	document.frm1.Editor.value="";
	document.frm1.Publisher.value="";
	document.frm1.Pub_Year.value="";
	document.frm1.ISBN.value="";
	document.frm1.lang.value="";
	document.frm1.sel1.selectedIndex = 0;
	document.frm1.sel2.selectedIndex = 0;
	document.frm1.sel3.selectedIndex = 0;	
}