/*
 *http://www.dateblock.com/nmcdr/tmail.phpのjs/javascript.js（他のディレクトリのものとは違うので注意）
 **/

/**********************************
 *定義
 **********************************/

//汎用-------------------------
var d=document;
function getElm(idname){
	return d.getElementById(idname);
}
function debug(str){
	alert("【"+str+"】：\n"+str);
}
//myFunction.phpでボタンをprintしてある
function debugDispOn(ths){
  if(ths.value=="ON!"){//onにする
    $("div.debug").css("display","block");//jqcss
    $("div.DbugL").css("display","block");//jqcss
    ths.value="OFF!";//表示文字を切り替える
  }else{
    $("div.debug").css("display","none");//jqcss
    $("div.DbugL").css("display","none");//jqcss
    ths.value="ON!";//表示文字を切り替える
  }
}
//alert("form.js!!")
/*
 *local IEデバッグ用
 */
//var isMSIE = /*@cc_on!@*/false;
//if(location.href.indexOf("localhost",0)>0 && isMSIE){
//  var firebug=document.createElement('script');firebug.setAttribute('src','http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js');document.body.appendChild(firebug);(function(){if(window.firebug.version){firebug.init();}else{setTimeout(arguments.callee);}})();
//
//}

//-----------------------------

//alert("form.js 読み込みok");

//submitで送信
//function tafm_next(){
////	with(document.myForm){
////		tfm_type.value="tafm_next";
////		action="tmail.php";
////		method="POST";
////		submit();
////	}
//	var dForm=document.myForm;
//	if(chkForm(dForm)){//実行＋返り値判定
////		dForm.tfm_type.value="tafm_next";
////		dForm.action="http://www.dateblock.com/nmcdr/tmail.php";
////		dForm.method="POST";
////		dForm.submit();
//		dForm.action="mailto:"+dForm.pstxt2.value +"?subject=DateBlockカレンダーについてのお問い合わせ&body="+dForm.usbox1.value;
//		dForm.method="POST";
//		dForm.submit();
//	}
//}

//既存JSを流用
function tafm_next(){
	with(document.myForm){
		tfm_type.value="tafm_next";
		action="tmail.php";
		method="POST";
		submit();
	}
}
//inquiry_TEST/tmail.tpl問い合わせ文字化けテストページ
function tafm_next_test(){
	with(document.myForm){
		tfm_type.value="tafm_next_test";
		action="tmail_test.php";
		method="POST";
		submit();
	}	
}

//【未採用】バリデート//PHP側の既存流用で行う
function chkForm(frm){
	var errMsg="";
	if(frm.pstxt.value==""){
		errMsg+="入力エラー：お名前 が入力されていません。<br />";
	}
	if(frm.pstxt2.value==""){
		errMsg+="入力エラー：Ｅメールアドレス が入力されていません。<br />";
	}
	if(frm.in_tmtel1.value==""&&frm.in_tmtel2.value&&frm.in_tmtel3.value){
		errMsg+="入力エラー：お電話番号 が入力されていません。<br />";
	}
	if(frm.usbox1.value==""){
		errMsg+="入力エラー：お問い合わせの内容 が入力されていません。<br />";
	}
	debug(errMsg);
	if(errMsg==""){
		return true;
	}else{debug("false");
		getElm("err_sec").style.backgroundColor="#f3f3f3";
		getElm("err_sec").innerHTML=errMsg;
	}
}

/**************************************
*カートでの処理wp001.html他、cartでの数量300以上
*見積もり画面(親/子ウィンドウ)
***************************************/
//親ウィンドウでの処理
//function open_mWin(ths){
//  //window.open('http://www.dateblock.com/'+ths.value+'/mitumori.html','mitumori','menubar=no,scrollbars=yes,height=900,width=680');//xxx親に書き込めない
//  window.open('../cart/mitumori/'+ths.value+'.html','mitumori','menubar=no,scrollbars=yes,height=900,width=680');
//  //20091127追加
//  document.Fm_mitumori.prodid.value="";//初期化
//  getElm("err_prodid").style.display="inline";
//}
var subwin;
function open_mWin(ths){
  if(ths.value=="選択"){//alert(d.Fm_mitumori.category.value);
    if(subwin){//alert(subwin)
      window.subwin.close(); // サブウィンドウを閉じる
    }
    subwin=window.open('../cart/mitumori/'+ d.Fm_mitumori.category.value +'.html','mitumori','menubar=no,scrollbars=yes,height=900,width=680');

  }else{
    //window.open('http://www.dateblock.com/'+ths.value+'/mitumori.html','mitumori','menubar=no,scrollbars=yes,height=900,width=680');//xxx親に書き込めない
    if(subwin){//alert(subwin)
      window.subwin.close(); // サブウィンドウを閉じる
    }
    subwin=window.open('../cart/mitumori/'+ths.value+'.html','mitumori','menubar=no,scrollbars=yes,height=900,width=680');
  }

  document.Fm_mitumori.prodid.value="";//初期化
  getElm("err_prodid").style.display="inline";
}
//子ウィンドウでの処理
//function setOyaWinValue(ths){
//  //親ウィンドウのlocationをチェック
//  if(window.opener.document.Fm_mitumori){//ok
//    window.opener.document.Fm_mitumori.prodid.value=ths.id;//alert(window.document.length)
//  }
//  //prodidのチェックをはずすため
//  window.opener.document.getElementById("err_prodid").style.display="none";
//
//  window.close();
//}

//子ウィンドウでの処理12/07修正
function setOyaWinValue(ths){
  //親ウィンドウのlocationをチェック
  if(document.Fm_mitumori){//ok
    document.Fm_mitumori.prodid.value=ths.id;//alert(window.document.length)
  }
  //prodidのチェックをはずすため
  document.getElementById("err_prodid").style.display="none";

  ipopClose();
}

function mitumoriBtn(){
  var retStr=formVaridate("Fm_mitumori");//alert(retStr);
  if(retStr!="validOK"){//NGの時
    //getElm("error_valid").innerHTML+="<p>未入力の項目があります。もう一度ご確認ください。</p>";//test
    //getElm("error_valid").firstChild.nodeValue="未入力の項目があります。もう一度ご確認ください。";
    //getElm("error_valid").removeChild(getElm("error_valid").firstChild);
    while(getElm("error_valid").firstChild){
      getElm("error_valid").removeChild(getElm("error_valid").firstChild);
    }
    getElm("error_valid").innerHTML="<p>未入力の項目があります。もう一度ご確認ください。</p>";
    getElm("error_valid").style.display="block";
    //alert("NG!");
    return;
  }else if(getElm("pnmkbn1") && getElm("pnmkbn1").checked==true){
    if(isNaN(getElm("suuryou").value)||getElm("suuryou").value==0||getElm("suuryou").value<30||getElm("suuryou").value%10!=0){//alert(isNaN(getElm("suuryou").value))
      while(getElm("error_valid").firstChild){
        getElm("error_valid").removeChild(getElm("error_valid").firstChild);
      }
      getElm("error_valid").innerHTML="<p>※名入れの数量は有効な数字を30個以上から10個単位にてお願い致します。</p>";
      getElm("error_valid").style.display="block";
      //alert("NG!");
      return;
    }
  }
  //他はOK
  getElm("error_valid").style.display="none";

	with(document.Fm_mitumori){
		//action="http://www.dateblock.com/nmcdr/index.php";
		action="https://www.dateblock.com/cart/index.php"; //"/cart/index.php";
		method="POST";
		submit();
	}  
}
function mitumoriBtn2(){

	with(document.Fm_mitumori2){
		//action="http://www.dateblock.com/nmcdr/index.php";
		action="https://www.dateblock.com/cart/index.php"; //"/cart/index.php";
		method="POST";
		submit();
	}  
}

//20091204追加-ポップアップをjQueryで代替//【jQuery必須】
function run_ipop(){
//$.ajax({
//    url: '../cart/mitumori/'+ d.Fm_mitumori.category.value +'.html',  // リクエストURL
////    data: {                                            // 送信データ
////        "vq": "テスト",            // 検索文字列
////        "max-results": 5,         // 最大取得件数
////        "alt": "json-in-script"   // jsonp
////    },
////    dataType: "jsonp",                                 // jsonp
//    cache: true,                                       // キャッシュする
//    success: function(data, status) {alert(status)
//
//    }
//});

//  $("#rap").css("filter", "alpha(opacity=20)");
//  $("#rap").css("-moz-opacity", 0.2);
//  $("#rap").css("opacity", 0.2);
//  $("#ipop").css("filter", "alpha(opacity=100)");
//  $("#ipop").css("-moz-opacity", 1.0);
//  $("#ipop").css("opacity", 1.0);
//$("body").css("background-color", "#f3f3f3");

  //$("#ipop").load("/jquery/ #top-news div[class=inner]");
  //$("#ipop").load('../cart/mitumori/'+ d.Fm_mitumori.category.value +".html #Maincontents_m");//
  $("#ipop").load('../cart/mitumori/'+ d.Fm_mitumori.category.value +"_m.html #Maincontents_m");//ok

//    $("#ipop").load('../cart/mitumori/'+ d.Fm_mitumori.category.value +"_m.html #Maincontents_m", "", function(){
//      $("#ipop").fadeIn(300);
//    });



  document.Fm_mitumori.prodid.value="";//初期化
  document.Fm_mitumori.suuryou.value="";//初期化
  getElm("err_prodid").style.display="inline";

  $.ipop();
//背景を一時消す（後に戻す）
$("#Header").css("display", "none");
$("#Container").css("display", "none");
$("#Footer").css("display", "none");

}

// 閉じるボタンを押したとき
function ipopClose(){//alert("閉じる")
  //$('#ipop_close').click(function() {
    $('#ipop').fadeOut(300);//元ソース
    $("#Header").css("display", "block");
    $("#Container").css("display", "block");
    $("#Footer").css("display", "block");
  //});
}

(function($) {
    $.ipop = function() {
        var wx, wy;        // ウインドウの左上座標
        var mx, my;        // マウスの座標

        // ウインドウの座標を画面中央にする。
        wx = $().scrollLeft() + ($(window).width() - $('#ipop').outerWidth()) / 2;
        if (wx < 0) wx = 0;
        //wy = $().scrollTop() + ($(window).height() - $('#ipop').outerHeight()) / 2;//元ソース
        wy = 0;
        if (wy < 0) wy = 0;

        // ポップアップウインドウを表示する。
        $('#ipop').css('top', wy).css('left', wx).fadeIn(300);

//        // 閉じるボタンを押したとき
//        $('#ipop_close').click(function() {alert("閉じる")
//          $('#ipop').fadeOut(200);//元ソース
//          $("#Header").css("display", "block");
//          $("#Container").css("display", "block");
//          $("#Footer").css("display", "block");
//        });


//        // タイトルバーをドラッグしたとき
//        $('#ipop_title').mousedown(function(e) {
//            mx = e.pageX;
//            my = e.pageY;
//            $().mousemove(mouseMove).mouseup(mouseUp);
//            return false;
//        });
//        function mouseMove(e) {
//            wx += e.pageX - mx;
//            wy += e.pageY - my;
//            $('#ipop').css('top', wy).css('left', wx);
//            mx = e.pageX;
//            my = e.pageY;
//            return false;
//        }
//        function mouseUp() {
//            $().unbind('mousemove', mouseMove).unbind('mouseup', mouseUp);
//        }
    }
})(jQuery);

//疑似ポップアップから商品概要へジャンプ
function jumpToGaiyou(ths){//alert(ths.id)
  //万年以外は定義できる
  var cate = ths.id.substring(0, 1);//[tw/ps/tw/万年]
  var num  = "aaa";//内部形式:文字列にしておく
  num  = ths.id.substring(2, 3);//001
  //alert(ths.id)
//  alert(ths.id.substring(0, 2))
//  alert(ths.id.indexOf("tw",0))
  if(ths.id.indexOf("wp",0)!=-1){
    //alert("wp!");
    location.href="http://www.dateblock.com/kabekake/hangercalendar/" + ths.id +".html";
  }else if(ths.id.indexOf("ps",0)!=-1){
    //alert("ps!");
    location.href="http://www.dateblock.com/takujou/taku02/" + ths.id +".html";
  }else if(ths.id.indexOf("tw",0)!=-1){
    //alert("tw!");
    location.href="http://www.dateblock.com/himekuri/today/" + ths.id +".html";
  }else{//万年の場合
    //alert("そのた")
    //DBL
    if(ths.id=="dbl-#0"){
      location.href="http://www.dateblock.com/mannen/dateblock_lite/dl001.html";
    }else if(ths.id=="dbl-#1"){
      location.href="http://www.dateblock.com/mannen/dateblock_lite/dl002.html";
    }else if(ths.id=="dbl-#2"){
      location.href="http://www.dateblock.com/mannen/dateblock_lite/dl003.html";
    }else if(ths.id=="dbl-#11"){
      location.href="http://www.dateblock.com/mannen/dateblock_lite/dl004.html";
    }else if(ths.id=="dbl-#3"){
      location.href="http://www.dateblock.com/mannen/dateblock_lite/dl005.html";
    }else if(ths.id=="dbl-#4"){
      location.href="http://www.dateblock.com/mannen/dateblock_lite/dl006.html";
    }else if(ths.id=="dbl-#5"){
      location.href="http://www.dateblock.com/mannen/dateblock_lite/dl007.html";
    }else if(ths.id=="dbl-#6"){
      location.href="http://www.dateblock.com/mannen/dateblock_lite/dl008.html";
    //Wall
    }else if(ths.id=="wal-wh"){
      location.href="http://www.dateblock.com/mannen/dateblock_wall/dw001.html";
    //DS(Extra含む)
    }else if(ths.id=="dyk-bl"){
      location.href="http://www.dateblock.com/mannen/dateblock_desktop/ds001.html";
    }else if(ths.id=="dyk-wh"){
      location.href="http://www.dateblock.com/mannen/dateblock_desktop/ds002.html";
    }else if(ths.id=="dtt-bl"){
      location.href="http://www.dateblock.com/mannen/dateblock_desktop/ds003.html";
    }else if(ths.id=="dtt-wh"){
      location.href="http://www.dateblock.com/mannen/dateblock_desktop/ds004.html";
    }else if(ths.id=="dyk-bl-ex"){
      location.href="http://www.dateblock.com/mannen/dateblock_desktop/de001.html";
    }

  }

}



/**************************************
*nmjavascript.js
*カートでの処理ph001.html
***************************************/
//各商品ページから
function nmc_CartIn(){
	with(document.nmc_Form){
		//action="http://www.dateblock.com/nmcdr/index.php";
    act.value="dispcart";
		action="https://www.dateblock.com/cart/index.php"; //"/cart/index.php";
		method="POST";
		submit();
	}
}
//test環境用---
function nmc_CartIn_test(){
	with(document.nmc_Form){
		//action="http://www.dateblock.com/nmcdr/index.php";
    act.value="dispcart";
		action="https://www.dateblock.com/cart_TEST/index.php"; //"/cart/index.php";
		method="POST";
		submit();
	}
}
function page_to1_test(ths){//alert(ths)
  if(ths=="page_to1back"){//alert("")
    with(document.order_Form2){
      //action="http://www.dateblock.com/nmcdr/index.php";
      act.value="order1_bk";
      action="https://www.dateblock.com/cart_TEST/index.php"; //"/cart/index.php";
      method="POST";
      submit();
    }
  }else{
    with(document.order_Form){
      //action="http://www.dateblock.com/nmcdr/index.php";
      act.value="order1";
      action="https://www.dateblock.com/cart_TEST/index.php"; //"/cart/index.php";
      method="POST";
      submit();
    }
  }
}
function page_to0_test(){
	with(document.page_to0From){
		//action="http://www.dateblock.com/nmcdr/index.php";
    act.value="dispcart";
		action="https://www.dateblock.com/cart_TEST/index.php"; //"/cart/index.php";
		method="POST";
		submit();
	}
}
function page_to2_test(str){
  if(str=="page_to2back"){
    with(document.page_backto2From){
      //action="http://www.dateblock.com/nmcdr/index.php";
      act.value="order2_bk";
      action="https://www.dateblock.com/cart_TEST/index.php"; //"/cart/index.php";
      method="POST";
      submit();
    }
  }else{//普通に進む時
    with(document.order_Form1){
      //action="http://www.dateblock.com/nmcdr/index.php";
      act.value="order2";
      action="https://www.dateblock.com/cart_TEST/index.php"; //"/cart/index.php";
      method="POST";
      submit();
    }
  }
}
function page_to3_test(){
  var retStr=formVaridate("order_Form2");
  if(retStr!="validOK"){//NG
    //getElm("error_valid").innerHTML+="<p>"+retStr+"</p>";//test
    getElm("error_valid").style.display="block";
    //alert("NG!");
    return;
  }
  getElm("error_valid").style.display="none";
  with(document.order_Form2){
		//action="http://www.dateblock.com/nmcdr/index.php";
    act.value="order3";
		action="https://www.dateblock.com/cart_TEST/index.php"; //"/cart/index.php";
		method="POST";
		submit();
  }
}
function page_to4_test(){
  with(document.order_Form3){
    act.value="order4";
		action="https://www.dateblock.com/cart_TEST/index.php"; //"/cart/index.php";
		method="POST";
		submit();
  }
}

//各商品ページから(dbshopのjavascript.jsへも転載済)
function goMitumori(){
	with(document.nmc_Form){
		//action="http://www.dateblock.com/nmcdr/index.php";
    act.value="mitumori";
		action="https://www.dateblock.com/cart/index.php"; //"/cart/index.php";
		method="POST";
		submit();
	}
}
//ナビから
function goMitumori_fromnavi(){
	with(document.navi_Form){
		//action="http://www.dateblock.com/nmcdr/index.php";
    act.value="mitumori";
		action="https://www.dateblock.com/cart/index.php"; //"/cart/index.php";
		method="POST";
		submit();
	}
}
function dispcart(){
	with(document.fm_dispcart){
		//action="http://www.dateblock.com/nmcdr/index.php";
		action="https://www.dateblock.com/cart/index.php"; //"/cart/index.php";
		method="POST";
		submit();
	}
}
function dispcart_dbtest(){//20090829test
	with(document.fm_dispcart){
		//action="http://www.dateblock.com/nmcdr/index.php";
		action="/cart/index.php";
		method="POST";
		submit();
	}
}
//名入れ有りなしで表示/非表示
function switchDispNm(obj){
  if(obj.value=="pnmkbn1" && obj.checked){//名入れありのラジオボタン＋チェックされたら
    getElm("DispNm").style.display="block";
  }else{
    getElm("DispNm").style.display="none";
  }
}
/**************************************
*
*カートでの処理cart.tpl
***************************************/
function delCartId(id){//alert(id);alert(document.forms["fm_crtdel"].del_cartid.value)
  document.forms["fm_crtdel"].del_cartid.value=id;//hiddenタグここで設定
	with(document.fm_crtdel){
		//del_cartid.value=id;//hiddenタグここで設定//このやりかたではxxx
    //alert(del_cartid.value);
		action="index.php";
		method="POST";
		submit();
  }
}

/*
 *to0:cart.tplへ
 *to1:order1.tplへ
 *
 */
//order1へのsubmit
function page_to1(ths){//alert(ths)
  if(ths=="page_to1back"){//alert("")
    with(document.order_Form2){
      //action="http://www.dateblock.com/nmcdr/index.php";
      act.value="order1_bk";
      action="https://www.dateblock.com/cart/index.php"; //"/cart/index.php";
      method="POST";
      submit();
    }
  }else{
    with(document.order_Form){
      //action="http://www.dateblock.com/nmcdr/index.php";
      act.value="order1";
      action="https://www.dateblock.com/cart/index.php"; //"/cart/index.php";
      method="POST";
      submit();
    }
  }
}
function page_to0(){
	with(document.page_to0From){
		//action="http://www.dateblock.com/nmcdr/index.php";
    act.value="dispcart";
		action="https://www.dateblock.com/cart/index.php"; //"/cart/index.php";
		method="POST";
		submit();
	}
}
function page_to2(str){
  if(str=="page_to2back"){
    with(document.page_backto2From){
      //action="http://www.dateblock.com/nmcdr/index.php";
      act.value="order2_bk";
      action="https://www.dateblock.com/cart/index.php"; //"/cart/index.php";
      method="POST";
      submit();
    }
  }else{//普通に進む時
    with(document.order_Form1){
      //action="http://www.dateblock.com/nmcdr/index.php";
      act.value="order2";
      action="https://www.dateblock.com/cart/index.php"; //"/cart/index.php";
      method="POST";
      submit();
    }
  }
}
function page_to3(){
  var retStr=formVaridate("order_Form2");
  if(retStr!="validOK"){//NG
    //getElm("error_valid").innerHTML+="<p>"+retStr+"</p>";//test
    getElm("error_valid").style.display="block";
    //alert("NG!");
    return;
  }
  getElm("error_valid").style.display="none";
  with(document.order_Form2){
		//action="http://www.dateblock.com/nmcdr/index.php";
    act.value="order3";
		action="https://www.dateblock.com/cart/index.php"; //"/cart/index.php";
		method="POST";
		submit();
  }
}
function page_to4(){
  with(document.order_Form3){
    act.value="order4";
		action="https://www.dateblock.com/cart/index.php"; //"/cart/index.php";
		method="POST";
		submit();
  }
}
/**************************************
*
*情報入力1 order1.tpl
***************************************/
//IEでのbody onload動かない対策

 //JQinitOrder('order1');

//ロゴ入れ(あり/なし)で「ロゴ部分の色」表示をトグルする
function dispOnOff(ths, cartid){
  if(ths.value=="logokbn1"){
    getElm("dispOnOff_logo"+cartid).style.display="block";
  }else if(ths.value=="logokbn2"){
    getElm("dispOnOff_logo"+cartid).style.display="none";
  }
}
function switchDisInput(obj_tonari){//alert(obj_tonari.id)
  var tmpStr=obj_tonari.id.substring(0, obj_tonari.id.length-1);//alert(tmpStr)//ok
  var radioList = d.getElementsByName(tmpStr);//alert(radioList.length)
  var radioValue = "";
  for(var i=0; i<radioList.length; i++){
    if (radioList[i].checked) {
      radioValue = radioList[i].value;//alert(radioValue)
      break;
    }
  
  }
  //alert(radioValue + "が選択されています");
  //tmpStrからid（=先頭から数値部のみ）だけ取り出す
  var insNum="";
  for(var j=0; j<tmpStr.length; j++){
    if(!isNaN(tmpStr.charAt(j))){//数値ならisNaN:true
      insNum+=tmpStr.charAt(j);
    }
  }
  //alert(insNum)//ok

  //if(radioValue==tmpStr+"2"){//更にここで調整
  //var tmpStr2=tmpStr.substring(0, tmpStr.length-1);
  if(insNum+radioValue==tmpStr+"2"){//[…kbn1/…kbn2]
    getElm(tmpStr+"_inp").value="";
    getElm(tmpStr+"_inp").disabled=false;
  }else{//alert(tmpStr)
    getElm(tmpStr+"_inp").value="";
    getElm(tmpStr+"_inp").disabled=true;
  }
}
//body onloadでサブinputはdisablee=true;として初期化する
function inpDisable(){//alert("")
  var arrInput=d.getElementsByTagName("input");//alert(arrInput.length)
  for(var i=0;i<arrInput.length; i++ ){//alert(arrInput[i].id);
    if(arrInput[i].id.indexOf("2_inp", 0)!=-1){
      arrInput[i].disabled=true;
    }
  }
  //ラジオボックスによるdivの非表示を初期化
  if(getElm("haisoukbn1")){
    var initChecked=getElm("haisoukbn1");
    initChecked.checked=true;
    dispHaisousaki(initChecked);
  }
  //localhostの時はテストデータをセットする
  //if(location.href.indexOf("localhost",0)>0){
    setTimeout("testdataInput()", 1000);
  //}
}
/*テストデータ入力関数*/
function testdataInput(){
  //テキストボックス
//  var arrInput=d.getElementsByTagName("input");
//  for(var i=0;i<arrInput.length;i++){
//    if(arrInput[i].type=="radio"){//alert(arrInput[i].name)
//      if(arrInput[i].value.indexOf("2")!=-1){
//        arrInput[i].checked=true;
//        arrInput[i].focus();
//      }
//    }
//    if(arrInput[i].type=="text"){//alert(arrInput[i].name)
//      arrInput[i].value=arrInput[i].name;
//      if(arrInput[i].name!="eigyousyo"){//IEでエラー出るため
//        arrInput[i].focus();
//      }
//      
//    }
//
//  }
//  arrInput[0].focus();

  //20090826リファイン
  var arrInput=d.getElementsByTagName("input");
  for(var i=0;i<arrInput.length;i++){
    //ラジオボックス
    if(arrInput[i].type=="radio"){//alert(arrInput[i].name)
      if(arrInput[i].value.indexOf("2")!=-1){
        arrInput[i].checked=true;
        arrInput[i].focus();
      }
    }
    //テキストボックス
    if(arrInput[i].type=="text"){
      if(arrInput[i].name=="namae"){
        arrInput[i].value="名前";
      }else if(arrInput[i].name=="hurigana"){
        arrInput[i].value="フリガナ";
      }else if(arrInput[i].name=="emaila"){
        arrInput[i].value="higashi@aru.gr.jp";
      }else if(arrInput[i].name=="emailb"){
        arrInput[i].value="higashi@aru.gr.jp";
      }else if(arrInput[i].name=="yuubina"){
        arrInput[i].value="810";
      }else if(arrInput[i].name=="yuubinb"){
        arrInput[i].value="0001";
      }else if(arrInput[i].name=="heya"){
        arrInput[i].value="さんはいつー101";
      }else if(arrInput[i].name=="kaisya"){
        arrInput[i].value="会社";
      }else if(arrInput[i].name=="bumon"){
        arrInput[i].value="部門";
      }else if(arrInput[i].name=="tela"){
        arrInput[i].value="000";
      }else if(arrInput[i].name=="telb"){
        arrInput[i].value="0000";
      }else if(arrInput[i].name=="telc"){
        arrInput[i].value="0000";
      }else if(arrInput[i].name=="ccode"){
        arrInput[i].value="ccode00";
      }else if(arrInput[i].name=="eigyousyo"){
        arrInput[i].value="営業所名A";
      }else if(arrInput[i].name=="namae2"){
        arrInput[i].value="名前2";
      }else if(arrInput[i].name=="hurigana2"){
        arrInput[i].value="フリガナ2";
      }else if(arrInput[i].name=="emaila2"){
        arrInput[i].value="higashi@aru.gr.jp";
      }else if(arrInput[i].name=="emailb2"){
        arrInput[i].value="higashi@aru.gr.jp";
      }else if(arrInput[i].name=="yuubina2"){
        arrInput[i].value="810";
      }else if(arrInput[i].name=="yuubinb2"){
        arrInput[i].value="0002";
      }else if(arrInput[i].name=="heya2"){
        arrInput[i].value="さんはいつー101";
      }else if(arrInput[i].name=="kaisya2"){
        arrInput[i].value="会社2";
      }else if(arrInput[i].name=="bumon2"){
        arrInput[i].value="部門2";
      }else if(arrInput[i].name=="tela2"){
        arrInput[i].value="111";
      }else if(arrInput[i].name=="telb2"){
        arrInput[i].value="1111";
      }else if(arrInput[i].name=="telc2"){
        arrInput[i].value="1111";
      }

      arrInput[i].focus();
    }
  }

  arrInput[0].focus();
}

/**************************************
*
*情報入力2 order2.tpl
***************************************/
/*body load時バリデート 戻ってきた場合は除外*/
function chkAllInput(){//alert("chkAllInput!")
  //inputに値が入っていたら「戻ってきた場合」として判定して、除外する
  var arrInput=d.getElementsByTagName("input");//alert(arrInput.length);
  var flg_back=false;//戻ってきたかどうか
  for(var i=0;i<arrInput.length;i++){//alert(arrInput[i].value)
    if(arrInput[i].type=="text" && arrInput[i].value!=""){
      chkVal(arrInput[i]);
      //flg_back=true;
      //break;
    }
  }
  //
//  if(flg_back==false){
//
//  }
}

/*バリデート例外処理：cityだけチェック表示が出ないので自前*/
function chkVal(ths){//alert(ths.value);

//////優先順位↑高い↑//////////

    //例外（見積もり画面の時だけ）//チェックして抜ける
    if(ths.className.indexOf("nairesuu")!=-1){
      if(isNaN(ths.value)){//数値じゃない時
        getElm("err_"+"suuryou").innerHTML="半角数字で入力して下さい";
        getElm("err_"+"suuryou").style.display="inline";
        return;
      }
    }

    if(ths.name.indexOf("yuubin")!=-1 && ths.name.indexOf("tel")!=-1){
      if(ths.value==""){
        getElm("err_"+ths.name).innerHTML="必須項目です";
        getElm("err_"+ths.name).style.display="inline";
        return;
      }
    }

    if(ths.name=="request"){//alert(ths.value.length);
      if(ths.value.length>300){
        getElm("err_"+ths.name).innerHTML="300文字以内でご記入下さい";
        getElm("err_"+ths.name).style.display="inline";
      }else if(ths.value.length<=300){
        getElm("err_"+ths.name).style.display="none";
      }
      return;
    }

    //
    if(ths.name=="ccode" || ths.name=="eigyousyo"){//alert("koko")
      if(getElm("ccode").value=="" || getElm("eigyousyo").value==""){//alert("xxx")
        getElm("err_"+"eigyousyo").innerHTML="必須項目です";
        getElm("err_"+"eigyousyo").style.display="inline";
        
      }else{
        getElm("err_"+ths.name).style.display="none";
      }
      return;
    }

    //emailがあった場合
    if(ths.className.indexOf("email")!=-1){
      //1
      if(ths.className.indexOf("equalTo")!=-1){//alert("equalTo")//2つ目のemail//ok
        //上の
        if(ths.id=="emailb"){
          if(ths.value!=getElm("emaila").value){//直前の入力アドレスと照合する
            getElm("err_"+ths.name).innerHTML="Eメールアドレスが間違っています";
            getElm("err_"+ths.name).style.display="inline";
            return;
          }else{
            getElm("err_"+ths.name).style.display="none";
          }
          //下の
        }else if(ths.id=="emailb2"){
          if(ths.value!=getElm("emaila2").value){//直前の入力アドレスと照合する
            getElm("err_"+ths.name).innerHTML="Eメールアドレスが間違っています";
            getElm("err_"+ths.name).style.display="inline";
            return;
          }else{
            getElm("err_"+ths.name).style.display="none";
          }
        }
      }
      //2.通常のemail
      var regStr=/[!#-9A-~]+@+[a-z0-9]+.+[^.]$/i;
      if(!ths.value.match(regStr)){//alert(ths.value.match(regStr))
        //alert("emailじゃない");
        //getElm("err_"+ths.name).innerHTML="正しいアドレスを入力して下さい";//はみ出すxxx
        getElm("err_"+ths.name).innerHTML="アドレスが不正です";
        getElm("err_"+ths.name).style.display="inline";
      }else{
        getElm("err_"+ths.name).style.display="none";
      }

  //郵便番号//自動入力があるので県/市/とかを同時にチェックしておく
    }else if(ths.className.indexOf("zip")!=-1){
      if(isNaN(ths.value)){//数値じゃない時
        //上の
        if(ths.name=="yuubina" || ths.name=="yuubinb"){
          getElm("err_"+"yuubin").innerHTML="半角数字で入力して下さい";
          getElm("err_"+"yuubin").style.display="inline";
          return;
        //下の場合
        }else if(ths.name=="yuubina2" || ths.name=="yuubinb2"){
          getElm("err_"+"yuubin2").innerHTML="半角数字で入力して下さい";
          getElm("err_"+"yuubin2").style.display="inline";
          return;
        }
        
      }else{
        //上の
        if(ths.name=="yuubina" || ths.name=="yuubinb"){
          if(getElm("yuubina").value=="" && getElm("yuubinb").value==""){
            getElm("err_"+"yuubin").innerHTML="必須項目です";
            getElm("err_"+"yuubin").style.display="inline";          
          }else if(getElm("yuubina").value.length!=3 || getElm("yuubinb").value.length!=4){//alert("yuubina : "+getElm("yuubina").value.length+"\nyuubinb : "+getElm("yuubinb").value.length)
            getElm("err_"+"yuubin").innerHTML="3桁と4桁で入力して下さい";
            getElm("err_"+"yuubin").style.display="inline";

          }else{
            getElm("err_"+"yuubin").style.display="none";
          }
        //下の場合
        }else if(ths.name=="yuubina2" || ths.name=="yuubinb2"){
          if(getElm("yuubina2").value=="" && getElm("yuubinb2").value==""){
            getElm("err_"+"yuubin2").innerHTML="必須項目です";
            getElm("err_"+"yuubin2").style.display="inline";          
          }else if(getElm("yuubina2").value.length!=3 || getElm("yuubinb2").value.length!=4){//alert("yuubina2 : "+getElm("yuubina2").value.length+"\nyuubinb2 : "+getElm("yuubinb2").value.length)
            getElm("err_"+"yuubin2").innerHTML="3桁と4桁で入力して下さい";
            getElm("err_"+"yuubin2").style.display="inline";

          }else{
            getElm("err_"+"yuubin2").style.display="none";
          }
        }
      }

    //電話番号
    }else if(ths.className.indexOf("tel")!=-1){
      if(isNaN(ths.value)){//数値じゃない時
        //上の
        if(ths.name=="tela" || ths.name=="telb" || ths.name=="telc"){
          getElm("err_"+"tel").innerHTML="半角数字で入力して下さい";
          getElm("err_"+"tel").style.display="inline";
        //下の
        }else if(ths.name=="tela2" || ths.name=="telb2" || ths.name=="telc2"){
          getElm("err_"+"tel2").innerHTML="半角数字で入力して下さい";
          getElm("err_"+"tel2").style.display="inline";
        }
      }else{//桁数チェックは排除
//        //上の
//          if(getElm("yuubina").value.length<=5 || getElm("yuubinb").value.length!=4){alert("yuubina : "+getElm("yuubina").value.length+"\nyuubinb : "+getElm("yuubinb").value.length)
//            getElm("err_"+"yuubin").innerHTML="3桁と4桁で入力して下さい";
//            getElm("err_"+"yuubin").style.display="inline";
//          }else{if(ths.name=="yuubina" || ths.name=="yuubinb"){
//            getElm("err_"+"yuubin").style.display="none";
//          }

        //上の
        if(ths.name=="tela" || ths.name=="telb" || ths.name=="telc"){
          if(getElm("tela").value=="" || getElm("telb").value=="" || getElm("telc").value==""){
            getElm("err_"+"tel").innerHTML="必須項目です";
            getElm("err_"+"tel").style.display="inline";
          }else{
            //チェックOKならメッセージOFF
            getElm("err_"+"tel").style.display="none";
          }

        //下の
        }else if(ths.name=="tela2" || ths.name=="telb2" || ths.name=="telc2"){
          if(getElm("tela2").value=="" || getElm("telb2").value=="" || getElm("telc2").value==""){
            getElm("err_"+"tel2").innerHTML="必須項目です";
            getElm("err_"+"tel2").style.display="inline";
          }else{
            //チェックOKならメッセージOFF
            getElm("err_"+"tel2").style.display="none";
          }
        }

      }
      
    //デフォルトチェック
    }else if(ths.className.indexOf("required")!=-1){//required
      //alert(getElm(ths.name));
      if(ths.value==""){
        getElm("err_"+ths.name).innerHTML="必須項目です";
        getElm("err_"+ths.name).style.display="inline";

      }else{
        getElm("err_"+ths.name).style.display="none";
      }
    }
  //////優先順位↓低い↓//////////
}
//yuubinb用のチェック//入力されたら下も同時に確認する//onchangeで別発動
function chkVal2(ths){
  //処理を追加
  //上の
  if(ths.name=="yuubinb" && ths.value.length==4){
    //alert("ths.value.length==4");//ok
    setTimeout("chkCity('ue')", 1000);
  //下の
  }else if(ths.name=="yuubinb2" && ths.value.length==4){
    //alert("ths.value.length==4");//ok
    setTimeout("chkCity('sita')", 1000);
  }
  


}
  //chkVal2からcallされる遅延用関数：setTimeoutに登録して使う
  function chkCity(whichName){
    //上のyuubinb
    if(whichName=="ue"){//alert("pref : "+getElm("pref").value);
      if(getElm("pref").value!=""){
        getElm("err_"+"pref").style.display="none";
      }
      if(getElm("city").value!=""){
        getElm("err_"+"city").style.display="none";
      }
      if(getElm("area").value!=""){
        getElm("err_"+"area").style.display="none";
      }
    //下のyuubinb2
    }else if(whichName=="sita"){
      if(getElm("pref2").value!=""){
        getElm("err_"+"pref2").style.display="none";
      }
      if(getElm("city2").value!=""){
        getElm("err_"+"city2").style.display="none";
      }
      if(getElm("area2").value!=""){
        getElm("err_"+"area2").style.display="none";
      }
    }
  }//end 内部function

function dispHaisousaki(ths){
  if(ths.checked==true){
    if(ths.value=="haisoukbn1"){
      //getElm("yamato").style.display="none";
      getElm("haisousaki").style.display="none";
    }else if(ths.value=="haisoukbn2"){
      //getElm("yamato").style.display="none";
      getElm("haisousaki").style.display="block";
    }else/* if(ths.value=="haisoukbn3")*/{
      //getElm("yamato").style.display="block";
      //getElm("haisousaki").style.display="none";
    }
  }
}

//20080826追加
function dispYamato(ths){
  if(ths.checked==true){
    if(ths.value=="yamatokbn1"){
      getElm("yamato").style.display="block";
      getElm("yamato2").style.display="block";
    }else if(ths.value=="yamatokbn2"){
      getElm("yamato").style.display="none";
      getElm("yamato2").style.display="none";
    }
  }
}

//ページのバリデートJS
function formVaridate(formName){
  var arrLabel;
  arrLabel=d.getElementsByTagName("label");//alert(arrLabel.length)
  
  if(formName=="Fm_mitumori"){
    for(var i=0;i<arrLabel.length;i++){
      if(arrLabel[i].style.display!="none"){
        return "validNG";
      }
    }
    return "validOK";
  }else{//デフォルト
  
    for(var i=0;i<arrLabel.length;i++){//alert(arrLabel[i].style.display)
      if(getElm("haisoukbn1")&& getElm("haisoukbn1").checked==true){//alert("haisoukbn1");//haisoukbn1
        //namae2以降はチェックしない
        if(arrLabel[i].id.indexOf("2")==-1){//alert(arrLabel[i].id)
          if(arrLabel[i].id!="err_eigyousyo"){//さらにヤマト情報除外
            if(arrLabel[i].style.display!="none"){//alert("validNG")
              return "validNG";
            }
          }
        }
      }else if(getElm("haisoukbn2")&&getElm("haisoukbn2").checked==true){//alert("haisoukbn2");//haisoukbn2
        if(arrLabel[i].id!="err_eigyousyo"){//ヤマト情報除外
          if(arrLabel[i].style.display!="none"){//alert(arrLabel[i].id);alert("validNG")
            //return "validNG";
            return arrLabel[i].id;
          }
        }
      }else if(getElm("haisoukbn3")&&getElm("haisoukbn3").checked==true){//alert("haisoukbn3");//haisoukbn3
        if(arrLabel[i].id.indexOf("2")==-1){//alert(arrLabel[i].id)
          if(arrLabel[i].style.display!="none"){//alert("validNG")
            return "validNG";
          }
        }
      }
    }
    return "validOK";
  }
}
function onloadtest(){
  //alert("onloaded!");
}
/*
 *body init
 */
//order2 初期設定：divを非表示
function initDivHidden(){
  getElm("yamato").style.display="none";
  getElm("yamato2").style.display="none";
  getElm("haisousaki").style.display="none";
}

//order2専用ハンドラ
function JQinitOrder(orderName){ //alert(orderName)
  //jqカートの中身
  $(document).ready(function(){

    $(".toggle_container").hide();
    $("a.trigger").css("cursor", "pointer");

    $("a.trigger").toggle(function(){
      $(this).addClass("active");
      }, function () {
      $(this).removeClass("active");
    });

    $("a.trigger").click(function(){
      $(this).next(".toggle_container").slideToggle("slow,");

    });

  });

  if(orderName=="order2"){
    //jq送料について
    $(document).ready(function(){

      $(".toggle_container_souryou").hide();
      $("a.trigger_souryou").css("cursor", "pointer");

      $("a.trigger_souryou").toggle(function(){
        $(this).addClass("active");
        }, function () {
        $(this).removeClass("active");
      });

      $("a.trigger_souryou").click(function(){
        $(this).next(".toggle_container_souryou").slideToggle("slow,");

      });

    });
  }
//	$(".toggle_container_souryou").hide();
//  $("a.trigger_souryou").css("cursor", "pointer");
//function tgglThis(ths){alert(ths.className)
//  $("."+ths.className).toggle("slow");
//}

//ここはテスト中マスク部
  $(document).ready(function() {

    //select all the a tag with name equal to modal
    $('a[name=modal]').click(function(e) {
      //Cancel the link behavior
      e.preventDefault();
      //Get the A tag
      var id = $(this).attr('href');

      //Get the screen height and width
      var maskHeight = $(document).height();
      var maskWidth = $(window).width();

      //Set height and width to mask to fill up the whole screen
      $('#mask').css({'width':maskWidth,'height':maskHeight});

      //transition effect
      $('#mask').fadeIn(1000);
      $('#mask').fadeTo("slow",0.8);

      //Get the window height and width
      var winH = $(window).height();
      var winW = $(window).width();

      //Set the popup window to center
      $(id).css('top',  winH/2-$(id).height()/2);
      $(id).css('left', winW/2-$(id).width()/2);

      //transition effect
      $(id).fadeIn(2000);

    });

    //if close button is clicked
    $('.window .close').click(function (e) {
      //Cancel the link behavior
      e.preventDefault();
      $('#mask, .window').hide();
    });

    //if mask is clicked
    $('#mask').click(function () {
      $(this).hide();
      $('.window').hide();
    });

  });

}
/**************************************
*javascript.js
*カートでの処理
*【要コード最適化：現状そのまま】
***************************************/
window.name = "mainWindow";
function MenuOn(x){
	obj=document.getElementById("submenu"+x).style.visibility="visible";
}

function MenuOff(x){
	obj=document.getElementById("submenu"+x).style.visibility="hidden";
}
//
function aboutcpWinOpen(){
	subWin = window.open("nmsbcp.html","nmsbcpWin","width=770,height=480,scrollbars=yes,resizable=yes");
}
function hourituWinOpen(){
	subWin = window.open("nmsbst.html","nmsbstWin","width=770,height=480,scrollbars=yes,resizable=yes");
}
function nagareWinOpen(){
	subWin = window.open("nmsbta.html","nmsbtaWin","width=770,height=480,scrollbars=yes,resizable=yes");
}
function nagareWinOpen2(){
	subWin = window.open("nmsbta.html#abpay","nmsbtaWin","width=770,height=480,scrollbars=yes,resizable=yes");
}
function privacyWinOpen(){
	subWin = window.open("nmsbpv.html","nmsbpvWin","width=770,height=480,scrollbars=yes,resizable=yes");
}
function rlspWinOpen(){
	subWin = window.open("realshop.html","realspWin","width=320,height=200,scrollbars=yes,resizable=yes");
}
function opmessWinOpen(){
	subWin = window.open("opmess.html","realspWin","width=550,height=440,scrollbars=yes,resizable=yes");
}
function nmfmsb1WinOpen(){
	subWin = window.open("nmfmsb1.html","mdwallWin","width=420,height=502,scrollbars=yes,resizable=yes");
}
function nmfmsb2WinOpen(){
	subWin = window.open("nmfmsb2.html","mdwallWin","width=420,height=502,scrollbars=yes,resizable=yes");
}
function nmfmsb3WinOpen(){
	subWin = window.open("nmfmsb3.html","mdwallWin","width=300,height=300,scrollbars=yes,resizable=yes");
}
function closeWin(){
	window.close();
}
function init_od1(){
	document.myForm.in_tmken.readOnly = true;
	document.myForm.in_tmcity.readOnly = true;
	document.myForm.in_hsken.readOnly = true;
	document.myForm.in_hscity.readOnly = true;
}
function dlt_op1CartIn(){
	with(document.dlt_op1Form){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dlt_op2CartIn(){
	with(document.dlt_op2Form){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dlt_op3CartIn(){
	with(document.dlt_op3Form){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dlt_op4CartIn(){
	with(document.dlt_op4Form){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dlt_op5CartIn(){
	with(document.dlt_op5Form){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dlt_op6CartIn(){
	with(document.dlt_op6Form){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}

function dlt_abCartIn(){
	with(document.dlt_abForm){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dlt_awCartIn(){
	with(document.dlt_awForm){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dlt_blCartIn(){
	with(document.dlt_blForm){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dlt_whCartIn(){
	with(document.dlt_whForm){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dlt_chCartIn(){
	with(document.dlt_chForm){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dlt_orCartIn(){
	with(document.dlt_orForm){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dlt_leCartIn(){
	with(document.dlt_leForm){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dlt_skCartIn(){
	with(document.dlt_skForm){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dlt_adCartIn(){
	with(document.dlt_adForm){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function wall_whCartIn(){
	with(document.wall_whForm){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dyk_blCartIn(){
	with(document.dyk_blForm){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dyk_whCartIn(){
	with(document.dyk_whForm){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dtt_blCartIn(){
	with(document.dtt_blForm){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dtt_whCartIn(){
	with(document.dtt_whForm){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function dyk_bl_exCartIn(){
	with(document.dyk_bl_exForm){
		action="https://www.dateblock.com/dbshop/index.php";
		method="POST";
		submit();
	}
}
function cartDel(no){
	with(document.myForm){
		del_id.value=no;
		action="";
		method="POST";
		submit();
	}
}
function post1_order(){
	with(document.myForm){
		od1_type.value="post1";
		action="index.php";
		method="POST";
		submit();
	}
}
function post2_order(){
	with(document.myForm){
		od1_type.value="post2";
		action="index.php#page_md";
		method="POST";
		submit();
	}
}
//
function tafm_next(){
	with(document.myForm){
		tfm_type.value="tafm_next";
		action="tmail.php";
		method="POST";
		submit();
	}
}
//
function order1_back(){
	with(document.myForm){
		od1_type.value="od1_back";
		action="index.php";
		method="POST";
		submit();
	}
}
function order1_next(){
	with(document.myForm){
		od1_type.value="od1_next";
		action="index.php";
		method="POST";
		submit();
	}
}
function nmcodr1_next(){
	with(document.myForm){
		nmcodr.value="nm1_next";
		action="index.php";
		method="POST";
		submit();
	}
}
function nmcodr2_back(){
	with(document.myForm){
		nmcodr.value="nm2_back";
		action="index.php";
		method="POST";
		submit();
	}
}
function nmcodr2_next(){
	with(document.myForm){
		nmcodr.value="nm2_next";
		action="index.php";
		method="POST";
		submit();
	}
}
function order2_back(){
	with(document.myForm){
		od2_type.value="od2_back";
		action="index.php";
		method="POST";
		submit();
	}
}
function order2_next(){
	with(document.myForm){
		od2_type.value="od2_next";
		action="index.php";
		method="POST";
		submit();
	}
}
function order3_back(){
	with(document.myForm){
		od3_type.value="od3_back";
		action="index.php";
		method="POST";
		submit();
	}
}
function order3_next(){
	with(document.myForm){
		od3_type.value="od3_next";
		action="index.php";
		method="POST";
		submit();
	}
}
function dsp_menu01(){
	with(document.myForm){
		action="control.php?_mode=menu01";
		method="POST";
		submit();
	}
}
function dsp_menu02(){
	with(document.myForm){
		action="control.php?_mode=menu02";
		method="POST";
		submit();
	}
}
function dsp_menu03(){
	with(document.myForm){
		action="control.php?_mode=menu03";
		method="POST";
		submit();
	}
}
function dsp_menu04(){
	with(document.myForm){
		action="control.php?_mode=menu04";
		method="POST";
		submit();
	}
}
function listChange(){
	with(document.mForm){
		action="control.php";
		method="POST";
		submit();
	}
}
function dspChange(){
	with(document.mForm){
		action="control.php";
		method="POST";
	}
}
function shms_edit(no){
	with(document.mForm){
		shid.value=no;
		action="control.php?_mode=shms_edit";
		method="POST";
		submit();
	}
}
function shms_insert(){
	with(document.mForm){
		action="control.php?_mode=shms_insert";
		method="POST";
		target="mainWindow";
		submit();
	}
}
function kgms_update(no){
	with(document.mForm){
		kgid.value=no;
		action="control.php?_mode=kgms_edit";
		method="POST";
		submit();
	}
}
function kgms_insert(){
	with(document.mForm){
		action="control.php?_mode=kgms_insert";
		method="POST";
		submit();
	}
}
function shdelWinOpen(){
	subWin02 = window.open("","delWin","width=380,height=292");
	with(document.mForm){
		action="delsyohin.php";
		method="POST";
		target="delWin";
		submit();
	}
}
function kgdelWinOpen(){
	subWin02 = window.open("","delWin","width=380,height=292");
	with(document.mForm){
		action="delkyugyo.php";
		method="POST";
		target="delWin";
		submit();
	}
}
function tmdelWinOpen(){
	subWin02 = window.open("","delWin","width=380,height=292");
	with(document.mForm){
		action="deltyumon.php";
		method="POST";
		target="delWin";
		submit();
	}
}
function changeDisplay(t01, t02, t03){

		elem01 = document.getElementById(t01);
		elem02 = document.getElementById(t02);
		elem03 = document.getElementById(t03);

		if (elem01.style.display == 'none'){
			elem01.style.display = 'block';
			elem02.style.display = 'none';

		}
		else{
			elem01.style.display = 'none';
			elem02.style.display = 'block';
			elem03.focus();
		}
}

// アスキーコードでキーチェック
function Func_CheckAsciiCode(type){
    var code;

    code = event.keyCode;

    switch (type){
    // 数字
    case 1:
        if(CheckACNumeric(code)) return true;
        if(CheckACMovement(code)) return true;
        if(CheckACDelete(code)) return true;
        return false;
        break;

    // 英字
    case 2:
        if(CheckACAlpha(code)) return true;
        if(CheckACMovement(code)) return true;
        if(CheckACDelete(code)) return true;
        return false;
        break;

    // 数字+ハイフン
    case 3:
        if(CheckACNumeric(code)) return true;
        if(CheckACHyphen(code)) return true;
        if(CheckACMovement(code)) return true;
        if(CheckACDelete(code)) return true;
        return false;
        break;
    }

}
//
// アスキーコードで0〜9,テンキー0〜9キーチェック
function CheckACNumeric(code){

    switch (code){
    // テンキー0〜9
    case 96:
    case 97:
    case 98:
    case 99:
    case 100:
    case 101:
    case 102:
    case 103:
    case 104:
    case 105:
    // 0〜9キー
    case 48:
    case 49:
    case 50:
    case 51:
    case 52:
    case 53:
    case 54:
    case 55:
    case 56:
    case 57:
        return true;
        break;

    default:
        return false;
        break;
    }

}

// アスキーコードでa〜zキーチェック
function CheckACAlpha(code){

    switch (code){
    // a〜zキー
    case 65:
    case 66:
    case 67:
    case 68:
    case 69:
    case 70:
    case 71:
    case 72:
    case 73:
    case 74:
    case 75:
    case 76:
    case 77:
    case 78:
    case 79:
    case 80:
    case 81:
    case 82:
    case 83:
    case 84:
    case 85:
    case 86:
    case 87:
    case 88:
    case 89:
    case 90:
        return true;
        break;

    default:
        return false;
        break;
    }

}

// アスキーコードでTab,←→↑↓,Home,Endキーチェック
function CheckACMovement(code){

    switch (code){
    // Tabキー
    case 9:
    // ←→↑↓キー
    case 37:
    case 38:
    case 39:
    case 40:
    // Homeキー
    case 36:
    // Endキー
    case 35:
        return true;
        break;

    default:
        return false;
        break;
    }

}

// アスキーコードでハイフンキーチェック
function CheckACHyphen(code){

    switch (code){
    // -キー
    case 109:
    case 189:
        return true;
        break;

    default:
        return false;
        break;
    }

}

// アスキーコードでDel,BSキーチェック
function CheckACDelete(code){

    switch (code){
    // BackSpaceキー
    case 8:
    // Deleteキー
    case 46:
        return true;
        break;

    default:
        return false;
        break;
    }

}

