function submitGenericErrorContactForm(errorString)
{
		
	 var str = document.contactForm.fromemail.value; 
	/*var str2 = document.sunriseform.FromEmailvalidate.value; */
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);

	if (document.contactForm.forename.value.length < 1){
	alert("Please enter a first name")
	return false
	}

	if (document.contactForm.surname.value.length < 1){
	alert("Please enter a surname")
	return false
	}

	if (document.contactForm.summary.value == "Please select"){
	alert("Please choose an enquiry from drop-down list")
	return false
	}

	if (str.indexOf(at) == -1){
	   alert("Please enter a valid email address")
	   return false
	}
	if (str.indexOf(at) == -1 || str.indexOf(at) == 0 || str.indexOf(at) == lstr){
	   alert("Please enter a valid email address")
	   return false
	}
	if (str.indexOf(dot) == -1 || str.indexOf(dot) == 0 || str.indexOf(dot) == lstr){
	    alert("Please enter a valid email address")
	    return false
	}
	if (str.indexOf(at, (lat + 1)) != -1){
	   alert("Please enter a valid email address")
	   return false
	}
	if (str.substring(lat - 1, lat) == dot || str.substring(lat + 1, lat + 2) == dot){
	   alert("Please enter a valid email address")
	   return false
	}
	if (str.indexOf(dot, (lat + 2)) == -1){
	   alert("Please enter a valid email address")
	   return false
	}
	if (str.indexOf(" ") != -1){
	   alert("Please enter a valid email address")
	   return false
	}
	if (str.length < 1){
	alert("Please enter a valid email address")
	   return false
	}
	
	var encodedNotes = document.contactForm.notes.value + ' ';
	
	//Detect Browser and Operating System
	
	document.contactForm.appendChild( createElement("AppCodeName", navigator.appCodeName) );
	document.contactForm.appendChild( createElement("AppName", navigator.appName) );
	document.contactForm.appendChild( createElement("AppVersion", navigator.appVersion) );
	document.contactForm.appendChild( createElement("UserAgent", navigator.userAgent) );
	document.contactForm.appendChild( createElement("Platform", navigator.platform) );
	
	
	//need to encode the notes area in case the customer puts any weird characters in (£, $ etc)
	encodedNotes = encodeURIComponent(encodedNotes);

	//document.contactForm.notes.value = encodedNotes + errorString; 

	document.contactForm.submit();
}
function createElement(name, value) 
{
	var inputElement = document.createElement("input");
	inputElement.type = "HIDDEN";
	inputElement.name = name;
	inputElement.value = value;
	
	return inputElement;
}

function submitContactForm(form,userType)
{
	Common.hideErrorNodes(form);

	if (userType == "G")
	{
		var reWhiteSpace = new RegExp(/^\s+$/);
		var selectDropDown = document.getElementById("select");
		if(selectDropDown != null && selectDropDown.selectedIndex == 0){ Common.formDisplayErrorMessage("select",Common.errorMessages["ENTER_ENQUIRY"]);}
		
		if(form.forename != null && reWhiteSpace.test(form.forename.value) || form.forename.value == "")
		{ 
			Common.formDisplayErrorMessage("forename",Common.errorMessages["REQUIRED_FIRSTNAME"]);
		}
		if(form.surname != null && reWhiteSpace.test(form.surname.value) || form.surname.value == "")
		{
			Common.formDisplayErrorMessage("surname",Common.errorMessages["REQUIRED_SURNAME"]);
		}else if (form.surname.value.length < 3)
	 	{
		 	Common.formDisplayErrorMessage("surname",Common.errorMessages["SURNAME_INVALID_LENGTH"]);
	 	}

		if(form.fromemail != null && reWhiteSpace.test(form.fromemail.value) || form.fromemail.value == ""){ Common.formDisplayErrorMessage("fromemail",Common.errorMessages["INVALIDEMAILFORMAT"]);}
	}

	if(Common.isFormValid())
	{
		var encodedNotes = 'Enquiry/problem is: ' + form.contactFormOption.value + '  ';
		encodedNotes     = encodedNotes + 'Notes: ' + form.extraInfo.value + ' ' ;
			
		var now = new Date();
		encodedNotes     = encodedNotes + ' ' + 'Submitted at: ' + now.toLocaleString();
	
		//Detect Browser and Operating System
			
		encodedNotes = encodedNotes+"\nAppCodeName: "+navigator.appCodeName;
		encodedNotes = encodedNotes+"\nAppName: "+navigator.appName;
		encodedNotes = encodedNotes+"\nAppVersion: "+navigator.appVersion;
		encodedNotes = encodedNotes+"\nUserAgent: "+navigator.userAgent;
		encodedNotes = encodedNotes+"\nPlatform: "+navigator.platform;
		
		//need to encode the notes area in case the customer puts any weird characters in (£, $ etc)
		encodedNotes = encodeURIComponent(encodedNotes);
			
		form.notes.value = encodedNotes;

		cursor_wait();
		form.submit();
	}
}
			
