/* =============================================================
 ALPS Website
 About Alps
company_common.js
 =============================================================== */

/* Common ------------------------------------------------------------start */
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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];}}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/*--------------------
 mouse on
--------------------*/
function changeImage(image_id, image_src) {
	document.getElementById(image_id).src=image_src;
}

/*--------------------
 mouse off
--------------------*/
function returnImage(image_id, image_src) {
	document.getElementById(image_id).src=image_src;
}

/***********************************
 Change Display
************************************/
function clickChange(div_id){
	flag = document.getElementById(div_id).style.display;

	if(flag=="block"){
		document.getElementById(div_id).style.display = "none";
	} else {
		document.getElementById(div_id).style.display = "block";
	}
}

/***********************************
 E-Book
************************************/
function SWindow(Aurl,Aname,Awidth,Aheight,Atoolbar,Alocation,Astatus,Ascroll,Amenu,Aresize){
	Astr = "width=" + Awidth;
	Astr+= ",height=" + Aheight;
	if(Atoolbar)Astr+= ",toolbar";
	if(Alocation)Astr+= ",location";
	if(Astatus)Astr+= ",status";
	if(Ascroll)Astr+= ",scrollbars";
	if(Amenu)Astr+= ",menubar";
	if(Aresize)Astr+= ",resizable";
	note=window.open(Aurl,Aname,Astr);
}

/***********************************
 Display
************************************/
function callBox(div_id){
	document.getElementById(div_id).style.display = "block";
}

/***********************************
 Hide
************************************/
function closeBox(div_id){
	document.getElementById(div_id).style.display = "none";
}

/***********************************
 Print
************************************/
function printBox(){
	window.print();
}
/* Common ------------------------------------------------------------end */



/***********************************
　Clickで該当のマップを表示・マップ以外の情報は非表示
	引数　・div_id：表示するマップのclass
				・other_id：マップ以外のclass
************************************/
function callMap(div_id, other_id){
//	document.getElementById(div_id).style.display = "block";
//	document.getElementById(other_id).style.display = "none";
    $("."+div_id).show();
    $("."+other_id).hide();
}

/***********************************
　Clickで該当のマップを非表示・マップ以外の情報を元に戻す
	引数　・div_id：非表示するマップのclass
				・other_id：マップ以外のclass
************************************/
function closeMap(div_id, other_id){
//	document.getElementById(div_id).style.display = "none";
//	document.getElementById(other_id).style.display = "block";
    $("."+div_id).hide();
    $("."+other_id).show();
}

/***********************************
　ClickでISOを表示・ISO以外の情報は非表示
	引数　・div_id：表示するISOのid
				・other_id：ISO以外のid
************************************/
function callIso(div_id){
	document.getElementById(div_id).style.display = "block";
}

/***********************************
　Clickで該当のISOを非表示・ISO以外の情報を元に戻す
	引数　・div_id：非表示するISOのid
				・other_id：ISO以外のid
************************************/
function closeIso(div_id){
	document.getElementById(div_id).style.display = "none";
}

/***********************************
　Clickで印刷する
	引数　なし
************************************/
function printMap(){
	window.print();
}
/***********************************
 Search
************************************/
window.onload = function(){
	document.getElementById('search_word').onkeydown = function (ev){
		var ev = (!ev) ? event:ev;//Firefox1.5ではevにイベントが入る
//		alert("test");
		var key = ev.keyCode;//取り合えずkeyCodeを取る。
//		alert(key)//Enterキーを押して確認してください。
		var mf = (ev.modifiers) ? ev.modifiers : ((ev.altKey) ? 1 : 0) + ((ev.ctrlKey) ? 2 : 0) + ((ev.shiftKey) ? 4 : 0);//NNがmodifiersでIE,FirefoxがctrlKey、shiftKey、altKeyだったかな？
//		alert(mf)//Enterキーを押して確認してください。
		var k = key + '_' + mf;//ここでkeyCode_modifiersと言う形を作る。
//		alert(k)//Enterキーを押して確認してください。
		if(k == '13_0'){//Enterキーで装飾キーが押されていない。

		multi_search()

		return false;
		}
	}
}

function multi_search(){

	var SearchWord = document.form1.search_word.value;
	var SearchSite = document.form1.send_address.options[document.form1.send_address.selectedIndex].value;

//	alert(SearchSite);

	if (SearchSite == "google_product") {
	
		document.google_search.q.value = SearchWord;
		document.google_search.submit();

	} else if (SearchSite == "catalog") {

		document.catalog_search.key.value = SearchWord;
		document.catalog_search.submit();

	} else if (SearchSite == "google_company") {

		document.google_search_company.q.value = SearchWord;
		document.google_search_company.submit();

	} else {

//	alert(SearchSite + "…存在しません。" );

	}
}
