function LoadingQuote() {
	
	$('#content').css('display','none')
	$('#quotecontainer').css('display','block')	
	
	setTimeout('document.images["loadinggif"].src = "http://www.airport-parking-quote.co.uk/images/global/loading.gif"', 400); 
		
}

function StopLoadingQuote() {
	
	try {document.execCommand("Stop");}
	catch(err){}
	
	try {window.stop()	;}
	catch(err){}
	
	$('#quotecontainer').css('display','none')
	$('#content').css('display','block')
	
	setTimeout('document.images["loadinggif"].src = "http://www.airport-parking-quote.co.uk/images/global/loading.gif"', 400); 
	
}



function submitQuoteForm() {
	// searchingForQuote(); Button switch isn't needed with quote message triggered below
	// document.quote.submit(); no need for this either now we return true or false
	
	// First validate the date selection
	
	var vStartDay		= parseInt(document.getElementById("ddd").value);
	var vStartMonth		= parseInt(document.getElementById("ddm").value);
	var vStartYear		= parseInt(document.getElementById("ddy").value);		
	var vEndDay			= parseInt(document.getElementById("rdd").value);
	var vEndMonth		= parseInt(document.getElementById("rdm").value);
	var vEndYear		= parseInt(document.getElementById("rdy").value);
	
	var vDate			= new Date();
	var vTodayDay 		= vDate.getDate();
	var vTodayMonth 	= vDate.getMonth()+1;
	var vTodayYear 		= vDate.getFullYear();
	
	if ((vStartMonth < vTodayMonth) && (vStartYear == vTodayYear)){
		alert("Please check your dates are valid.")
		return false;
	}
	else if ((vStartDay < vTodayDay) && (vStartMonth == vTodayMonth) && (vStartYear == vTodayYear)){
		alert("Please check your dates are valid.")
		return false;
	}
	else if (vStartYear < vTodayYear){
		alert("Please check your dates are valid.")
		return false;
	}
	else if ((vStartMonth < vTodayMonth) && (vStartYear == vTodayYear)){
		alert("Please check your dates are valid.")
		return false;
	}
	else if ((vEndMonth < vTodayMonth) && (vEndYear == vTodayYear)){
		alert("Please check your dates are valid.")
		return false;
	}
	else if ((vEndDay < vTodayDay) && (vEndMonth == vTodayMonth) && (vEndYear == vTodayYear)){
		alert("Please check your dates are valid.")
		return false;
	}
	else if (vEndYear < vTodayYear){
		alert("Please check your dates are valid.")
		return false;
	}
	else if ((vEndMonth < vTodayMonth) && (vEndYear == vTodayYear)){
		alert("Please check your dates are valid.")
		return false;
	}
	else if ((vEndMonth < vStartMonth) && (vStartYear == vEndYear)){
		alert("Please check your dates are valid.")
		return false;
	}
	else if ((vEndDay < vStartDay) && (vEndMonth == vStartMonth) && (vStartYear == vEndYear)){
		alert("Please check your dates are valid.")
		return false;
	}
	else if ((vEndDay < vStartDay) && (vEndMonth < vStartMonth) && (vEndYear < vStartYear)){
		alert("Please check your dates are valid.")
		return false;
	}
	else if (((vStartMonth == 4) || (vStartMonth == 6) || (vStartMonth == 9) || (vStartMonth == 11)) && ((vStartDay == 31))){
		alert("There are not 31 Days in the start month you provided. Please amend to continue.")
		return false;
	}
	else if (((vEndMonth == 4) || (vEndMonth == 6) || (vEndMonth == 9) || (vEndMonth == 11)) && ((vEndDay == 31))){
		alert("There are not 31 Days in the end month you provided. Please amend to continue.")
		return false;
	}
	else if (((vStartMonth == 2)) && ((vStartDay == 30) || (vStartDay == 31))){
		alert("There are only 28 days in February this year. Please amend to continue.")
		return false;
	}
	else if (((vStartMonth == 2)) && ((vStartDay == 29) && (vStartYear == 2010))){
		alert("There are only 28 days in February this year. Please amend to continue.")
		return false;
	}
	else if (((vStartMonth == 2)) && ((vStartDay == 29) && (vStartYear == 2011))){
		alert("There are only 28 days in February this year. Please amend to continue.")
		return false;
	}
	else if (((vEndMonth == 2)) && ((vEndDay == 29) && (vEndYear == 2010))){
		alert("There are only 28 days in February this year. Please amend to continue.")
		return false;
	}
	else if (((vEndMonth == 2)) && ((vEndDay == 29) && (vEndYear == 2011))){
		alert("There are only 28 days in February this year. Please amend to continue.")
		return false;		
	}	
	else if (((vEndMonth == 2)) && ((vEndDay == 30) || (vEndDay == 31))){
		alert("This is not a valid end date. Please amend to continue.")
		return false;
	}	
	else if (vEndYear < vStartYear){
		alert("Please check your dates are valid.")
		return false;
	}

	// Now show the loading DIV
	
	LoadingQuote();
	return true;
}


function hideFlash() {
	if (document.getElementById('sales-flash')) {
		document.getElementById('sales-flash').style.display = "none";
		//document.getElementById('flashReplace').style.display = "block";
	}
}

function showFlash() {
	if (document.getElementById('sales-flash')) {
		document.getElementById('sales-flash').style.display = "block";
		//document.getElementById('flashReplace').style.display = "none";
	}
}

