 function checkForm() 
 {
	name = document.getElementById("Name").value;
	email = document.getElementById("Email").value;
	address = document.getElementById("Address").value;
	postcode = document.getElementById("Postcode").value;
	city = document.getElementById("City").value;
	measureddrawings = document.getElementById("MeasuredDrawings").selectedIndex;
	buildingconstruction = document.getElementById("BuildingConstruction").value;
	heatingsystem = document.getElementById("HeatingSystem").value;

	buildingrooms = document.getElementById("BuildingRooms").value;
	floorlevels = document.getElementById("FloorLevels").value;
	generalactivity = document.getElementById("GeneralActivity").selectedIndex;
	floorplans = document.getElementById("FloorPlans").selectedIndex;


	if (name == "" || name == " " || name == "  " || name == "   " || name == "    " || name == "     " || name == "Name:" || name == "Name: " || name == "Name:  " || name == "Name:   " || name == "Name:    " || name == "Name:     ") { hideAllErrors(); document.getElementById("NameError").style.display = "inline"; document.getElementById("Name").select(); document.getElementById("Name").focus(); return false; } 
 	if (email == "") { hideAllErrors(); document.getElementById("EmailError").style.display = "inline"; document.getElementById("Email").select(); document.getElementById("Email").focus(); return false; }    	
	if (email != "") { hideAllErrors(); var emailpattern = /^.+@.+\..{2,3}$/; if(!emailpattern.test(email)) { document.getElementById("EmailError").style.display = "inline"; document.getElementById("Email").select(); document.getElementById("Email").focus(); return false;     }  }    

	if (address == "" || address == " " || address == "  " || address == "   " || address == "    " || address == "     " || address == "Address:" || address == "Address: " || address == "Address:  " || address == "Address:   " || address == "Address:    " || address == "Address:     ") { hideAllErrors(); document.getElementById("AddressError").style.display = "inline"; document.getElementById("Address").select(); document.getElementById("Address").focus(); return false; } 
	if (postcode == "" || postcode == " " || postcode == "  " || postcode == "   " || postcode == "    " || postcode == "     " || postcode == "Postcode:" || postcode == "Postcode: " || postcode == "Postcode:  " || postcode == "Postcode:   " || postcode == "Postcode:    " || postcode == "Postcode:     ") { hideAllErrors(); document.getElementById("PostcodeError").style.display = "inline"; document.getElementById("Postcode").select(); document.getElementById("Postcode").focus(); return false; } 
	if (city == "" || city == " " || city == "  " || city == "   " || city == "    " || city == "     " || city == "City:" || city == "City: " || city == "City:  " || city == "City:   " || city == "City:    " || city == "City:     ") { hideAllErrors(); document.getElementById("CityError").style.display = "inline"; document.getElementById("City").select(); document.getElementById("City").focus(); return false; } 

	if (measureddrawings == "") { hideAllErrors(); document.getElementById("measureddrawingsError").style.display = "inline"; return false; }
	if (buildingconstruction == "" || buildingconstruction == " " || buildingconstruction == "  " || buildingconstruction == "   " || buildingconstruction == "    " || buildingconstruction == "     " || buildingconstruction == "Type of Building Construction: " || buildingconstruction == "Type of Building Construction:  " || buildingconstruction == "Type of Building Construction:   " || buildingconstruction == "Type of Building Construction:    " || buildingconstruction == "Type of Building Construction:     " || buildingconstruction == "Type of Building Construction:      ") { hideAllErrors(); document.getElementById("buildingconstructionError").style.display = "inline"; document.getElementById("BuildingConstruction").select(); document.getElementById("BuildingConstruction").focus(); return false; } 
	if (heatingsystem == "" || heatingsystem == " " || heatingsystem == "  " || heatingsystem == "   " || heatingsystem == "    " || heatingsystem == "     " || heatingsystem == "Type of Heating System - Boilers, etc..." || heatingsystem == "Type of Heating System - Boilers, etc... " || heatingsystem == "Type of Heating System - Boilers, etc...  " || heatingsystem == "Type of Heating System - Boilers, etc...   " || heatingsystem == "Type of Heating System - Boilers, etc...    " || heatingsystem == "Type of Heating System - Boilers, etc...     ") { hideAllErrors(); document.getElementById("heatingsystemError").style.display = "inline"; document.getElementById("HeatingSystem").select(); document.getElementById("HeatingSystem").focus(); return false; } 
	if (buildingrooms == "" || buildingrooms == " " || buildingrooms == "  " || buildingrooms == "   " || buildingrooms == "    " || buildingrooms == "     " || buildingrooms == "Rooms in the Building?" || buildingrooms == "Rooms in the Building? " || buildingrooms == "Rooms in the Building?  " || buildingrooms == "Rooms in the Building?   " || buildingrooms == "Rooms in the Building?    " || buildingrooms == "Rooms in the Building?     ") { hideAllErrors(); document.getElementById("buildingroomsError").style.display = "inline"; document.getElementById("BuildingRooms").select(); document.getElementById("BuildingRooms").focus(); return false; } 
	if (floorlevels == "" || floorlevels == " " || floorlevels == "  " || floorlevels == "   " || floorlevels == "    " || floorlevels == "     " || floorlevels == "Floor Levels in the Building?" || floorlevels == "Floor Levels in the Building? " || floorlevels == "Floor Levels in the Building?  " || floorlevels == "Floor Levels in the Building?   " || floorlevels == "Floor Levels in the Building?    " || floorlevels == "Floor Levels in the Building?     ") { hideAllErrors(); document.getElementById("floorlevelsError").style.display = "inline"; document.getElementById("FloorLevels").select(); document.getElementById("FloorLevels").focus(); return false; } 

	if (generalactivity == "") { hideAllErrors(); document.getElementById("generalactivityError").style.display = "inline"; return false; }
	if (floorplans == "") { hideAllErrors(); document.getElementById("floorplansError").style.display = "inline"; return false; }

  	return true;
}
 
function hideAllErrors() 
{
	document.getElementById("NameError").style.display = "none"
	document.getElementById("EmailError").style.display = "none"
	document.getElementById("AddressError").style.display = "none"
	document.getElementById("PostcodeError").style.display = "none"
	document.getElementById("CityError").style.display = "none"
	document.getElementById("measureddrawingsError").style.display = "none"
	document.getElementById("buildingconstructionError").style.display = "none"
	document.getElementById("heatingsystemError").style.display = "none"
	document.getElementById("buildingroomsError").style.display = "none"
	document.getElementById("floorlevelsError").style.display = "none"
	document.getElementById("generalactivityError").style.display = "none"
	document.getElementById("floorplansError").style.display = "none"
}