function valDrop(val) {

	obj = document.getElementById("otherField");

	if (val == "other")

	{

		obj.style.display="block";

		focusOn = document.getElementById("contactOther");

		focusOn.focus();

	}

	else 

	{

		obj.style.display="none";

		

		otherFindUs = document.getElementById("contactOther");

		otherFindUs.value = "";

	}

}



function checkContactForm()

{

  if (document.contactForm.contactName.value == "")

  {

    alert ('Please enter your name.');

    document.contactForm.contactName.focus();

	return false;

  }

  if (document.contactForm.contactEmail.value == "")

  {

	  alert ('Please enter your Email address.');

      document.contactForm.contactEmail.focus();

	  return false;

  }

  if (document.contactForm.contactFindUs.value == "")

	{

	  alert ('Please let us know how you found us.');

      document.contactForm.contactFindUs.focus();

	  return false;

	}

  if (checkEmailAddress(document.contactForm.contactEmail.value)==false)

  {

    alert ('Please enter a valid Email address.');

    document.contactForm.contactEmail.focus();

	return false;

  }

  if (document.contactForm.contactMessage.value == "")

  {

    alert ('Please tell us how we can help you.');

    document.contactForm.contactMessage.focus();

	return false;

  }

 if (checkMessageField(document.contactForm.contactMessage.value)==false)

  {

    alert ('Your message looks like spam! Please remove the http:// part of the web address in your message.');

    document.contactForm.contactMessage.focus();

	return false;

  }

    return true;

}



function checkMessageField(emailMessage)

{

  var notAllowed = "http";

  var messageField = emailMessage;

  if (messageField.indexOf(notAllowed) != -1)

    {

      return (false);

    }

  return (true);

}





function checkEmailAddress(emailAddress)

{

  var allowed = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.@-_";

  var emailLength = emailAddress.length;

  var atSignPosition = 0;

  var finalDotPosition = 0;

  var numberOfDots = 0;

  var numberOfAtSigns = 0;



  if (emailLength < 5)

  {

    return false;

  }



  for (i = 0; i < emailLength ;i ++)

  {

    if (allowed.indexOf(emailAddress.charAt(i))<0)

    {

      return (false);

    }

    if ((emailAddress.charAt(i)) == "@")

    {

      numberOfAtSigns ++;

      atSignPosition = i;

    }

    else

    {

      if ((emailAddress.charAt(i)) == ".")

      {

        numberOfDots ++;

        finalDotPosition = i;

      }

    }

  }

  if (numberOfDots == 0)

  {

    return (false);

  }

  if (numberOfAtSigns != 1)

  {

    return (false);

  }

  if (atSignPosition > finalDotPosition)

  {

    return (false);

  }

  if (finalDotPosition == (emailLength-1))

  {

    return (false);

  }

  return (true);

}



function ajaxRequest(){

 var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE

 if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)

  for (var i=0; i<activexmodes.length; i++){

   try{

    return new ActiveXObject(activexmodes[i])

   }

   catch(e){

    //suppress error

   }

  }

 }

 else if (window.XMLHttpRequest) // if Mozilla, Safari etc

  return new XMLHttpRequest()

 else

  return false

}



function ajaxget(){



var mypostrequest=new ajaxRequest()

mypostrequest.onreadystatechange=function(){

 if (mypostrequest.readyState==4){

  if (mypostrequest.status==200 || window.location.href.indexOf("http")==-1){

	   //alert("WIN");

	   ajaxLoader('page.php?dynamicPage=feedbackDone','mainNavBox');

  }

  else{

   alert("An error has occured making the request")

  }

 }

}



var parameters = "name=" + encodeURIComponent( document.getElementById("contactName").value ) +

				"&email=" + encodeURIComponent( document.getElementById("contactEmail").value ) + 

				"&findUs=" + encodeURIComponent( document.getElementById("contactFindUs").value ) + 

				"&other=" + encodeURIComponent( document.getElementById("contactOther").value ) + 

				"&message=" + encodeURIComponent( document.getElementById("contactMessage").value );

				

//alert(parameters);			



mypostrequest.open("POST", "sendMail.php", true)

mypostrequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded")

mypostrequest.send(parameters)

 

}