// JavaScript Document
<!--
function chdate(objName){//function change date format to java format
	var myDate= new Date;
	var strDateArray= new Array();
		strDateArray = objName.split("-");
		strYear = strDateArray[0];
		strMonth = strDateArray[1]; strMonth--;
		strDay = strDateArray[2];

		myDate.setDate(strDay);
		myDate.setMonth(strMonth);
		myDate.setFullYear(strYear);
		return myDate;
}
function verifyForm(){
	var d,errors='';
//verify check in date and check out date
	var date_arr,date_dep,afterday2;
	var today = new Date; idate =new Date; odate =new Date;sdate =new Date;
//define data for verify data user
	var c,p;
	d=document.forms[0];
	afterday2=d.afterday2.value;
	date_arr=d.date_arr.value;
	date_dep=d.date_dep.value;

	sdate=chdate(afterday2);
	idate=chdate(date_arr);
	odate=chdate(date_dep);

	if(sdate > idate){
		errors += '- Date arrival must not less than after tomorrow.\n';//alert("Check in date must not less than date today.");
	}else{
		if(odate <= idate)
			errors+= '-  Date depart must is after date arrival.\n';//alert("Check out date must more than check in date.");
	}
	//-----------end verify date
	//-------------verify data user
	if(d.name.value=='')
		errors+='- Name is required.\n';
	if(d.email.value=='')
		errors+='- Email is required.\n';
	else{
		p=d.email.value.indexOf('@');
		if (p<1 || p==(d.email.length-1)) 
			errors+='- Email must contain an e-mail address.\n';
	}
	if(d.country.value=='')
		errors+='- Country is required.\n';
	if((d.zipcode.value!='') && (isNaN(d.zipcode.value)))
		errors+='- Zipcode must contain a number.\n';
	//------------end verify data user
	if (errors) alert('The following error(s) occurred:\n'+errors);
  	document.MM_returnValue = (errors == '');
}
//-->
