
//vali data	 
function submitcon_inquiry_form(obj){
	if(confirm("submit?")){
		
		if(Vali_Inquiry_Data(obj)) return true;
		else return false;
		
	}else return false;
}

function submitcon_inquiry_export_form(obj){
	if(confirm("確定送出?")){
		
		if(Vali_Inquiry_Export_Data(obj)) return true;
		else return false;
		
	}else return false;
}

function Vali_Inquiry_Export_Data(obj){
	if(obj.start_date){
		if(ValidatorTrim(obj.start_date.value).length == 0){
			alert("You must be select start date!");
		    	obj.start_date.focus();
		    	return false;
		}
	}
	
	if(obj.end_date){
		if(ValidatorTrim(obj.end_date.value).length == 0){
			alert("You must be select end date!");
		    	obj.end_date.focus();
		    	return false;
		}
	}

	if(date_to_timestamp(obj.start_date.value) <= 0){
		alert("You must be select start date!");
		    	obj.start_date.focus();
		    	return false;
	}	
	if(date_to_timestamp(obj.end_date.value) <= 0){
		alert("You must be select end date!");
		    	obj.end_date.focus();
		    	return false;
	}	
	if(date_to_timestamp(obj.start_date.value) > date_to_timestamp(obj.end_date.value)){
		alert("start date greater than end date!");
		obj.end_date.focus();
		    	return false;
	}	
	
	//submitonce(obj);
	return true;
}	

function Vali_Inquiry_Data(obj){

	
	if(obj.contact_name){
		if(ValidatorTrim(obj.contact_name.value).length == 0){
			alert("您必須輸入您的姓名!");
		    	obj.contact_name.focus();
		    	return false;
		}
	}
	if(obj.contact_tel){
		if(ValidatorTrim(obj.contact_tel.value).length == 0){
			alert("您必須輸入您的聯絡電話!");
		    	obj.contact_tel.focus();
		    	return false;
		}
	}
	
	
	if(ValidatorTrim(obj.email.value).length == 0 || obj.email.value.indexOf('@',0)==-1 || obj.email.value.indexOf(".",obj.email.value.indexOf('@',0))==-1){
		alert("您必須輸入您的 E-Mail!");
		obj.email.focus();
		return false;
	}
	
	
	business_type_checked = 0;
	business_type_other = 1;
	for(var i=0 ; i<obj.business_type.length ; i++) {
    if(obj.business_type[i].checked){
    		business_type_checked = 1;
    		
    }
    
	}
	if(ValidatorTrim(obj.business_type_other.value).length == 0){
    	
    	business_type_other = 0;
  }
	
	
	if(business_type_checked == 0 && business_type_other == 0){
		alert("您必須選擇您的職業!");
		return false;
	}	
	
	if(obj.subject){
		if(ValidatorTrim(obj.subject.value).length == 0){
			alert("您必須輸入主旨!");
		    	obj.subject.focus();
		    	return false;
		}
	}
	if(obj.message){
		if(ValidatorTrim(obj.message.value).length == 0){
			alert("您必須輸入問題描述!");
		    	obj.message.focus();
		    	return false;
		}
	}
	submitonce(obj);
	return true;
}	

	