
//二度押し防止フラグ
var submitFlg = 'false';

/*
 * 二度押し防止チェック関数。
 */
function checkSubmitFlg() {
	if(submitFlg == 'true') {
		alert('すでに送信されています。送信処理が完了するまでしばらくお待ちください。');
		return false;
	}
	return true;
}

/*
 * 二度押し防止チェック関数を呼び出したのち、
 * パスを指定してサブミットします。
 */
function doSubmitForm2(obj){
	if(checkSubmitFlg() == true) {
		//サブミットフラグをON
		submitFlg = 'true';

		obj.submit();
		return true;
	}
	return false;
}

function doSubmitForm(obj){
	obj.submit();
}

var select_array ;
function doSubmit(product_id,action){
		var value = document.getElementById("select"+product_id).value;
		//<INPUT type=hidden name=pay_radio><INPUT type=hidden name=pay_type><INPUT type=hidden name=select_1><INPUT type=hidden name=select_2>
		var r_value = document.getElementsByName("check_every"+product_id);
		for (i=0 ; i<r_value.length ; i++){
		if(r_value[i].checked) {
		 document.shopcartform.pay_radio.value=r_value[i].value;
		 if (r_value[i].value=='1'){
		 document.shopcartform.select_1.value=document.getElementById("select_1"+product_id).value;
		 }else if (r_value[i].value=='2'){
		 document.shopcartform.select_1.value=document.getElementById("select_2"+product_id).value;
		 document.shopcartform.select_2.value=document.getElementById("select_3"+product_id).value;

		 }else if (r_value[i].value=='4'){
		 document.shopcartform.select_1.value=document.getElementById("select_4"+product_id).value;
		 }
		 }
		}
        document.shopcartform.p_id.value=product_id;
        if (action.length>0)
        document.shopcartform.p_action.value=action;
        document.shopcartform.p_num.value=value;
		document.shopcartform.submit();
}
function doSubmit2(product_id,action){
		var value = document.getElementById("select2_"+product_id).value;
		//<INPUT type=hidden name=pay_radio><INPUT type=hidden name=pay_type><INPUT type=hidden name=select_1><INPUT type=hidden name=select_2>
		var r_value = document.getElementsByName("check_every"+product_id);
		for (i=0 ; i<r_value.length ; i++){
		if(r_value[i].checked) {
		 document.shopcartform.pay_radio.value=r_value[i].value;
		 if (r_value[i].value=='1'){
		 document.shopcartform.select_1.value=document.getElementById("select_1"+product_id).value;
		 }else if (r_value[i].value=='2'){
		 document.shopcartform.select_1.value=document.getElementById("select_2"+product_id).value;
		 document.shopcartform.select_2.value=document.getElementById("select_3"+product_id).value;

		 }else if (r_value[i].value=='4'){
		 document.shopcartform.select_1.value=document.getElementById("select_4"+product_id).value;
		 }
		 }
		}
        document.shopcartform.p_id.value=product_id;
        if (action.length>0)
        document.shopcartform.p_action.value=action;
        document.shopcartform.p_num.value=value;
		document.shopcartform.submit();
}

function doSubmit3(product_id,action){
		var value = document.getElementById("select"+product_id).value;
		document.shopcartform.pay_radio.value=document.getElementsByName("check_every"+product_id)[0].value;
		document.shopcartform.select_1.value=document.getElementById("select_4"+product_id).value;
        document.shopcartform.p_id.value=product_id;
        if (action.length>0)
        document.shopcartform.p_action.value=action;
        document.shopcartform.p_num.value=value;
		document.shopcartform.submit();
}

/*
*ご注文履歴で各ボタンを押下した場合の処理
*/
function doSubmit4(param_chuno, formname){
		var chuno			= document.getElementById("chuno"+param_chuno).value;
        eval("document."+formname).chuno.value			= chuno;

		if(formname != "form0"){
			var id				= document.getElementById("id"+param_chuno).value;
			var eno				= document.getElementById("eno"+param_chuno).value;
			var emno			= document.getElementById("emno"+param_chuno).value;
			var sflg			= document.getElementById("sflg"+param_chuno).value;
			var snm				= document.getElementById("snm"+param_chuno).value;
			var suryo			= document.getElementById("suryo"+param_chuno).value;
			var productno		= document.getElementById("productno"+param_chuno).value;
			var hsocyclkbn		= document.getElementById("hsocyclkbn"+param_chuno).value;
			var hsocyclday		= document.getElementById("hsocyclday"+param_chuno).value;
			var hsocyclnmweek	= document.getElementById("hsocyclnmweek"+param_chuno).value;
			var hsocycldayweek	= document.getElementById("hsocycldayweek"+param_chuno).value;
			var tdelivkisu		= document.getElementById("tdelivkisu"+param_chuno).value;
			var toyakokbn		= document.getElementById("toyakokbn"+param_chuno).value;
			var siskid			= document.getElementById("siskid"+param_chuno).value;
			var shcls2			= document.getElementById("shcls2"+param_chuno).value;
			var shcls3			= document.getElementById("shcls3"+param_chuno).value;
			var hkkocd			= document.getElementById("hkkocd"+param_chuno).value;
			var skbn			= document.getElementById("skbn"+param_chuno).value;
			var skt				= document.getElementById("skt"+param_chuno).value;
			var sts				= document.getElementById("sts"+param_chuno).value;
			var stsuymd			= document.getElementById("stsuymd"+param_chuno).value;
			var fstscd			= document.getElementById("fstscd"+param_chuno).value;
			var jtrkuymd		= document.getElementById("jtrkuymd"+param_chuno).value;
			var jtrkuhms		= document.getElementById("jtrkuhms"+param_chuno).value;
			var hsoymd			= document.getElementById("hsoymd"+param_chuno).value;
			var shoriflg		= document.getElementById("shoriflg"+param_chuno).value;
			var sel_address		= document.getElementById("gftkbn"+param_chuno).value;
			var nextdlvymd		= document.getElementById("nextdlvymd"+param_chuno).value;
			var nextskymd		= document.getElementById("nextskymd"+param_chuno).value;
			var shbrand			= document.getElementById("shbrand"+param_chuno).value;
			var nextdlvcontent	= document.getElementById("nextdlvcontent"+param_chuno).value;
			var tkcyclkbn		= document.getElementById("tkcyclkbn"+param_chuno).value;
	        eval("document."+formname).p_id.value			= id;
	        eval("document."+formname).eno.value			= eno;
	        eval("document."+formname).emno.value			= emno;
			eval("document."+formname).sflg.value			= sflg;
			eval("document."+formname).snm.value			= snm;
			eval("document."+formname).suryo.value			= suryo;
			eval("document."+formname).productno.value		= productno;
			eval("document."+formname).hsocyclkbn.value		= hsocyclkbn;
			eval("document."+formname).hsocyclday.value		= hsocyclday;
			eval("document."+formname).hsocyclnmweek.value	= hsocyclnmweek;
			eval("document."+formname).hsocycldayweek.value	= hsocycldayweek;
			eval("document."+formname).tdelivkisu.value		= tdelivkisu;
			eval("document."+formname).toyakokbn.value		= toyakokbn;
			eval("document."+formname).siskid.value			= siskid;
			eval("document."+formname).shcls2.value			= shcls2;
			eval("document."+formname).shcls3.value			= shcls3;
			eval("document."+formname).hkkocd.value			= hkkocd;
			eval("document."+formname).skbn.value			= skbn;
			eval("document."+formname).skt.value			= skt;
			eval("document."+formname).sts.value			= sts;
			eval("document."+formname).stsuymd.value		= stsuymd;
			eval("document."+formname).fstscd.value			= fstscd;
			eval("document."+formname).jtrkuymd.value		= jtrkuymd;
			eval("document."+formname).jtrkuhms.value		= jtrkuhms;
			eval("document."+formname).hsoymd.value			= hsoymd;
			eval("document."+formname).shoriflg.value		= shoriflg;
			eval("document."+formname).sel_address.value	= sel_address;
			eval("document."+formname).nextdlvymd.value		= nextdlvymd;
			eval("document."+formname).nextskymd.value		= nextskymd;
			eval("document."+formname).shbrand.value		= shbrand;
			eval("document."+formname).nextdlvcontent.value	= nextdlvcontent;
			eval("document."+formname).tkcyclkbn.value		= tkcyclkbn;
		}
		eval("document."+formname).submit();
}
function addup(){
  document.shopcartform.p_action.value='addup';
  document.shopcartform.submit();
}

function flex(targetid){
    target = document.getElementById(targetid);
    if (hidden_flag == true) {
        target.style.display = "none";
    }
    else if(hidden_flag == false) {
    	set_Value();
        target.style.display = "block";
    }
}

function openNew(targetid){
	hidden_flag = false;
	flex(targetid);
/*
	if(document.getElementById('sel_info_0').checked == true){
		set_Value('0');
	}else{
		set_Value();
	}
*/

}

//二回目配送日指定入力の制御
function change_aft_delivery_cyc(flg) {

	target_button = document.getElementById('aft_delivery_cyc_button');
	target = document.getElementById('aft_delivery_cyc');

	if (flg == '1') {
		target.style.display = 'none';
		target_button.style.display = 'block';
		//document.getElementById('hsocyclkbn_0').checked = true;
		document.getElementById('hsocyclkbn_0').click();
		document.orderForm.hsocyclday.value = "";
		document.orderForm.hsocyclnmweek.value = "";
		document.orderForm.hsocycldayweek.value = "";
	} else {
		target.style.display = 'block';
		target_button.style.display = 'none';
	}
}

function onLoadShoppingOrder() {

	var radCounter=0;
	var radioLength = document.getElementsByName("sel_address").length;
	for (radCounter=0; radCounter < radioLength; radCounter++){
		if (document.getElementsByName("sel_address")[radCounter].checked == true){
			document.getElementsByName("sel_address")[radCounter].click();
		}
	}

	return;
}

function closeNew(targetid){
	hidden_flag = true;
	flex(targetid);
}

function inputPay_AllClose() {
	closeNew('other_user');
	closeNew('this_user');
	closeNew('seikyu');
	closeNew('delivery_day_time');
	closeNew('pay_method');
}

function selectToroku() {
	inputPay_AllClose();
	openNew('this_user');
	openNew('pay_method');
	openNew('delivery_day_time');
	set_Daibiki(0);
	radioValue('sel_address_enclosing',false);
}

function selectBeso() {
	inputPay_AllClose();
	openNew('other_user');
	openNew('seikyu');
	openNew('delivery_day_time');
	openNew('pay_method');
	radioValue('sel_address_enclosing',false);
}

function radioValue(radio,flg){
	var radCounter=0;
	//var rad_val='';
	var radioLength = document.getElementsByName(radio).length;
	//alert(radioLength);
	for (radCounter=0; radCounter < radioLength; radCounter++){
		if (flg == true){
			document.getElementsByName(radio)[radCounter].disabled = false;
		} else {
			document.getElementsByName(radio)[radCounter].checked = false;
			document.getElementsByName(radio)[radCounter].disabled = true;
		}
	}
	return;
}

function selectGift(str){
	if(str == "1") set_Daibiki(1);
	if(str == "9") set_Daibiki(2);
}

function selectTeikiDokon() {
	inputPay_AllClose();
	radioValue('sel_address_enclosing',true);
}

function set_Value(type){
	if(type == '0'){
		document.getElementById('other_kanjiname_sei').value = other_kanjiname_sei_default;
	 	document.getElementById('other_kanjiname_mei').value = other_kanjiname_mei_default;
	 	document.getElementById('other_kananame_sei').value = other_kananame_sei_default;
	 	document.getElementById('other_kananame_mei').value = other_kananame_mei_default;
	 	document.getElementById('other_postal_3digit').value = other_postal_3digit_default;
	 	document.getElementById('other_postal_4digit').value = other_postal_4digit_default;
	 	document.getElementById('other_address_town').value = other_address_town_default;
	 	document.getElementById('other_address_code').value = other_address_code_default;
	 	document.getElementById('other_address_build').value = other_address_build_default;
	 	document.getElementById('other_tel_home').value = other_tel_home_default;

	 	aryCity = [null,'北海道','青森県','岩手県','宮城県','秋田県','山形県','福島県','茨城県','栃木県','群馬県','埼玉県','千葉県','東京都','神奈川県','新潟県','富山県','石川県','福井県','山梨県','長野県','岐阜県','静岡県','愛知県','三重県','滋賀県','京都府','大阪府','兵庫県','奈良県','和歌山県','鳥取県','島根県','岡山県','広島県','山口県','徳島県','香川県','愛媛県','高知県','福岡県','佐賀県','長崎県','熊本県','大分県','宮崎県','鹿児島県','沖縄県'];
	 	for(var i=0;i<=aryCity.length;i++){
			if(aryCity[i] == other_address_city_default){
				document.getElementById('other_address_city').options[i].selected = true;
			}
		}
 	}else{
 		document.getElementById('other_kanjiname_sei').value = other_kanjiname_sei;
	 	document.getElementById('other_kanjiname_mei').value = other_kanjiname_mei;
	 	document.getElementById('other_kananame_sei').value = other_kananame_sei;
	 	document.getElementById('other_kananame_mei').value = other_kananame_mei;
	 	document.getElementById('other_postal_3digit').value = other_postal_3digit;
	 	document.getElementById('other_postal_4digit').value = other_postal_4digit;
	 	document.getElementById('other_address_town').value = other_address_town;
	 	document.getElementById('other_address_code').value = other_address_code;
	 	document.getElementById('other_address_build').value = other_address_build;
	 	document.getElementById('other_tel_home').value = other_tel_home;

	 	aryCity = [null,'北海道','青森県','岩手県','宮城県','秋田県','山形県','福島県','茨城県','栃木県','群馬県','埼玉県','千葉県','東京都','神奈川県','新潟県','富山県','石川県','福井県','山梨県','長野県','岐阜県','静岡県','愛知県','三重県','滋賀県','京都府','大阪府','兵庫県','奈良県','和歌山県','鳥取県','島根県','岡山県','広島県','山口県','徳島県','香川県','愛媛県','高知県','福岡県','佐賀県','長崎県','熊本県','大分県','宮崎県','鹿児島県','沖縄県'];
	 	for(var i=0;i<=aryCity.length;i++){
			if(aryCity[i] == other_address_city){
				document.getElementById('other_address_city').options[i].selected = true;
			}
		}
 	}
 }

 function clear_Value(){
 	document.getElementById('other_kanjiname_sei').value = "";
 	document.getElementById('other_kanjiname_mei').value = "";
 	document.getElementById('other_kananame_sei').value = "";
 	document.getElementById('other_kananame_mei').value = "";
 	document.getElementById('other_postal_3digit').value = "";
 	document.getElementById('other_postal_4digit').value = "";
 	document.getElementById('other_address_city').value = "";
 	document.getElementById('other_address_town').value = "";
 	document.getElementById('other_address_code').value = "";
 	document.getElementById('other_address_build').value = "";
 	document.getElementById('other_tel_home').value = "";
 }

 function getCityName(value){
 	aryCity = [null,'北海道','青森県','岩手県','宮城県','秋田県','山形県','福島県','茨城県','栃木県','群馬県','埼玉県','千葉県','東京都','神奈川県','新潟県','富山県','石川県','福井県','山梨県','長野県','岐阜県','静岡県','愛知県','三重県','滋賀県','京都府','大阪府','兵庫県','奈良県','和歌山県','鳥取県','島根県','岡山県','広島県','山口県','徳島県','香川県','愛媛県','高知県','福岡県','佐賀県','長崎県','熊本県','大分県','宮崎県','鹿児島県','沖縄県'];
 	for(var i=0;i<=aryCity.length;i++){
		if(i == value){
			return aryCity[i];
		}
	}
	return "";
 }

 function submitorder_forChangePay(url){
    document.orderForm.action = url;
    document.orderForm.p_id.value=document.getElementById('product_id').value;
    document.orderForm.p_action.value="add";
   	document.orderForm.p_num.value=document.getElementById('p_num').value;
   	var tmp = document.orderForm.p_num.value;
    if(tmp.length == 0){
    	document.orderForm.p_num.value=document.orderForm.ori_suryo.value
    }
 	document.orderForm.submit();
}

 function submitorder_forChangeDelvDay(url){
    document.orderForm.action = url;
    document.orderForm.p_id.value=document.getElementById('product_id').value;
    document.orderForm.p_action.value="add";
    document.orderForm.p_num.value=document.getElementById('p_num').value;
    document.orderForm.chg_flg1.value="0";
    document.orderForm.chg_flg2.value="0";


	/*定期サイクル*/
	//指定なし
    if(document.orderForm.rdo_pay_radio[0].checked == true){
	    document.orderForm.pay_radio.value="0";
	    document.orderForm.select_1.value="";
	    document.orderForm.select_2.value="";
	//日にち指定の場合
    }else if( document.orderForm.rdo_pay_radio[1].checked == true ){
	    document.orderForm.pay_radio.value="1";
	    document.orderForm.select_1.value=document.orderForm.hsocyclday.value;
	    document.orderForm.select_2.value="0";

	//曜日指定の場合
    }else if( document.orderForm.rdo_pay_radio[2].checked == true ){
	    document.orderForm.pay_radio.value="2";
	    document.orderForm.select_1.value=document.orderForm.hsocyclnmweek.value;
	    document.orderForm.select_2.value=document.orderForm.hsocycldayweek.value;
    }

	//お届タイミングに変更があった場合
	if(
		document.orderForm.pay_radio.value != document.orderForm.before_pay_radio.value || 
		document.orderForm.select_1.value != document.orderForm.before_select_1.value || 
		document.orderForm.select_2.value != document.orderForm.before_select_2.value
	){
    	document.orderForm.chg_flg1.value="1";
   	}
   	/*次回お届け予定日*/
   	//指定なし
    if(document.orderForm.sel_nextdlvymd[0].checked == true){
    	document.orderForm.nextdlvymd_year.value = "";
    	document.orderForm.nextdlvymd_month.value = "";
    	document.orderForm.nextdlvymd_day.value = "";

   	//プルダウンから選択
    }else if(document.orderForm.sel_nextdlvymd[1].checked == true){
    	//設定された値がそのままFORM変数
    }
    document.orderForm.nextdlvymd.value=document.orderForm.nextdlvymd_year.value + "" + document.orderForm.nextdlvymd_month.value + "" + document.orderForm.nextdlvymd_day.value;
    
	//お届予定日に変更があった場合
	if(	document.orderForm.nextdlvymd.value != document.orderForm.before_nextdlvymd.value){
    	document.orderForm.chg_flg2.value="1";
   	}
    
 	document.orderForm.submit();
}

function ondeliverytiming(mode){

	if(mode==0){
		document.orderForm.hsocyclday.disabled = true;
		document.orderForm.hsocyclnmweek.disabled = true;
		document.orderForm.hsocycldayweek.disabled = true;
	}else if(mode==1){
		document.orderForm.hsocyclday.disabled = false;
		document.orderForm.hsocyclnmweek.disabled = true;
		document.orderForm.hsocycldayweek.disabled = true;
	}else{
		document.orderForm.hsocyclday.disabled = true;
		document.orderForm.hsocyclnmweek.disabled = false;
		document.orderForm.hsocycldayweek.disabled = false;
	}
}
function ondeliveryday(mode){
	if(mode==0){
		document.orderForm.nextdlvymd_year.disabled = true;
		document.orderForm.nextdlvymd_month.disabled = true;
		document.orderForm.nextdlvymd_day.disabled = true;
	}else if(mode==1){
		document.orderForm.nextdlvymd_year.disabled = false;
		document.orderForm.nextdlvymd_month.disabled = false;
		document.orderForm.nextdlvymd_day.disabled = false;
	}
}

function submitorder(url){
/*

	document.getElementById("login_user_mail").value=document.getElementById("user_mail").innerText;
	document.getElementById("login_name_sei").value=document.getElementById("name_sei").innerText;
	document.getElementById("login_name_mei").value=document.getElementById("name_mei").innerText;
	document.getElementById("login_kananame_sei").value=document.getElementById("kananame_sei").innerText;
	document.getElementById("login_kananame_mei").value=document.getElementById("kananame_mei").innerText;
	document.getElementById("login_postal_3digit").value=document.getElementById("postal_3digit").innerText;
	document.getElementById("login_postal_4digit").value=document.getElementById("postal_4digit").innerText;
	document.getElementById("login_address_city").value=document.getElementById("address_city").innerText;
	document.getElementById("login_address_town").value=document.getElementById("address_town").innerText;
	document.getElementById("login_address_build").value=document.getElementById("address_build").innerText;
	document.getElementById("login_address_code").value=document.getElementById("address_code").innerText;
	document.getElementById("login_tel_home").value=document.getElementById("tel_home").innerText;
	//document.getElementById("login_tel_ontime").value=document.getElementById("tel_ontime").innerText;

    document.getElementById("submit_user_mail").value=document.getElementById("user_mail").innerText;
	//document.getElementById("submit_tel_ontime").value=document.getElementById("tel_ontime").innerText;

    var r_value = document.getElementsByName("sel_address");
    for (i=0 ; i<r_value.length ; i++){
    	if(r_value[i].checked){
    		if (r_value[i].value=='0'){

			 	document.getElementById("submit_user_mail").value=document.getElementById("user_mail").innerText;
				document.getElementById("submit_name_sei").value=document.getElementById("name_sei").innerText;
				document.getElementById("submit_name_mei").value=document.getElementById("name_mei").innerText;
				document.getElementById("submit_kananame_sei").value=document.getElementById("kananame_sei").innerText;
				document.getElementById("submit_kananame_mei").value=document.getElementById("kananame_mei").innerText;
				document.getElementById("submit_postal_3digit").value=document.getElementById("postal_3digit").innerText;
				document.getElementById("submit_postal_4digit").value=document.getElementById("postal_4digit").innerText;
				document.getElementById("submit_address_city").value=document.getElementById("address_city").innerText;
				document.getElementById("submit_address_town").value=document.getElementById("address_town").innerText;
				document.getElementById("submit_address_build").value=document.getElementById("address_build").innerText;
				document.getElementById("submit_address_code").value=document.getElementById("address_code").innerText;
				document.getElementById("submit_tel_home").value=document.getElementById("tel_home").innerText;
				//gift_kbn ADD 2009/1/29
				document.getElementById("submit_gift_kbn").value="お客様（ご本人）登録先";

		}else if (r_value[i].value=='1'){
			document.getElementById("submit_name_sei").value=document.getElementById("other_kanjiname_sei").value;
			document.getElementById("submit_name_mei").value=document.getElementById("other_kanjiname_mei").value;
			document.getElementById("submit_kananame_sei").value=document.getElementById("other_kananame_sei").value;
			document.getElementById("submit_kananame_mei").value=document.getElementById("other_kananame_mei").value;
			document.getElementById("submit_postal_3digit").value=document.getElementById("other_postal_3digit").value;
			document.getElementById("submit_postal_4digit").value=document.getElementById("other_postal_4digit").value;
			document.getElementById("submit_address_city").value=getCityName(document.getElementById("other_address_city").value);
			document.getElementById("submit_address_town").value=document.getElementById("other_address_town").value;
			document.getElementById("submit_address_build").value=document.getElementById("other_address_build").value;
			document.getElementById("submit_address_code").value=document.getElementById("other_address_code").value;
			document.getElementById("submit_tel_home").value=document.getElementById("other_tel_home").value;

		    //gift_kbn ADD START 2009/1/29
			var gift_kbn=document.getElementsByName("gift_kbn");
			for (i=0 ; i<gift_kbn.length ; i++){
		    	if(gift_kbn[i].checked){
		    		if(gift_kbn[i].value=='1'){
		    			document.getElementById("submit_gift_kbn").value="お客様（ご本人）登録先";
		    		}else if (gift_kbn[i].value=="9"){
		    			document.getElementById("submit_gift_kbn").value="商品のお届け先";
			    	}
			    }
			}
    		//gift_kbn ADD END 2009/1/29

    		}
    	}
    }
    var delivery_time_date = document.getElementsByName("delivery_date");
    document.getElementById("submit_deliver_date").value = "指定なし";
    for (var i = 0; i < delivery_time_date.length; i++){
    	if (delivery_time_date[i].checked){
    		if(delivery_time_date[i].value != ""){
    			document.getElementById("submit_deliver_date").value = delivery_time_date[i].value;
    			break;
    		}
    	}
    }

	var delivery_time_zone  = document.getElementsByName("delivery_time_zone");
	document.getElementById("submit_deliver_zone").value="指定なし";
	for (i=0 ; i<delivery_time_zone.length ; i++){
//	if(delivery_time_zone[i].selected){
		    if(delivery_time_zone[i].value=='00'){
			 	document.getElementById("submit_deliver_zone").value="指定なし";
		    }else if (delivery_time_zone[i].value=='01'){
		    	document.getElementById("submit_deliver_zone").value="午前中";
		    }else if (delivery_time_zone[i].value=='02'){
		    	document.getElementById("submit_deliver_zone").value="12:00～14:00";
		    }else if (delivery_time_zone[i].value=='03'){
		        document.getElementById("submit_deliver_zone").value="14:00～16:00";
		    }else if (delivery_time_zone[i].value=='04'){
		    	document.getElementById("submit_deliver_zone").value="16:00～18:00";
		    }else if (delivery_time_zone[i].value=='05'){
		    	document.getElementById("submit_deliver_zone").value="18:00～20:00";
		    }else if (delivery_time_zone[i].value=='06'){
		        document.getElementById("submit_deliver_zone").value="20:00～21:00";
		    }else {
		    	document.getElementById("submit_deliver_zone").value="指定しない";
		    }
//    	}
    }
    var pay_method  = document.getElementsByName("pay_method");
    for (i=0 ; i<pay_method.length ; i++){
    	if(pay_method[i].checked){
		    if(pay_method[i].value=='3'){
			 	document.getElementById("submit_payment").value="クレジットカード";
		    }else if (pay_method[i].value=='4'){
		    	document.getElementById("submit_payment").value="代金引換";
		    	document.orderForm.cardno1.value="";
		    	document.orderForm.cardno2.value="";
		    	document.orderForm.cardno3.value="";
		    	document.orderForm.cardno4.value="";
		    	document.getElementById("creditcard_expire_month").value="";
		    	document.getElementById("creditcard_expire_year").value="";
		    }else if (pay_method[i].value=='1'){
		    	document.getElementById("submit_payment").value="コンビニエンスストア・ゆうちょ銀行または郵便局から後払い";
		    	document.orderForm.cardno1.value="";
		    	document.orderForm.cardno2.value="";
		    	document.orderForm.cardno3.value="";
		    	document.orderForm.cardno4.value="";
		    	document.getElementById("creditcard_expire_month").value="";
		    	document.getElementById("creditcard_expire_year").value="";
		    }else if (pay_method[i].value=='5'){
		    	document.getElementById("submit_payment").value="口座自動引落し";
		    	document.orderForm.cardno1.value="";
		    	document.orderForm.cardno2.value="";
		    	document.orderForm.cardno3.value="";
		    	document.orderForm.cardno4.value="";
		    	document.getElementById("creditcard_expire_month").value="";
		    	document.getElementById("creditcard_expire_year").value="";
		    }
    	}
    }


    //アンケート部分
   var chk_questions = document.orderForm.question_chk;
	var questionValue = "";
	for (var i=0;i<chk_questions.length;i++){
		if(chk_questions[i].checked){
			if(questionValue!=""){
				questionValue+=",";
			}
			questionValue += chk_questions[i].value;
		}
	}
	document.orderForm.question.value=questionValue;
*/

    document.orderForm.action = url;
 	document.orderForm.submit();
 }

function setPay(){
	alert("setPay");
	var flag = document.orderForm.sel_address;
	var method = document.orderForm.pay_method;

	set_Daibiki(flag);
	selectPayMethod(method);
}

function doConfirmRegist(objForm){

	var birthday_year = objForm.birthdayyear.value;
	var birthday_month = objForm.birthdaymonth.value;
	var birthday_day = objForm.birthdayday.value;

	if(birthday_month.length == 1) {
		birthday_month = "0" + birthday_month;
	}
	if(birthday_day.length == 1) {
		birthday_day = "0" + birthday_day;
	}

 	objForm.birthday.value=birthday_year + birthday_month + birthday_day;
/*
	var chk_questions = objForm.question_chk;
	var questionValue = "";
	for (var i=0;i<chk_questions.length;i++){
		if(chk_questions[i].checked){
			if(questionValue!=""){
				questionValue+=",";
			}
			questionValue += chk_questions[i].value;
		}
	}
	objForm.question.value=questionValue;
*/
}
function doModifyRegist(objForm){
	var birthday_year = objForm.birthdayyear.value;
	var birthday_month = objForm.birthdaymonth.value;
	var birthday_day = objForm.birthdayday.value;

	if(birthday_month.length == 1) {
		birthday_month = "0" + birthday_month;
	}
	if(birthday_day.length == 1) {
		birthday_day = "0" + birthday_day;
	}
	objForm.birthday.value=birthday_year + birthday_month + birthday_day;
}
function displayBirthDay(objForm){
	var birthday = objForm.birthday.value;
	objForm.birthdayyear.value=birthday.substring(0,4);
	objForm.birthdaymonth.value=birthday.substring(4,6);
	objForm.birthdayday.value=birthday.substring(6);
}

function displaySex(str){
	if(str == "女性") document.getElementById("gender_0").checked = true;
	if(str == "男性") document.getElementById("gender_1").checked = true;
}

function displayTelSelect(str){
	if(str != "" && str != null){
		document.getElementById("telselect_1").checked = true;
	}else{
		document.getElementById("telselect_0").checked = true;
	}
}

function displaySegment1(str){
	if(str == "希望する") document.getElementById("segment1_0").checked = true;
	if(str == "希望しない") document.getElementById("segment1_1").checked = true;
}

function displaySegment2(str){
	if(str == "希望する") document.getElementById("segment2_0").checked = true;
	if(str == "希望しない") document.getElementById("segment2_1").checked = true;
}

//注文履歴から買い物かごへ遷移する場合
function doHistoryCartSubmit(product_id,pay_radio,select_1,select_2){

	document.shopcartform.pay_radio.value=pay_radio;
	document.shopcartform.select_1.value=select_1;
	document.shopcartform.select_2.value=select_2;

	document.shopcartform.p_id.value=product_id;
	document.shopcartform.p_action.value='add';
	document.shopcartform.p_num.value=1;
	document.shopcartform.submit();

}

//選択したコントロールのチェックを有効にします。
function AutoCheck(checkname) {
   document.getElementById(checkname).checked = true;
}

//代引きの場合の切り替え
function set_Daibiki(flag){
	if(flag == 1){
		document.orderForm.pay_method[1].disabled = true;
	}else{
		document.orderForm.pay_method[1].disabled = false;
	}
}

//日中の連絡先ロック
function set_Disabled(ctrl,flag){
	if(flag == '1'){
		ctrl.disabled = true;
	}else{
		ctrl.disabled = false;
	}
}

function dispPayMethod(){
alert();

	selectPayMethod(2);//不活性化
}


function selectPayMethod(method){
	switch(method){
		case 1:  //郵便振替　
			//お届け先：登録住所とは別の住所へお届けする
			document.orderForm.creditcard_expire_month.disabled = true;
			document.orderForm.creditcard_expire_year.disabled = true;
			document.orderForm.cardno1.disabled = true;
			document.orderForm.cardno2.disabled = true;
			document.orderForm.cardno3.disabled = true;
			document.orderForm.cardno4.disabled = true;
			break;
		case 3:
			//クレジットカード
			document.orderForm.creditcard_expire_month.disabled = false;
			document.orderForm.creditcard_expire_year.disabled = false;
			document.orderForm.cardno1.disabled = false;
			document.orderForm.cardno2.disabled = false;
			document.orderForm.cardno3.disabled = false;
			document.orderForm.cardno4.disabled = false;
			break;
		case 4: //代引き
			//商品を別のご住所にお届けする（プレゼントなど）
			document.orderForm.creditcard_expire_month.disabled = true;
			document.orderForm.creditcard_expire_year.disabled = true;
			document.orderForm.cardno1.disabled = true;
			document.orderForm.cardno2.disabled = true;
			document.orderForm.cardno3.disabled = true;
			document.orderForm.cardno4.disabled = true;
			break;
		case 5: //口座自動引き落とし
			//口座自動引き落とし
			document.orderForm.creditcard_expire_month.disabled = true;
			document.orderForm.creditcard_expire_year.disabled = true;
			document.orderForm.cardno1.disabled = true;
			document.orderForm.cardno2.disabled = true;
			document.orderForm.cardno3.disabled = true;
			document.orderForm.cardno4.disabled = true;
			break;
		default:
			//エラー
			break;
	}
}

//既定の桁数に達したら指定されたコントロールにフォーカスを移す
function setNextControl(i, n, m) {
  if(event.keyCode ==9){return} //tab
  if(event.keyCode ==16){return} //shift
  if(event.keyCode ==8){return} //backspace
  if(event.keyCode ==37){return} //←
  if(event.keyCode ==38){return} //↑
  if(event.keyCode ==39){return} //→
  if(event.keyCode ==40){return} //↓

  if (i.value.length >= m) {
    i.form.elements[n].focus();
  }

}

 function isIE(){ //ie?
if (window.navigator.userAgent.toLowerCase().indexOf("msie")>=1)
    return true;
else
    return false;
}

if(!isIE()){ //firefox innerText define
    HTMLElement.prototype.__defineGetter__("innerText",
    function(){
        var anyString = "";
        var childS = this.childNodes;
        for(var i=0; i<childS.length; i++) {
            if(childS[i].nodeType==1)
                //anyString += childS[i].tagName=="BR" ? "\n" : childS[i].innerText;
                anyString += childS[i].innerText;
            else if(childS[i].nodeType==3)
                anyString += childS[i].nodeValue;
        }
        anyString = anyString.replace(/\n/g,"");
        return anyString;
    }
    );
    HTMLElement.prototype.__defineSetter__("innerText",
    function(sText){
        this.textContent=sText;
    }
    );
}

//半角カナと全角ひらがなを全角カタカナにする
var zen_table = new Array(
  "。", "「", "」", "、", "・", "ヲ", "ァ", "ィ", "ゥ", "ェ",
  "ォ", "ャ", "ュ", "ョ", "ッ", "ー", "ア", "イ", "ウ", "エ",
  "オ", "カ", "キ", "ク", "ケ", "コ", "サ", "シ", "ス", "セ",
  "ソ", "タ", "チ", "ツ", "テ", "ト", "ナ", "ニ", "ヌ", "ネ",
  "ノ", "ハ", "ヒ", "フ", "ヘ", "ホ", "マ", "ミ", "ム", "メ",
  "モ", "ヤ", "ユ", "ヨ", "ラ", "リ", "ル", "レ", "ロ", "ワ",
  "ン", "゛", "゜"
);

function iskana(c)   { return (c >= 65377 && c <= 65439); }
function is_ka_to(c) { return (c >= 65398 && c <= 65412); }
function is_ha_ho(c) { return (c >= 65418 && c <= 65422); }
function is_hira(c)  { return ((c >= 12353 && c <= 12435) || c == 12445 || c == 12446); }

function toZenKata(src) {
  var i, code, next;
  var str = new String;
  var len = src.length;
  for (i = 0; i < len; i++) {
    var c = src.charCodeAt(i);
    if (iskana(c)) {
      code = zen_table[c - 65377];
      if (i < len - 1) {
        next = src.charCodeAt(i+1);
        if (next == 65438 && c == 65395) {
          code = "ヴ";
          i++;
        } else if (next == 65438 && (is_ka_to(c) || is_ha_ho(c))) {
          code = String.fromCharCode(code.charCodeAt(0)+1);
          i++;
        } else if (next == 65439 && is_ha_ho(c)) {
          code = String.fromCharCode(code.charCodeAt(0)+2);
          i++;
        }
      }
      str += code;
    } else if (is_hira(c)) {
      str += String.fromCharCode(c + 96);
    } else {
      str += src.charAt(i);
    }
  }
  return str;
}

function convert(control) {
  var src = new String(control.value);
  control.value = toZenKata(src);
  return true;
}

/* 半角数字から全角数字に変換するファンクション */
function h2z_word(src) {
  var str = src.replace(/(\w)/g,
    function ($0) {return String.fromCharCode($0.charCodeAt(0) + 65248);});
    str = str.replace(/-/g,"－");
    return str;
}

/*半角カナを全角カナに変換する*/
var zen_table = new Array(
    "。", "「", "」", "、", "・", "ヲ", "ァ", "ィ", "ゥ", "ェ",
    "ォ", "ャ", "ュ", "ョ", "ッ", "ー", "ア", "イ", "ウ", "エ",
    "オ", "カ", "キ", "ク", "ケ", "コ", "サ", "シ", "ス", "セ",
    "ソ", "タ", "チ", "ツ", "テ", "ト", "ナ", "ニ", "ヌ", "ネ",
    "ノ", "ハ", "ヒ", "フ", "ヘ", "ホ", "マ", "ミ", "ム", "メ",
    "モ", "ヤ", "ユ", "ヨ", "ラ", "リ", "ル", "レ", "ロ", "ワ",
    "ン", "゛", "゜"
);

function iskana(c)   { return (c >= 65377 && c <= 65439); }
function is_ka_to(c) { return (c >= 65398 && c <= 65412); }
function is_ha_ho(c) { return (c >= 65418 && c <= 65422); }

function h2z_kana(src) {
    var i, code, next;
    var str = new String;
    var len = src.length;
    for (i = 0; i < len; i++) {
        var c = src.charCodeAt(i);
        if (iskana(c)) {
            code = zen_table[c - 65377];
            if (i < len - 1) {
                next = src.charCodeAt(i+1);
                if (next == 65438 && c == 65395) {
                    code = "ヴ";
                    i++;
                } else if (next == 65438 && (is_ka_to(c) || is_ha_ho(c))) {
                    code = String.fromCharCode(code.charCodeAt(0)+1);
                    i++;
                } else if (next == 65439 && is_ha_ho(c)) {
                    code = String.fromCharCode(code.charCodeAt(0)+2);
                    i++;
                }
            }
            str += code;
        } else {
            str += src.charAt(i);
        }
   }
   return str;
}

//2008/10/09 ADD START
/* 半角記号を全角に変換するファンクション */
function h2z_sign(src) {
	var str = src.replace(/\(/g,"（");
	str = str.replace(/\)/g,"）");
	str = str.replace(/\!/g,"！");
	str = str.replace(/\#/g,"＃");
	str = str.replace(/\$/g,"＄");
	str = str.replace(/\%/g,"％");
	str = str.replace(/\&/g,"＆");
	str = str.replace(/\=/g,"＝");
	str = str.replace(/\~/g,"～");
	str = str.replace(/\|/g,"｜");
//	str = str.replace(/\'/g,"’");
//	str = str.replace(/\"/g,"”");
    return str;
}
//2008/10/09 ADD END

function convertHanNumKana(control) {
  var src = new String(control.value);
  control.value = h2z_word(src);
  control.value = h2z_kana(control.value);
  control.value = h2z_sign(control.value);
  return true;
}