/*==============================================================================

This function checks the value of the parameter for a email address. Also
checks for missing information in general forms.
            
------------------------------------------------------------------------------*/
function offerFocus() {
	var field = document.offerform.email;
	if (field.value == 'Your Email Address') { field.value = ''; }
	else if (field.value == '') { field.value = 'Your Email Address'; }	
	return;
}
function nameFocus() {
	var field = document.offerform.name;
	if (field.value == 'Your Name') { field.value = ''; }
	else if (field.value == '') { field.value = 'Your Name'; }	
	return;
}
function telFocus() {
	var field = document.offerform.tel;
	if (field.value == 'Your Number') { field.value = ''; }
	else if (field.value == '') { field.value = 'Your Number'; }	
	return;
}
function checkForm() {
	var missinginfo = "";
	var errorcolor = 'Pink';
    var okcolor = 'White';
	var field1 = document.offerform.name; 
    var field2 = document.offerform.email;
    var noName = field1.value == "";
    var badName = field1.value == "Your Name";
	var goodEmail = field2.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);

	if (badName || noName) {
		missinginfo += "\n- Name";
		field1.style.background = errorcolor;
	}
	else {
		field1.style.background = okcolor;
	}
	if (!goodEmail) {
		missinginfo += "\n- Valid Email, e.g. name@domain.com";
		field2.style.background = errorcolor;
	}
	else {
		field2.style.background = okcolor;
	}
	if (missinginfo != "") {
	   missinginfo ="==========================\n" +
	   "The following details are required:\n" +
	   missinginfo + "\n==========================" +
	   "\nPlease re-enter and submit again!";
	   alert(missinginfo);
	   return false;
	}
	else
	{
	   document.offerform.submit();
	}
}

var domain="mailto:"
function contact_me()
	{
		var end="info"
		var relend="@propertyrenovations-ely.co.uk"
		var relsub="?subject=PR Ltd Web Enquiry"
		window.location=domain+end+relend+relsub;
	}


var domain="mailto:"
function contact_us()
	{
		var end="info"
		var relend="@propertyrenovations-ely.co.uk"
		var relsub="?subject=PR Ltd Mobile Web Enquiry"
		window.location=domain+end+relend+relsub;
	}
	
function show(x)
	{

	y = document.getElementById(x)
	if ( y.style.zIndex != '17' ){
		y.style.display = 'inline'; y.style.zIndex = '17'; }
	else {
		y.style.display = 'none'; y.style.zIndex = '1'; }

	}


<!-- Form Error Check -->
function checkFields() {
    var missinginfo = "";
    var errorcolor = 'Pink';
    var okcolor = 'White';
	var selectinfo = "Please Select.....................";
	
	if (document.form.title.value == "") {
	missinginfo += "\n- Title";
	document.form.title.style.background = errorcolor;
	} else {
        document.form.title.style.background = okcolor;
    }
	if (document.form.visitor.value == "") {
	missinginfo += "\n- Name";
	document.form.visitor.style.background = errorcolor;
	} else {
        document.form.visitor.style.background = okcolor;
    }
	if (!(document.form.visitormail.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi))) {
	missinginfo += "\n- Valid Email";
	document.form.visitormail.style.background = errorcolor;
	} else {
        document.form.visitormail.style.background = okcolor;
    }
	if (!(document.form.telephone.value.match(/^[(]?[0]{1}[0-9]{2,4}[) -]{0,4}.[0-9]{3}[- ]?[0-9]{3}[ ]?$/))) {
	missinginfo += "\n- Valid Telephone, e.g. 01522 510310";
	document.form.telephone.style.background = errorcolor;
	} else {
        document.form.telephone.style.background = okcolor;
    }
	if (document.form.address.value == "") {
	missinginfo += "\n- Property Address";
	document.form.address.style.background = errorcolor;
	} else {
        document.form.address.style.background = okcolor;
    }
	if (!(checkPostCode (document.form.postcode.value))) {
	missinginfo += "\n- Property Postcode, e.g. LN1 3EG";
	document.form.postcode.style.background = errorcolor;
	} else {
        document.form.postcode.style.background = okcolor;
    }
	if (document.form.typeofproperty.value == selectinfo) {
	missinginfo += "\n- Type of Property";
	document.form.typeofproperty.style.background = errorcolor;
	} else {
        document.form.typeofproperty.style.background = okcolor;
    }
	if (document.form.bedrooms.value == selectinfo) {
	missinginfo += "\n- Number Bedrooms";
	document.form.bedrooms.style.background = errorcolor;
	} else {
        document.form.bedrooms.style.background = okcolor;
    }
	if (document.form.reason.value == selectinfo) {
	missinginfo += "\n- Reason for Selling";
	document.form.reason.style.background = errorcolor;
	} else {
        document.form.reason.style.background = okcolor;
    }
	if (document.form.eagent.value == selectinfo) {
	missinginfo += "\n- Property with Agent?";
	document.form.eagent.style.background = errorcolor;
	} else {
        document.form.eagent.style.background = okcolor;
    }
	if (document.form.speedofsale.value == selectinfo) {
	missinginfo += "\n- Speed of Sale";
	document.form.speedofsale.style.background = errorcolor;
	} else {
        document.form.speedofsale.style.background = okcolor;
    }
	if (document.form.conditionofproperty.value == selectinfo) {
	missinginfo += "\n- Condition of Property";
	document.form.conditionofproperty.style.background = errorcolor;
	} else {
        document.form.conditionofproperty.style.background = okcolor;
    }
	if (document.form.approximateage.value == selectinfo) {
	missinginfo += "\n- Age of Property";
	document.form.approximateage.style.background = errorcolor;
	} else {
        document.form.approximateage.style.background = okcolor;
    }
	if (document.form.hear.value == selectinfo) {
	missinginfo += "\n- Where You Heard About Us?";
	document.form.hear.style.background = errorcolor;
	} else {
        document.form.hear.style.background = okcolor;
    }
	if (missinginfo != "") {
		 missinginfo ="===============================\n" +
		 "The following details are required:\n" +
		 missinginfo + "\n===============================" +
		 "\nPlease re-enter and submit again!";
		 alert(missinginfo);
		 return false;
	  }
      else
      {
	     document.form.submit();
      }


}
