
function checkEmail(myForm) {

if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.Email.value))
{
return (true)

}
alert("Invalid E-mail Address! Please re-enter.")
return (false)
}



/***********************************************
* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function ajaxpage(url, containerid){

var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
page_request.open('GET', url, true)
page_request.send(null)
}



function ajaxFunction(PagetoRun){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			//document.myForm.time.value = ajaxRequest.responseText;
		}
	}
	//ajaxRequest.open("GET", "ContactSend.asp", true);
	ajaxRequest.open("GET", PagetoRun, true);
	ajaxRequest.send(null); 
	clearForm('Contact');
	document.getElementById('ThankYou').style.display='block';
}


// Validation Script
function hasSelection(theSel){
  if(theSel.selectedIndex<1){
    return "Select one Option "+theField.name;
	 }
  return "";
}

function atLeastOne(theField) {
      for (d=0;d<theField.length;d++)
       if (theField[d].checked) return "";
		  return "At least one choice for: "+theField[0].name;
}

function isNumber(theField){
   theField.value = theField.value.replace(/^\s+|\s+$/g,"");
   if(!theField.value.match(/^\d+(\.\d*)?$/)){
     return "Enter a Numeric value for: "+theField.name;
   }
   return "";
}

function isNotEmpty(theField){
   theField.value = theField.value.replace(/^\s+|\s+$/g,"");
   if(theField.value==""){
     return "Please enter a value for: "+theField.name;
   }
   return "";
   
}


function IsValidEmail(theField) {

if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theField.value))
{
return "";
}
return "Invalid E-mail Address! Please re-enter."
}



var checkFields = [
["Name", isNotEmpty],
["Email", IsValidEmail],
["Enquiry", isNotEmpty]]
				
function checkForm(theForm){
  for(i=0; i<checkFields.length; i++){
    theField = theForm[checkFields[i][0]];
    for(c=1;c<checkFields[i].length;c++){
      msg = checkFields[i][c](theField);
      if(msg>""){
        alert(msg);
        theField.focus();
        return false;
      }
    }
  }

}
// End of Validation Script






