function Highlight(Element)
	{
		Element.style.color = "black"
		Element.style.backgroundColor = "#e5ff99"
	}
	
function Lowlight(Element)
	{
		Element.style.color = "black"
		Element.style.backgroundColor = "white"
	}

//function to check empty fields

function isEmpty(strfield1, strfield2, strfield3, strfield4, strfield5, strfield6, strfield7) {


//change "field1, field2, etc." to your field names  
strfield1 = document.forms[0].realname.value
strfield2 = document.forms[0].email.value 
strfield3 = document.forms[0].location.value 
strfield4 = document.forms[0].useby.value
strfield5 = document.forms[0].reason.value
strfield6 = document.forms[0].source.value
strfield7 = document.forms[0].detail.value


// !isNaN(x) - checks that the entry is "not a number"
// x.charAt(0) - checks that the entry is "not a date"

  // Name: field
    if (strfield1 == "" || strfield1 == null || !isNaN(strfield1) || strfield1.charAt(0) == ' ')
    {
    alert("\"Name:\" is required. Please amend and retry.")
	document.theform.realname.focus()
    return false;
    }
		
  // Email address: field 
    if (strfield2 == "" || strfield2 == null || !isNaN(strfield2) || strfield2.charAt(0) == ' ')
    {
    alert("\"Email address:\" is required. Please amend and retry.")
	document.theform.email.focus()
    return false;
    }
	
  // Location: field 
    if (strfield3 == "" || strfield3 == null || strfield3 == "Please select your country of residence" || strfield3 == "- - - - - - - - - - - - ")
    {
    alert("\"Location:\" is required. \nPlease select the country where you live and retry.")
	document.theform.location.focus()
    return false;
    }

  // For use by: field 
    if (strfield4 == "" || strfield4 == null || !isNaN(strfield4) || strfield4.charAt(0) == ' ')
    {
    alert("\"For use by:\" is required. Please amend and retry.")
	document.theform.useby.focus()
    return false;
    }

  // Reason for use: field 
    if (strfield5 == "" || strfield5 == null || !isNaN(strfield5) || strfield5.charAt(0) == ' ')
    {
    alert("\"Reason for use:\" is required. Please amend and retry.")
	document.theform.reason.focus()
    return false;
    }
	
  // How did you find Philip's cursors? field 
    if (strfield6 == "" || strfield6 == null || strfield6 == 'Please select from list')
    {
    alert("\"How did you find Philip's cursors?\" is required. Please amend and retry.")
	document.theform.source.focus()
    return false;
    }
  // Detail: field 
   if (strfield7 == "" || strfield7 == null || !isNaN(strfield7) || strfield7.charAt(0) == ' ')
    {
    alert("\"Detail:\" is required. Please amend and retry.")
	document.theform.detail.focus()
    return false;
    }
	

    return true;
}


//function to check valid email address
function isValidEmail(strEmail){
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
  strEmail = document.forms[0].email.value;

   // search email text for regular exp matches
    if (strEmail.search(validRegExp) == -1) 
   {
      alert('A valid e-mail address is required.\nPlease amend and retry');
	  document.theform.email.focus()
      return false;
    } 
    return true; 
}


//function that performs all functions, defined in the onsubmit event handler

function check(form){
if (isEmpty(form.realname)){
  if (isEmpty(form.email)){
	if (isEmpty(form.location)){
		if (isEmpty(form.useby)){
			if (isEmpty(form.reason)){
				if (isEmpty(form.source)){
					if (isEmpty(form.detail)){
						if (isValidEmail(form.email)){
						return true;
						}
					}
				}
			}
		}
	  }
  }
}
return false;
}

function redirecting()
	{
	window.location="http://philip-henderson.co.uk"
	}
