function doReload()
{
	var av = document.getElementById("tbAV");
	if(av.value == 1){
		window.location.href = window.location.href ;
	}
}


function doRefresh()
{
	var av = document.getElementById("tbAV");
	var cb = document.getElementById("cboVehicleList");
	if(av.value=="1"){
		if(cb.options[cb.selectedIndex].value == -1){
			window.location.href = window.location.href ;
		}
	}
}

function doPrompt(msg)
{
	alert(msg);

}

function doPromptAv(msg)
{
	if(confirm(msg)){
		window.location.href = window.location.href ;
	}
}

function showDelCol(form)
{
	if(form.chkDeliveryRequired.checked){
		document.all.trDel.style.display="block";
	}
	else{
		document.all.trDel.style.display="none";
	}
}

function validateForm(form)
		{
		
		var PUDay,PUMonth,PUYear;
		var DODay,DOMonth,DOYear;
		
		PUDay =document.all.cboPUDay.options[document.all.cboPUDay.selectedIndex].value;
		PUMonth = document.all.cboPUMonth.options[document.all.cboPUMonth.selectedIndex].value;
		PUYear = document.all.cboPUYear.options[document.all.cboPUYear.selectedIndex].value;
		
		DODay =document.all.cboDODay.options[document.all.cboDODay.selectedIndex].value;
		DOMonth = document.all.cboDOMonth.options[document.all.cboDOMonth.selectedIndex].value;
		DOYear = document.all.cboDOYear.options[document.all.cboDOYear.selectedIndex].value;
		
			if(document.all.cboPUB.options[document.all.cboPUB.selectedIndex].value=="0"){
				alert("Please select your pick-up branch.");
				form.cboPUB.focus();
				return false;
			}
			
			if(!isDate(PUDay + "/" + PUMonth + "/" +  PUYear)){
				alert("Please select a valid pickup date");
				return false;
			}
			
			var thePuTime = document.getElementById("cboPUHour");
			if(thePuTime.options[thePuTime.selectedIndex].value =="0"){
				alert("Please select a pickup time.");
				return false;
			}
			
			if(!isDate(DODay + "/" + DOMonth + "/" +  DOYear)){
				alert("Please select a valid drop-off date");
				return false;
			}
				
		if(document.all.cboDOB.options[document.all.cboDOB.selectedIndex].value=="0"){
				alert("Please select your dropoff branch.");
				form.cboDOB.focus();
				return false;
			}
			
			if(document.all.cboVehicleList.options[document.all.cboVehicleList.selectedIndex].value=="0" || document.all.cboVehicleList.options[document.all.cboVehicleList.selectedIndex].value=="-1"){
				alert("Please select your vehicle group.");
				form.cboVehicleList.focus();
				return false;
			}
		}
						
						
		function validateGPSForm(form)
		{
		
		var PUDay,PUMonth,PUYear;
		var DODay,DOMonth,DOYear;
		
		PUDay =document.all.cboPUDay.options[document.all.cboPUDay.selectedIndex].value;
		PUMonth = document.all.cboPUMonth.options[document.all.cboPUMonth.selectedIndex].value;
		PUYear = document.all.cboPUYear.options[document.all.cboPUYear.selectedIndex].value;
		
		DODay =document.all.cboDODay.options[document.all.cboDODay.selectedIndex].value;
		DOMonth = document.all.cboDOMonth.options[document.all.cboDOMonth.selectedIndex].value;
		DOYear = document.all.cboDOYear.options[document.all.cboDOYear.selectedIndex].value;
		
			var em = document.getElementById("tbName");
			if(isEmpty(em.value)){
				alert("Please enter your name");
				em.focus();
				return false;
			}
			var em = document.getElementById("tbSurname");
			if(isEmpty(em.value)){
				alert("Please enter your surname.");
				em.focus();
				return false;
			}
			var em = document.getElementById("tbEmail");
			if(isEmpty(em.value) || !isEmail(em.value)){
				alert("Please enter your email address in the format 'name@domain'");
				em.focus();
				return false;
			}
			var em = document.getElementById("tbContactNumber");
			if(isEmpty(em.value) || !isNumeric(em.value)){
				alert("Please enter your contact number, numbers only and no spaces.");
				em.focus();
				return false;
			}
			
			if(document.all.cboPUB.options[document.all.cboPUB.selectedIndex].value=="0"){
				alert("Please select your pick-up branch.");
				form.cboPUB.focus();
				return false;
			}
		
			if(!isDate(PUDay + "/" + PUMonth + "/" +  PUYear)){
				alert("Please select a valid pickup date");
				return false;
			}
			
			if(!isDate(DODay + "/" + DOMonth + "/" +  DOYear)){
				alert("Please select a valid drop-off date");
				return false;
			}
				
		if(document.all.cboDOB.options[document.all.cboDOB.selectedIndex].value=="0"){
				alert("Please select your dropoff branch.");
				form.cboDOB.focus();
				return false;
			}
			
			
		}
												
		function setDay()
		{
			var theDay = 0;
			
			theDay = document.all.cboPUDay.options[document.all.cboPUDay.selectedIndex].value;
			for(var i = 0; i <= (document.all.cboPUDay.options.length - 1); i++){
				if(document.all.cboDODay.options[i].value == theDay){
					document.all.cboDODay.options[i].selected = true;
				}
			}
			doReload();
		}

		function setMonth()
		{
			var theMonth = 0;
			
			theMonth = document.all.cboPUMonth.options[document.all.cboPUMonth.selectedIndex].value;
			
			for(var i=0;i<= (document.all.cboPUMonth.options.length - 1);i++){
				if(document.all.cboDOMonth.options[i].value == theMonth){
					document.all.cboDOMonth.options[i].selected = true;
				}
			}
			doReload();
		}
		function setYear()
		{
			var theYear = 2006;
			
			theYear = document.all.cboPUYear.options[document.all.cboPUYear.selectedIndex].value;
			
			for(var i=0;i<= (document.all.cboPUYear.options.length - 1);i++){
				if(document.all.cboDOYear.options[i].value == theYear){
					document.all.cboDOYear.options[i].selected = true;
				}
			}
		}
		
		function setBranch()
		{
			var theBranch = 0;
			theBranch = document.all.cboPUB.options[document.all.cboPUB.selectedIndex].value;
				for(var i=0;i<=(document.all.cboPUB.options.length - 1);i++){
					if(document.all.cboDOB.options[i].value== theBranch){
						document.all.cboDOB.options[i].selected = true;
					}
				}
			doReload();
		
		}
		
		function doDOB()
		{
			var theChoice = document.all.cboDOB.options[document.all.cboDOB.selectedIndex].value;
			/*
			switch (theChoice){
			
				case "SWAK":
					document.location.href="default.aspx?country=nm";
					break;
				default :
					break;
			}
			alert(theChoice);
		*/
		}