function validate(theForm){

	var theState	= theForm.rec_state.options[theForm.rec_state.selectedIndex].value;

	var theDay	= theForm.delivery_day.options[theForm.delivery_day.selectedIndex].value;

	var theMonth	= theForm.delivery_month.options[theForm.delivery_month.selectedIndex].value;

	var theYear	= theForm.delivery_year.options[theForm.delivery_year.selectedIndex].value;

	var dbgFlag	= "N";





	if (theForm.action.value == "Continue Shopping"){

		return true;

	}



	if (theForm.rec_name.value == "Hamish Testing"){

		dbgFlag	= "Y"

		alert("Action: " + theForm.action.value + "; Actn: "  + theForm.action.action  + "; Hmmm: "  + theForm.action );

		alert("Action1: " + theForm.action1.value + "; Actn: "  + theForm.action1.action  + "; Hmmm: "  + theForm.action1  );

		alert("Form Name: " + theForm.name );

		alert("Browser: " + theForm.Browser.value + " Version: " + theForm.BrowserVersion.value + " Platform: " + theForm.Platform.value);

	}



	if (theForm.rec_name.value == "" || theForm.rec_name.value.length < 1 || theForm.rec_name.value.length > 100){

		alert("Please enter the recipient's name.");

		theForm.rec_name.focus();

		return false;

	}

	if (theForm.rec_message.value == "" || theForm.rec_message.value.length < 1){

		alert("Please enter a message for the recipient.");

		theForm.rec_message.focus();

		return false;

	}

	if (theForm.rec_message.value.length > 255){

		alert("Please reduce your message for the recipient - it may not be more than 255 characters.");

		theForm.rec_message.focus();

		return false;

	}

	if (theForm.rec_street_address.value == "" || theForm.rec_street_address.value.length < 1 || theForm.rec_street_address.value.length > 100){

		alert("Please enter a street address for the recipient.");

		theForm.rec_street_address.focus();

		return false;

	}

	if (theForm.rec_town.value == "" || theForm.rec_town.value.length < 1 || theForm.rec_town.value.length > 50){

		alert("Please enter a city / town for the recipient.");

		theForm.rec_town.focus();

		return false;

	}

	if (theState == "" || theState.length < 1 || theState.length > 50){

		alert("Please select a delivery province for the recipient.");

		theForm.rec_state.focus();

		return false;

	}

	if (theForm.rec_postcode.value == "" || theForm.rec_postcode.value.length < 1 || theForm.rec_postcode.value.length > 50){

		alert("Please enter the recipient's zip / post code.");

		theForm.rec_postcode.focus();

		return false;

	}

	if (theForm.rec_phone.value == "" || // theForm.rec_phone.value.indexOf('0') != 0 || 

			theForm.rec_phone.value.length < 9 || theForm.rec_phone.value.length > 50){

		alert("Please enter the recipient's phone number - it should include an area code (ie start with 0) and must be at least 9 digits.");

		theForm.rec_phone.focus();

		return false;

	}

	if (theForm.rec_instructions.value.length > 255){

		alert("Please reduce your special instructions for the delivery - they may not be more than 255 characters.");

		theForm.rec_instructions.focus();

		return false;

	}

	if (theForm.cus_name.value == "" || theForm.cus_name.value.length < 1 || theForm.cus_name.value.length > 100){

		alert("Please enter in your name.");

		theForm.cus_name.focus();

		return false;

	}

	if (theForm.cus_street_address.value == "" || theForm.cus_street_address.value.length < 1 || theForm.cus_street_address.value.length > 100){

		alert("Please enter your address.");

		theForm.cus_street_address.focus();

		return false;

	}

	if (theForm.cus_town.value == "" || theForm.cus_town.value.length < 1 || theForm.cus_town.value.length > 50){

		alert("Please enter your city / town.");

		theForm.cus_town.focus();

		return false;

	}

	if (theForm.cus_state.value == "" || theForm.cus_state.value.length < 1 || theForm.cus_state.value.length > 50){

		alert("Please enter your state / province.");

		theForm.cus_state.focus();

		return false;

	}

	if (theForm.cus_country.value == "" || theForm.cus_country.value.length < 1 || theForm.cus_country.value.length > 50){

		alert("Please enter your country of residence.");

		theForm.cus_country.focus();

		return false;

	}

	if (theForm.cus_postcode.value == "" || theForm.cus_postcode.value.length < 1 || theForm.cus_postcode.value.length > 50){

		alert("Please enter your zip / post code.");

		theForm.cus_postcode.focus();

		return false;

	}

	if (theForm.cus_email.value == "" || theForm.cus_email.value.indexOf('@',1) == -1 || theForm.cus_email.value.length > 50){

		alert("Please enter your correct email address in order for us to contact you regarding your order.");

		theForm.cus_email.focus();

		return false;

	}

	if (theForm.cus_phone.value == "" || theForm.cus_phone.value.length < 1 || theForm.cus_town.value.length > 50){

		alert("Please enter your contact phone number.");

		theForm.cus_phone.focus();

		return false;

	}

	if (ValidateDeliveryDate(theDay,theMonth,theYear,dbgFlag) < 0){

		alert("Please enter a delivery date which is not before today.");

		theForm.delivery_day.focus();

		return false;

	}

	return true;

	}



	function ValidateDeliveryDate(p_day,p_month,p_year,p_debug)

	{

		var SoonestWeCanDeliver = new Date();

		var RequestedDate	= new Date();

		var Soonest	= 0;

		var Req		= 0;

		var diff	= 0;

		var t;



		SoonestWeCanDeliver.setDate(SoonestWeCanDeliver.getDate());

		t = Date.parse(p_month + "/" + p_day + "/" + p_year);

		//RequestedDate.setTime(t);

		//Req	= RequestedDate.getYear() + 1900;

		//Req	= (Req * 100) + RequestedDate.getMonth() + 1;

		//Req	= (Req * 100) + RequestedDate.getDate();

		//Req	= p_year;

		//Req	= (Req * 100) + p_month;

		//Req	= (Req * 100) + p_day;

		//Soonest	= SoonestWeCanDeliver.getYear(); // + 1900;

		//Soonest	= (Soonest * 100) + SoonestWeCanDeliver.getMonth() + 1;

		//Soonest	= (Soonest * 100) + SoonestWeCanDeliver.getDate();

		//diff	= Soonest - Req;



		if (p_debug=="Y"){alert("Parameters: "	+ p_day + "/" + p_month +"/" + p_year);}

		if (p_debug=="Y"){alert("Time: "	+ t);}	

		if (p_debug=="Y"){alert("Requested: "	+ Req);}

		if (p_debug=="Y"){alert("Soonest: "	+ Soonest);}

		if (p_debug=="Y"){alert("Soonest GetDate: "	+ SoonestWeCanDeliver.getFullYear() + SoonestWeCanDeliver.getMonth() + SoonestWeCanDeliver.getDate());}


		if (p_year < SoonestWeCanDeliver.getFullYear()){

			diff = -1;

		}

		else if (p_year == SoonestWeCanDeliver.getFullYear()) {

			if (p_month < SoonestWeCanDeliver.getMonth() + 1) {

				diff = -1;

			}

			else if (p_month == SoonestWeCanDeliver.getMonth() + 1){

				if (p_day < SoonestWeCanDeliver.getDate()) {

					diff = -1;

				}

			}

		}



		return diff;

	}

