// 定数＆変数
domain='www.reconet.co.jp/reconet/';
carturl='http://www.reconet.co.jp/reconet/41_cart.php';
cartwin='shoppingcart';
returnurl='index.html';
returnwin='_parent';
sp = '411024';

function set_environment(){
	var fm = document.frm_11_regist;
	fm.visitercode.value = carturl;
	fm.visiterwin.value = cartwin;
	fm.topurl.value = returnurl;
	fm.topwin.value = returnwin;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function echotarget(){
	var fm = document.frm_11_regist;
	var tar = 0;
	if(fm.changetarget.value) return fm.changetarget.value;
	return 'flm_12_flame';

}

function echourl(url){
	var fm = document.frm_11_regist;
	var t = 'http://' + domain + url;
	if(sp) {
		if(t.indexOf("?") > -1){
			t = t + '&shopcode=' + sp;
		}else{
			t = t + '?shopcode=' + sp;
		}
	}
	fm.action = t;
	var tar = 0;
	fm.target = echotarget();
	fm.submit();
}

function link_search(){
	atai = document.frm_11_regist.cmb_11_class.value;

	if(atai == ""){
		window.alert("項目が正しく選択されていません。");
		document.frm_11_regist.cmb_11_class.focus();
		return false;
	}

	/*半角かな文字チェック*/
	var iCount;
	var iCode;
	st_val=document.frm_11_regist.txt_11_kensaku.value;

	for (iCount=0 ; iCount<st_val.length ; iCount++){
	    	iCode = st_val.charCodeAt(iCount);
	      	if ((65382<= iCode && iCode <= 65439)){
				alert("全角で入力してください。");
				document.frm_11_regist.txt_11_kensaku.focus();
				return false;
			}
	}
	var iSetKbn	= document.frm_11_regist.cmb_11_class[document.frm_11_regist.cmb_11_class.selectedIndex].value;
	if (document.frm_11_regist.txt_11_kensaku.value.match(/[\/^0-9A-Za-z]/) && (iSetKbn =="1" || iSetKbn =="2" || iSetKbn =="3")){
		alert("全角で入力してください。");
		document.frm_11_regist.txt_11_kensaku.focus();
		return false;
	}

	if(st_val == ""){
		window.alert("検索文字を入力してください。");
		document.frm_11_regist.txt_11_kensaku.focus();
		return  false;
	}


	if(atai == 1){
		document.frm_11_regist.action="http://" + domain + "21_result1.php";
	}else{
		atai = eval(atai);
		if(atai == 5){
			if (document.frm_11_regist.chk_11_kanzen.checked){
				document.frm_11_regist.action="22_result2.php";
			}else{
				document.frm_11_regist.chk_11_kanzen.checked = true;
			}
		}
		document.frm_11_regist.action="http://" + domain + "22_result2.php";

		switch (atai){
			case 2:
				document.frm_11_regist.txt_title.value=document.frm_11_regist.txt_11_kensaku.value;
				if (document.frm_11_regist.chk_11_kanzen.checked){
					document.frm_11_regist.rdo_title.value="3";
				}else{
					document.frm_11_regist.rdo_title.value="2";
				}
				document.frm_11_regist.txt_kyoku.value="";
				document.frm_11_regist.rdo_kyoku.value="";
				document.frm_11_regist.txt_name.value="";
				document.frm_11_regist.rdo_name.value="";
				document.frm_11_regist.txt_productno.value="";
				break;
			case 3:
				document.frm_11_regist.txt_kyoku.value=document.frm_11_regist.txt_11_kensaku.value;
				if (document.frm_11_regist.chk_11_kanzen.checked){
					document.frm_11_regist.rdo_kyoku.value="3";
				}else{
					document.frm_11_regist.rdo_kyoku.value="2";
				}
				document.frm_11_regist.txt_title.value="";
				document.frm_11_regist.rdo_title.value="";
				document.frm_11_regist.txt_name.value="";
				document.frm_11_regist.rdo_name.value="";
				document.frm_11_regist.txt_productno.value="";
				break;
			case 4:
				document.frm_11_regist.txt_name.value=document.frm_11_regist.txt_11_kensaku.value;
				if (document.frm_11_regist.chk_11_kanzen.checked){
					document.frm_11_regist.rdo_name.value="3";
				}else{
					document.frm_11_regist.rdo_name.value="2";
				}
				document.frm_11_regist.txt_title.value="";
				document.frm_11_regist.rdo_title.value="";
				document.frm_11_regist.txt_kyoku.value="";
				document.frm_11_regist.rdo_kyoku.value="";
				document.frm_11_regist.txt_productno.value="";
				break;
			case 5:
				st_val=document.frm_11_regist.txt_11_kensaku.value;
				var msg = "商品番号検索は下記の入力に従ってください。\n ●すべて半角で入力を行ってください。\n ●-「ハイフン」と前後の英数字は必ず入力してください。\n ●アルファベットは必ず大文字で入力してください。";
		 		if (!st_val.match(/[\/^0-9A-Za-z]/)){
					window.alert(msg);
					document.frm_11_regist.txt_11_kensaku.focus();
					return false;
				}
				//-が含まれているかチェック
				chk_haifun = 0;
				for (iCount=0 ; iCount<st_val.length ; iCount++){
					iCode = st_val.charAt(iCount);
					if (iCode == "-" ){
						chk_haifun = chk_haifun + 1;
					}
				}
				if (chk_haifun != 1){
					window.alert(msg);
					document.frm_11_regist.txt_11_kensaku.focus();
					return  false;
				}

				ary_pro_no = st_val.split("-");
				st_val=ary_pro_no[0];
				//半角小文字の制限
				for (iCount=0 ; iCount<st_val.length ; iCount++){
				    iCode = st_val.charAt(iCount);
			      	if (iCode.match(/[^0-9A-Z]/)){
						window.alert(msg);
						document.frm_11_regist.txt_11_kensaku.focus();
						return  false;
					}
				}
//				if (st_val.length > 5){
//					window.alert(msg);
//					document.frm_11_regist.txt_11_kensaku.focus();
//					return  false;
//				}
				//前方文字必須入力
				if (st_val.length == 0){
					window.alert(msg);
					document.frm_11_regist.txt_11_kensaku.focus();
					return  false;
				}
				//後方文字必須入力
				st_val=ary_pro_no[1];
				if (st_val.length == 0){
					window.alert(msg);
					document.frm_11_regist.txt_11_kensaku.focus();
					return  false;
				}
				for (iCount=0 ; iCount<st_val.length ; iCount++){
				    	iCode = st_val.charAt(iCount);
				    	if (!iCode.match(/[\/^0-9A-Z]/)){
							window.alert(msg);
							document.frm_11_regist.txt_11_kensaku.focus();
							return false;
						}
				}
//				if (st_val.length > 10){
//					window.alert(msg);
//					document.frm_11_regist.txt_11_kensaku.focus();
//					return  false;
//				}
				chk_slash = 0;
				for (iCount=0 ; iCount<st_val.length ; iCount++){
					iCode = st_val.charAt(iCount);
					if (iCode == "\/" ){
						chk_slash = chk_slash + 1;
					}
				}
				if(chk_slash > 1){
					window.alert(msg);
					document.frm_11_regist.txt_11_kensaku.focus();
					return  false;
				}
				document.frm_11_regist.txt_productno.value=document.frm_11_regist.txt_11_kensaku.value.toUpperCase();
				document.frm_11_regist.txt_title.value="";
				document.frm_11_regist.rdo_title.value="";
				document.frm_11_regist.txt_name.value="";
				document.frm_11_regist.rdo_name.value="";
				document.frm_11_regist.txt_kyoku.value="";
				document.frm_11_regist.rdo_kyoku.value="";

				// 20030818 改修 t.satoh
				document.frm_11_regist.goods_maker.value	= document.frm_11_regist.txt_11_kensaku.value;
				document.frm_11_regist.act.value			= "cd_search";
				document.frm_11_regist.action				= "http://" + domain + "31_detail.php";
				break;
		}
	}
//	document.frm_11_regist.submit(); 
	document.frm_11_regist.target = echotarget();
	return true; 
}
function link_cart(){
	var fm = document.frm_11_regist;
	var url = fm.visitercode.value + "?shopcode=" + sp;
	var win = fm.visiterwin.value;

	if(win == '_self' || win == '_top' || win == '_parent'){
		fm.action = url;
		fm.method = 'post';
		fm.target = win;
		fm.submit();
	}else{
		window.open(url,win,"scrollbars=yes,width=650,height=500");
	}
	
}

function link_qa(){
	window.open("http:\/\/" + domain + "27_qanda.php","help","scrollbars=yes,width=670,height=500");
}
function init_focus(){
	set_environment();
	document.frm_11_regist.cmb_11_class.focus();	
}
function gohome(){
	parent.flm_12_flame.location.href = "http://www.reconet.co.jp/topcontents/11_top.php?shopcode=411024";
//	window.top.location.href = "index.html";
}

