// Get the HTTP Object
			function getHTTPObject(){
  				 if (window.ActiveXObject) 
       				return new ActiveXObject("Microsoft.XMLHTTP");
   				else if (window.XMLHttpRequest) 
       				return new XMLHttpRequest();
   				else {
      				alert("Your browser does not support AJAX.");
      			return null;
   				}
			}
			
			// Change the value of the outputText field
			function setOutput(){
    			if(httpObject.readyState == 4){
					fade('popup2',true);
					//document.getElementById("response").style.display = "block";
//					document.getElementById("response").style.color = "#003300";
//					document.getElementById("home_main").style.height = "470px";
//					document.getElementById("home_right").style.height = "470px";
//					document.getElementById("home_left").style.height = "470px";
//        			document.getElementById("response").innerHTML = httpObject.responseText;
					//alert(httpObject.responseText);
    			}
 
			}
			
			// Implement business logic    
			function doWork(){
				//Create and populate variables to hold the form field contents.
				var cname = document.getElementById("name").value;
				var cemail = document.getElementById("email").value;
				var cphone = document.getElementById("phone").value;
				var ccity = document.getElementById("city").value;
				var cstate = document.getElementById("state").value;
				var cmessage = document.getElementById("message").value;
				
				// Instantiate the HTTP Object   
    			httpObject = getHTTPObject();
    			if (httpObject != null) {
        			httpObject.open("GET", "contact2.php?name="+cname+"&email="+cemail+"&phone="+cphone+"&state="+cstate
					+"&city="+ccity+"&message="+cmessage, true);
        			httpObject.send(null); 
        			// Call the setOutput function if the state changes, ie if there is a response.
					httpObject.onreadystatechange = setOutput;
    			}
			}
			
			
			function validateForm(){
				var namecond;
				var emailcond;
				var citycond;
				var statecond;
				// Validate the name field.
				if (document.contactform.name.value == "") {
					alert ("Please enter your name.");
					namecond = false;
					
					return;
				}
				else {
					namecond = true;
				}
				// Validate the email field.
				if (document.contactform.email.value == "") {
					alert ("Please enter your email address.");
					emailcond = false;
					return;
				}
				else {
					emailcond = true;
				}
				
				
				
				if (emailcond == true && namecond == true)
				{
					doWork();
				}
				
			}