function BuyerRegistration_OnValidate(oForm){
	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 address details if available
	if ( oForm.txtHouseNameOrNumber ){
		if ( oForm.txtHouseNameOrNumber.value.length == 0 ){
			alert("Please enter the house name or number of the address where you live");
			oForm.txtHouseNameOrNumber.focus();
			return false;
		}
	}
	if ( oForm.txtStreet ){
		if ( oForm.txtStreet.value.length == 0 ){
			alert("Please enter the street name of the address where you live");
			oForm.txtStreet.focus();
			return false;
		}
	}
	if ( oForm.txtTownOrCity ){
		if ( oForm.txtTownOrCity.value.length == 0 ){
			alert("Please enter the town or city name of the address where you live");
			oForm.txtTownOrCity.focus();
			return false;
		}
	}
	if ( oForm.txtPostcode ){
		if ( oForm.txtPostcode.value.length == 0 ){
			alert("Please enter your postcode");
			oForm.txtPostcode.focus();
			return false;
		}
	}
	if ( oForm.txtMobileTelephone.value.length == 0 ){
		alert("Please provide your mobile telephone number so that we can contact you");
		oForm.txtMobileTelephone.focus();
		return false;
	}
	
	if ( oForm.txtEmailAddress.value == ""){
		if(!oForm.txtEmailAddress.value.match(/(\w+[\w|\.]*\w+)(@\w+[\w|\.]*\w+\.\w{2,3})/))
		{
			alert("Please enter a valid email address");
			oForm.txtEmailAddress.focus();
			return false;
		}
	}
	
	
	if(!oForm.txtEmailAddress.value.match(/(\w+[\w|\.]*\w+)(@\w+[\w|\.]*\w+\.\w{2,3})/))
	{
		alert("Please enter your email address");
		oForm.txtEmailAddress.focus();
		return false;
	}
	
	//check they've entered valid min price if entered
	if ( oForm.txtMinimumPrice.value.length > 0 && isNaN(oForm.txtMinimumPrice.value) ){
		alert("The minimum price you have entered is not numeric, please correct and try again");
		oForm.txtMinimumPrice.focus();
		return false;
	}
	if ( isNaN(oForm.txtMaximumPrice.value) && oForm.txtMaximumPrice.value.length > 0 ){
		alert("The maximum price you have entered is not numeric, please correct and try again");
		oForm.txtMaximumPrice.focus();
		return false;
	}
	if ( oForm.txtMaximumPrice.value.length == 0 ){
		alert("Please enter a maximum price");
		oForm.txtMaximumPrice.focus();
		return false;
	}
	
	if ( oForm.slStatus.value.length == 0 ){
		alert("Please select your current status");
		oForm.slStatus.focus();
		return false;
	}
	
	  oCookieManager.StoreFormData();
	  return true;

}

function BuyerRegistration_ListingType_OnChange(o){
	HttpManager.Document.GetObject("trPriceFrequency").style.display = ( o.value == "5" ? "none" : "block" );
}

function BuyerRegistration_OnLoad(){
	BuyerRegistration_ListingType_OnChange( document.frmRegister.slListingType );
}