/*
###  front.js                                    
#  front共通JSライブラリ
#  ver1.0 (2008.04.02)                       
#  "front.js" is Initial-setting file.         
###
*/

//-----------------------------------------------------------------------------
//    【メソッド名】
//        アクションボタン設定メソッド
//    【引数】
//        val	       	: 設定値
//    【処理概要】
//        ・アクションボタン用hidden値を設定します。
//          <input type="hidden" id="form_button" name="form_button" value="">
//          に値を設定します。
//    【呼び出し例】
//         onclick="setActionBottomValue('next');return true;"
//
//-----------------------------------------------------------------------------
function setActionBottomValue(val) {
	document.getElementById("form_button").value = val;
}

//-----------------------------------------------------------------------------
//    【メソッド名】
//        もうひとつ拠点を追加ボタンアクション
//    【引数】
//    【処理概要】
//-----------------------------------------------------------------------------
function doPlacePlus() {
	document.getElementById("plasField").style.display = 'block';
	document.getElementById("placePlus").style.display = 'none';
	document.getElementById("plasFlag").value = '1';
}

//-----------------------------------------------------------------------------
//    【メソッド名】
//        郵便番号妥当性チェック
//    【引数】
//	 zipCode : 郵便番号文字列
//    【処理概要】
//	 郵便番号文字列が正しければTrue
//	 郵便番号文字列に問題があればFalse
//-----------------------------------------------------------------------------
function checkZipCode(zipCode) {
	return zipCode.match(/(^[0-9０-９]{3}[-‐ー－―][0-9０-９]{4}$)|(^[0-9０-９]{7}$)/);
}
//-----------------------------------------------------------------------------
//    【メソッド名】
//        ２重クリック防止メソッド
//    【引数】
//	 srcIdArray   : ２重クリックを防止するid名(１個目)
//	 srcIdArray2  : ２重クリックを防止するid名(２個目)
//    【処理概要】
//	 送信可能であればTrue
//	 送信させない場合はFalse
//-----------------------------------------------------------------------------
function frontClickCheck(form, srcIdArray, srcIdArray2){
	document.getElementById(srcIdArray).disabled = "disabled";
	document.getElementById(srcIdArray2).disabled = "disabled";
	if(document.getElementById(srcIdArray).disabled != "disabled" || document.getElementById(srcIdArray2).disabled != "disabled"){
		document.getElementById(form).submit();
		return false;
	}
	return true;
}
function frontClickCheck2(form, srcIdArray){
	document.getElementById(srcIdArray).disabled = "disabled";
	if(document.getElementById(srcIdArray).disabled != "disabled"){
		document.getElementById(form).submit();
		return false;
	}
	return true;
}
//-----------------------------------------------------------------------------
//    【メソッド名】
//        Enterキーイベント
//    【引数】
//        form   : 
//        actionBottomVal   : 
//    【処理概要】
//	 Enterキーが押された時、指定するボタン設定で、
//	 フォームを送信します。
//-----------------------------------------------------------------------------
function doEnterKeyAction(form, actionBottomVal){
	if(window.event.keyCode == 13){
		setActionBottomValue(actionBottomVal);
		document.getElementById(form).submit();
		return false;
	}
	return true;
}
var gFixWindowObj = null;
var frontMessageConfirm001 = "※このまま移動すると、自由編集画面の編集内容は反映されません。自由編集画面を閉じてもよろしいですか？";
function clickUnload(){
	if(gFixWindowObj && (! gFixWindowObj.closed) ){
		if(confirm(frontMessageConfirm001)){ //OKボタンが押された時
			gFixWindowObj.close();
		} else {
			gFixWindowObj.focus();
			return false;
		}
	}
}