// JavaScript Document


function formCheck(frm){
	
	var errorList = [];
	var flg = 1;
	var pattern = "";

	//ご購入商品
	var radioList = document.getElementsByName("item");
	var radio="undefined";
	for(i=0;i<radioList.length;i++){
		if(radioList[i].checked){
			radio=radioList[i].value;
		}
	}
	
	if(radio=="undefined"){
		errorList.push("ご購入商品");
		flg = 0;
	}
	
	
	
	//ご購入店舗
	if(frm.shop.value == "ご購入店舗を入力して下さい"){
		
		errorList.push("ご購入店舗");
		flg = 0;
		
	}
	
	//ご購入年月
	/*var pattern = /[0-9]{2,4}|[０-９]{2,4}/;
	var year=frm.year.value;
	var month=frm.month.value;
	if((!year||!month)||(!year.match(pattern)||!month.match(pattern))){
		
		errorList.push("ご購入年月");
		flg = 0;
		
	}*/
	//ご購入年月
	var yearNo=document.frm.year.selectedIndex
	var yearVal=document.frm.year[yearNo].value
	
	
	//メールアドレス【item08】
	pattern=/^[\w\._-]+@[\w\.-]+\.\w{2,}$/;
	var str = frm.mail.value;
	if(str=="メールアドレスを入力して下さい"){
		errorList.push("メールアドレス");
		flg = 0;
	}else if(str&&!str.match(pattern)){
		
		errorList.push("メールアドレスが正しくありません");
		flg = 0;
		
	}
	
	
	//入力漏れがあればアラート表示
	if(flg==0){
		var errorStr = "【　　　　　　　　入力エラー　　　　　　　　】\n\n▼お手数ですが以下の項目を再度入力してください\n";
		for(i=0;i<errorList.length;i++){
			errorStr += "・"+errorList[i] + "\n";
		}
		
		alert(errorStr);
		return false;
	}else{
		return true;
	}
			
	
}


function submitMail(){
	return true;
}