function ValuationRequest_OnValidate(oForm){
try
{
	if ( oForm.slSalutation.value.length == 0 ){
		alert("Please select an appropriate salutation");
		oForm.slSalutation.focus();
		return false;
	}
	if ( oForm.txtContactFirstName.value.length == 0 ){
		alert("Please enter your first name");
		oForm.txtContactFirstName.focus();
		return false;
	}
	if ( oForm.txtContactLastName.value.length == 0 ){
		alert("Please enter your last name");
		oForm.txtContactLastName.focus();
		return false;
	}
	//validate property to be valued details
	if ( oForm.txtHouseNameOrNumber ){
		if ( oForm.txtHouseNameOrNumber.value.length == 0 ){
			alert("Please enter the house name or number of the property to be valued");
			oForm.txtHouseNameOrNumber.focus();
			return false;
		}
	}
	if ( oForm.txtStreet ){
		if ( oForm.txtStreet.value.length == 0 ){
			alert("Please enter the street name of the property to be valued");
			oForm.txtStreet.focus();
			return false;
		}
	}
	if ( oForm.txtTownOrCity ){
		if ( oForm.txtTownOrCity.value.length == 0 ){
			alert("Please enter the town or city name of the property to be valued");
			oForm.txtTownOrCity.focus();
			return false;
		}
	}
	if ( oForm.txtCounty ){
		if ( oForm.txtCounty.value.length == 0 ){
			alert("Please enter the county name of the property to be valued");
			oForm.txtCounty.focus();
			return false;
		}
	}
	//check that if the "contact details same as proprty to be valued" checkbox is unchecked then validate
	if (! oForm.chkSameAsAddress.checked ){
		if ( oForm.txtAlternateHouseNameOrNumber.value.length == 0 ){
			alert("Please enter the house name or number of the address where you live");
			oForm.txtAlternateHouseNameOrNumber.focus();
			return false;
		}
		if ( oForm.txtAlternateStreet.value.length == 0 ){
			alert("Please enter the street name of the address where you live");
			oForm.txtAlternateStreet.focus();
			return false;
		}
		if ( oForm.txtAlternateTownOrCity.value.length == 0 ){
			alert("Please enter the town or city name of the address where you live");
			oForm.txtAlternateTownOrCity.focus();
			return false;
		}
		if ( oForm.txtAlternateCounty.value.length == 0 ){
			alert("Please enter the county name of the address where you live");
			oForm.txtAlternateCounty.focus();
			return false;
		}
	}
	//
	if ( oForm.txtHomeTelephone.value.length == 0 ){
		alert("Please provide a primary telephone number so that we can contact you");
		oForm.txtHomeTelephone.focus();
		return false;
	}
	//
	HttpManager.Document.GetObject("txtSelectedDate").value = HttpManager.Document.GetObject("_ctl1_CenterRegion_WebPageContent__ctl0__ctl0_txtDateText").innerHTML;
	//	
	oCookieManager.StoreFormData();
	}
	catch(e){
		alert("There was an error validating this form, please contact the agent to complete your request");
		return false;
	}
	return true;
}

function ValuationRequest_AlternateDetails_OnClick(o){
	for ( var i = 1; i < 7; i ++ ){
		HttpManager.Document.GetObject("pnlContactAddress"+i).style.display = ( o.checked ? "none" : "block" );
	}
}

function Calendar_OnDateSelected(newdate){
	HttpManager.Document.GetObject("WebPageContent__ctl0__ctl1_txtDateText").innerHTML = newdate;
	Calendar_OnCancel();
}

function Valuation_Calendar_OnClick(){
	HttpManager.Document.GetObject("pnlCalendar").style.visibility = "visible";
}

function Calendar_OnCancel(){
	HttpManager.Document.GetObject("pnlCalendar").style.visibility = "hidden";
}