var xmlhttp;
//Checking the name first

function validateEmail() 
{ 
 var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 
	return document.getElementById('signup').value.match(re);
}



function mailSignUp() {
	
	if(validateEmail())	{

    xmlhttp = GetXmlHttpObject();
    if (xmlhttp == null) {
        alert("Browser does not support HTTP Request");
        return;
    }
	
    
	
	
  
    var parameters = "signup=" + document.getElementById('signup').value;

    xmlhttp.onreadystatechange = stateChangedSearch;
    xmlhttp.open("POST", "signup.php", true)
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
    xmlhttp.send(parameters)
    }

}

function stateChangedSearch() {
    if (xmlhttp.readyState == 4) {
		
		document.getElementById('signUpBox').style.display = 'none';
		document.getElementById('signUpBoxThanks').style.display = 'block';
		
	
    }
}


//Used by all the lookups and such


function GetXmlHttpObject() {
    if (window.XMLHttpRequest) {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        return new XMLHttpRequest();
    }
    if (window.ActiveXObject) {
        // code for IE6, IE5
        return new ActiveXObject("Microsoft.XMLHTTP");
    }
    return null;
}

    

