/***********************************************
* 商品検索リセット
***********************************************/
function SearchReset(){
	for( var i = 0; i < document.action_f.elements['FC[]'].length; i++ ){
		document.action_f.elements['FC[]'][i].checked = false;
	}
	document.action_f.elements['FC[]'].checked = false;
	document.action_f.PR.value = "";
	document.action_f.CA1.value = "";
	document.action_f.CA2.value = "";
	document.action_f.CO1.value = "";
	document.action_f.CO2.value = "";
	document.action_f.CL1.value = "";
	document.action_f.CL2.value = "";
	document.action_f.CU1.value = "";
	document.action_f.CU2.value = "";
}
/***********************************************
* 商品ソートドロップダウン
***********************************************/
function select_sr( arg ){
	if( arg.options[arg.selectedIndex].value != "" ){
		document.action_f.sr.value = arg.options[arg.selectedIndex].value;
		document.action_f.submit();
	}
}
/***********************************************
* ショッピングカート数量変更(未使用)
***********************************************/
function cntSubmit( obj, code ){
	document.action_f.cd.value = code;
	document.action_f.cnt.value = obj.value;
	document.action_f.submit();
}
/***********************************************
* 商品詳細：submit
***********************************************/
function DiaDetailSubmit( flag, ring_check ){
	/* flag       --- 次画面の遷移       1:cart 2:loose 3:frame 4:favorite */
	/* ring_check --- 入力チェック       1:RING_SIZE 2:S_RING_SIZE 3:RING_SIZEとS_RING_SIZE両方 */
	/* marriage   --- カートに入れる対象 1:cd 2:scd  */
	document.action_f.flag.value = flag;
	if( ring_check == 1 ){
		if( document.action_f.RING_SIZE.value == "" ){
			alert( 'リングサイズを指定してください' );
			return;
		}else if( ! isAlphaNum( document.action_f.STAMP_STRING ) ){
			alert( '刻印は半角英数字で入力してください' );
			return;
		}
	}
	if( ring_check == 2 ){
		if( document.action_f.S_RING_SIZE.value == "" ){
			alert( 'リングサイズを指定してください' );
			return;
		}else if( ! isAlphaNum( document.action_f.S_STAMP_STRING ) ){
			alert( '刻印は半角英数字で入力してください' );
			return;
		}
	}
	if( ring_check == 3 ){
		if( document.action_f.RING_SIZE.value == "" || document.action_f.S_RING_SIZE.value == "" ){
			alert( 'リングサイズを指定してください' );
			return;
		}
	}
	var marriage = DiaDetailSubmit.arguments[2];
	if( marriage != null ){
		document.action_f.mrg_flg.value = marriage;
	}
	document.action_f.submit();
	return;
}
/***********************************************
* 商品詳細：submit(詳細をメールで送る)
***********************************************/
function DiaDetailMailSubmit(){
	if( confirm( "この商品の詳細をメールで送信しますが\nよろしいですか？" ) ){
		document.action_mail.submit();
		return;
	}
	return;
}
/***********************************************
* 商品詳細：submit(問合せ)
***********************************************/
function DiaDetailContactSubmit(){
	if( confirm( "この内容でお問い合せを行います\nよろしいですか？" ) ){
		document.action_contact.submit();
		return;
	}
	return;
}
/***********************************************
* 元サイズで画像を開く
***********************************************/
function ImageOpen( imgpath ){
	window.open( imgpath, "_image", "width=520,height=520,resizable=yes");
	return;
}
/***********************************************
* お気に入り：submit
***********************************************/
function DavoriteSubmit( item ){
	var opt = document.forms['action_f_'+item];
//	if( opt.RING_SIZE.value == "" ){
//		alert( 'リングサイズを指定してください' );
//		return false;
//	}
	opt.submit();
	return;
}
/***********************************************
* もっと画像を見る
***********************************************/
function OpenDiaDetailImage( url ){
	window.open( url, 'ddimg', 'width=560,height=560,resizable=yes,scrollbars=yes' );
	return;
}
/***********************************************
* お支払い・配送方法入力チェック
***********************************************/
function OrderOptionCheck(){
	var flg = 0;
	if( document.action_f.PAY_DIV.length ){
		for( i = 0; i < document.action_f.PAY_DIV.length; i ++ ){
			if( document.action_f.PAY_DIV[i].checked ){
				flg = 1;
			}
		}
		if( flg == 0 ){
		}
	}else{
		if( document.action_f.PAY_DIV.checked ){
			flg = 1;
		}
	}
	if( flg == 0 ){
		alert( '支払方法が選択されていません。' );
		return false;
	}
	var yy = document.action_f.DELIVER_Y.value;
	var mm = document.action_f.DELIVER_M.value;
	var dd = document.action_f.DELIVER_D.value;
	if( yy+mm+dd != "" ){
		var ordertime = new Date( yy, mm - 1, dd );
		if( ordertime.getFullYear() != yy || ordertime.getMonth() != mm - 1 || ordertime.getDate() != dd ){
			alert('配送希望日が正しくありません');
			return false;
		}
		var nowtime = new Date();
		nowtime.setDate( nowtime.getDate() + ( 3 * 7 ) );
		if( ordertime < nowtime ){
			alert('配送希望日は現在より３週間後以降を選択してください');
			return false;
		}
	}
	document.action_f.submit();
	return true;
}
/***********************************************
* 半角英数字チェック
***********************************************/
function isAlphaNum( arg ){
	for(i = 0; i < arg.value.length; i ++){
		c = arg.value.charAt(i);
		if("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ".indexOf(c,0) <0){
			return false;
		}
	}
	return true;
}
/***********************************************
* メールアドレスチェック
***********************************************/
function isMailAdr( arg, msg ){
	if( ! arg.value.match( /^\S+@\S+\.\S+$/ ) ){
		alert( msg )
		arg.focus();
		return false;
	}
	return true;
}

/***********************************************
*button
***********************************************/
myImgOut  = new Image();          
myImgOut.src  = "{$HtmlPath}img/syousai/cart_a.jpg";   
myImgOver = new Image();         
myImgOver.src = "{$HtmlPath}img/syousai/cart_b.jpg";    

function myMouseOut(){                    
  document.myFormImg.src = myImgOut.src;  
}
function myMouseOver(){                   
  document.myFormImg.src = myImgOver.src; 
}

