//*****************************************************
//	tenshoku-maps-index JavaScript
//*****************************************************

//*****************************************************
//	指定タグのある文字列を含むIDを検索し返す
//  in  : parents --> IDに含む文字列
//  in  : tag     --> 指定タグ文字
//  out : 検索された最初のID文字列
//*****************************************************
function findID(parents,tag)
{
	objDiv=document.getElementsByTagName(tag);

	objRegex = new RegExp(parents);

	for(i=0; i<objDiv.length; i++)
	{
		if(objDiv[i].id.match(objRegex))
		{
			return objDiv[i].id;
		}
	}
}

function PostBack()
{
	if(document.location.protocol=="http:")
	{
		varHTML = "<A href=";
		varHTML += document.location.href.replace("http://www.keiei-mapx.com","https://www.keiei-mapx.com");
		varHTML += " style='color:blue; TEXT-DECORATION: underline'>セキュアモードＯＮ</A></span>";
	}
	else
	{
		varHTML = "<A href=";
		varHTML += document.location.href.replace("https://www.keiei-mapx.com","http://www.keiei-mapx.com");
		varHTML += " style='color:blue; TEXT-DECORATION: underline'>セキュアモードＯＦＦ</A></span>";
	}
	document.getElementById("SecureChange").innerHTML = varHTML;
}

//add-s.fukui@tato 060531 start
function AutoSecureMode()
{
	// 2006/12/26 T.AOSAWA UPDATE BEGIN
	// if(document.location.protocol=="http:")
	// {
	// 	document.location.href = document.location.href.replace("http://www.keiei-mapx.com","https://www.keiei-mapx.com");
	// }
	if(document.location.protocol=="http:")
	{
		if(document.location.hostname == "www.keiei-mapx.com")
		{
			document.location.href = document.location.href.replace("http://www.keiei-mapx.com","https://www.keiei-mapx.com");
		}
		else if(document.location.hostname != "localhost")
		{
			document.location.href = document.location.href.replace("http://" + document.location.hostname,
																		"https://" + document.location.hostname);
		}
	}
	// 2006/12/26 T.AOSAWA UPDATE BEGIN
}
//add-end
//
/*////////////////////////////////////////
//  別windowでページを表示
*/////////////////////////////////////////
function newpage(nm){
		// screenサイズ
		var wWedth = screen.width;
		var wHeight = screen.height;
		
		// Faq
		if(nm == "help"){
			var w = window.open('/FAQ/faq_index.htm',nm,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,dependent=yes,width=470,height=500,screenX=0,screenY=0,left=0,top=0');
			w.focus();
			return w;
		}
		// 求人情報更新
		if(nm == "update"){
			var w = window.open('/aboutupdate.aspx',nm,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,dependent=yes,width=470,height=500,screenX=0,screenY=0,left=0,top=0');
			w.focus();
			return w;		
		}
		// プライベートポリシー
		if(nm == "policy"){
			var w = window.open('/policy.aspx',nm,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,dependent=yes,width=500,height=650,screenX=0,screenY=0,left=0,top=0');
			w.focus();
			return w;		
		}
		// 利用規約
		if(nm == "kiyaku"){
			var w = window.open('/kiyaku.aspx',nm,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,dependent=yes,width=500,height=540,screenX=0,screenY=0,left=0,top=0');
			w.focus();
			return w;
		}
		// 募集情報作成使用方法
		if(nm == "boshu"){
			var w = window.open('/Tenshoku/PageCreate/howtouse.htm',nm,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,dependent=yes,width=810,height=700,screenX=0,screenY=0,left=0,top=0');
			w.focus();
			return w;
		}

}

//add 2006/9/13 S.FUKUI
//*****************************************************
//	Enterキー押下を無効化
//*****************************************************
function EnterNotSubmit(){
	if(event.keyCode==13){
		if(window.event.srcElement.type!='submit' && 
			window.event.srcElement.type!='textarea' &&
			window.event.srcElement.type!='button' &&
			window.event.srcElement.type!='image'){
				if(window.event.srcElement.toString().indexOf('http')!=-1 ||
				   window.event.srcElement.toString().indexOf('javascript:')!=-1){
					return true;
				}
				else {
					return false;
				}
		}
	}
}