function checkForm() 
{
	var Name = document.getElementById("Name");
	var Email = document.getElementById("Email");
	var Type = document.getElementById("Type");
	var PropertyAddress = document.getElementById("PropertyAddress");
	var PostcodeArea = document.getElementById("PostcodeArea");
	var Bedrooms = document.getElementById("Bedrooms");
	
	var NameVal = removeSpaces(Name.value);
	var EmailVal = removeSpaces(Email.value);
	var TypeVal = Type.selectedIndex;
	var PropertyAddressVal = removeSpaces(PropertyAddress.value);
	var PostcodeAreaVal = removeSpaces(PostcodeArea.value);
	var BedroomsVal = Bedrooms.selectedIndex;
	
	if(NameVal == "") { alert("Name is required!"); Name.select(); Name.focus(); return false; }
	if(EmailVal == "") { alert("Email Address is required!"); Email.select(); Email.focus(); return false; }
	if(EmailVal != "") { var emailpattern = /^.+@.+\..{2,3}$/; if(!emailpattern.test(EmailVal)) { alert("Valid email address is required!"); Email.select(); Email.focus(); return false; } }    
	if(TypeVal == "") { alert("Property Type is required!"); return false; }
	if(PropertyAddressVal == "") { alert("Property Address is required!"); PropertyAddress.select(); PropertyAddress.focus(); return false; }
	if(PostcodeAreaVal == "") { alert("Postcode is required!"); PostcodeArea.select(); PostcodeArea.focus(); return false; }
	if(BedroomsVal == "") { alert("No of Bedrooms is required!"); return false; }
	
	return true;
}
 
 
function removeSpaces(string) { return string.split(' ').join(''); } 
 
