function test(obj,msg){
	var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
	if (regex.test(obj.value)){
		return true;
	}else{
		alert(msg);
		obj.focus();
		return false;
	}
}
function checkint(obj,msg){
	if(isNaN(obj.value)){
		alert(msg);
		obj.focus();
		return false;
	}
}
function checkempty(obj,msg){
	if(obj.value==""){
		alert(msg);
		obj.focus();
		return false;
	}
}
function checkzero(obj,msg){
	if(obj.value==0){
		alert(msg);
		obj.focus();
		return false;
	}
}
function isChecked(isitchecked){
	if (isitchecked == true){
		document.frmselection.boxchecked.value++;
	}else{
		document.frmselection.boxchecked.value--;
	}
}
function chkselection(){
	if(document.frmselection.boxchecked.value == 0){alert('Please select an item from the list to proceed');return false;}
	return true;
}
function chkreservartion(){
	if (checkempty(document.frmreservation.fullname,"Information - Please enter your full name")==false) return false;
	if (test(document.frmreservation.email,"Information - Please enter your valid email address")==false) return false;
	if (checkempty(document.frmreservation.phone,"Information - Please enter your phone number")==false) return false;
	if (checkempty(document.frmreservation.pickupdt,"Information - Please select pickup date")==false) return false;
	if (checkempty(document.frmreservation.pickuphr,"Information - Please select pickup Hour")==false) return false;
	if (checkempty(document.frmreservation.pickupmin,"Information - Please select pickup Minutes")==false) return false;
	if (checkempty(document.frmreservation.dropoffdt,"Information - Please select drop off date")==false) return false;
	if (checkempty(document.frmreservation.dropoffhr,"Information - Please select drop off Hour")==false) return false;
	if (checkempty(document.frmreservation.dropoffmin,"Information - Please select drop off Minutes")==false) return false;
	return true;
}
function chks3(){
	if (checkempty(document.frmfinal.fullname,"Information - Please enter your full name")==false) return false;
	if (test(document.frmfinal.email,"Information - Please enter your valid email address")==false) return false;
	if (checkempty(document.frmfinal.phone,"Information - Please enter your phone number")==false) return false;
	if (checkempty(document.frmfinal.dob,"Information - Please select date of birth")==false) return false;
	if (checkempty(document.frmfinal.nationality,"Information - Please enter you nationality")==false) return false;
	if (checkempty(document.frmfinal.address,"Information - Please enter your address")==false) return false;
	if (checkempty(document.frmfinal.country,"Information - Please enter your country")==false) return false;
	if (checkempty(document.frmfinal.city,"Information - Please enter your city")==false) return false;
	if (checkempty(document.frmfinal.drivinglictype,"Information - Please enter your driving licence type")==false) return false;
	if (checkempty(document.frmfinal.coouarlic,"Information - Please enter your country of origin UAE licence")==false) return false;
	if (checkempty(document.frmfinal.licissuedt,"Information - Please enter your licence date of issue")==false) return false;
	if (checkempty(document.frmfinal.licexpdt,"Information - Please enter your licence date of expiry")==false) return false;
	if (checkempty(document.frmfinal.passportno,"Information - Please enter your passport number")==false) return false;
	if (checkempty(document.frmfinal.ppissuedt,"Information - Please enter your passport date of issue")==false) return false;
	if (checkempty(document.frmfinal.ppexpdt,"Information - Please enter your passport date of expiry")==false) return false;
	if (checkempty(document.frmfinal.pickupdt,"Information - Please select pickup date")==false) return false;
	if (checkempty(document.frmfinal.pickuphr,"Information - Please select pickup Hour")==false) return false;
	if (checkempty(document.frmfinal.pickupmin,"Information - Please select pickup Minutes")==false) return false;
	if (checkempty(document.frmfinal.dropoffdt,"Information - Please select drop off date")==false) return false;
	if (checkempty(document.frmfinal.dropoffhr,"Information - Please select drop off Hour")==false) return false;
	if (checkempty(document.frmfinal.dropoffmin,"Information - Please select drop off Minutes")==false) return false;
	return true;
}
function UpdAdonsC(isitchecked,did,prc){
	if (isitchecked == true){
		document.getElementById("asp"+did).innerHTML=""+prc+"";
	}else{
		document.getElementById("asp"+did).innerHTML="0.00";
	}
	CalTotal();
}
function OSH(sp,chkd){
	if(chkd==true){
		$("#"+sp).slideDown("slow");
	}else{
		$("#"+sp).slideUp("slow");
	}
}
function SH(sp,slm,csp,chkd){
	if(chkd==true){
		$("#"+sp).slideDown("slow");
	}else{
		selmenu=eval("document.frmfinal."+slm);
		selmenu.selectedIndex=0;
		document.getElementById(""+csp+"").innerHTML="0.00";
		$("#"+sp).slideUp("slow");
	}
}
function chkinqform(){
	if (checkempty(document.frminq.contactperson,"Information - Enter Your Name")==false) return false;
	if (checkempty(document.frminq.phone,"Information - Enter Your Phone Number")==false) return false;
	if (test(document.frminq.email,"Information - Enter Your Valid Email")==false) return false;
	if (checkempty(document.frminq.comments,"Information - Enter Your Comments")==false) return false;
}
function chkccinqform(){
	if (checkempty(document.frminq.contactperson,"Information - Enter Your Name")==false) return false;
	if (checkempty(document.frminq.phone,"Information - Enter Your Phone Number")==false) return false;
	if (test(document.frminq.email,"Information - Enter Your Valid Email")==false) return false;
	if (checkempty(document.frminq.comments,"Information - Enter Your Comments")==false) return false;
}
function parseDate(str) {
    var mdy = str.split('-')
    return new Date(mdy[2], mdy[0]-1, mdy[1]);
}
function daydiff(first, second) {
    return (second-first)/(1000*60*60*24)
}
function UpdDays(){
/*	startdt=new Date($("#pickupdt").val());
	enddt=new Date($("#dropoffdt").val());
	var diff = new Date(enddt - startdt);
	var days = diff/1000/60/60/24;
	if(enddt<startdt){
		alert("Pick up date must be before drop off date");
		return false;
	}else if(enddt==startdt){
		days=1;
	}
	pHrs=$("#pickuphr").val();
	pMin=$("#pickupmin").val();
	dHrs=$("#dropoffhr").val();
	dMin=$("#dropoffmin").val();
	tHrs=dHrs-pHrs;
	if(tHrs>1){
		days=days+1;
	}
	alert(days);*/
}
