// JavaScript Document

function submit_email(email) {
	
	 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;
      }
   }
 }
 	if (document.getElementById(email).value.indexOf('@') == -1) {
		alert ("Please input a valid email address");
		return false;
	}
	
	document.getElementById('email_result').style.display = 'block';
	ajaxEmail = document.getElementById(email).value;
	var postvars="?action=email_result&email="+ajaxEmail+"";
	ajaxRequest.open("GET","http://www.ateliershoes.com/javascript/email_submit.php" + postvars,true);
	ajaxRequest.send(null);
	ajaxRequest.onreadystatechange = function(){
  		 if(ajaxRequest.readyState == 4){
      		var ajaxDisplay = document.getElementById('email_result');
      		ajaxDisplay.innerHTML = ajaxRequest.responseText;
  			 }
	 }
}

function changeInputValue() {
	if (document.getElementById('email').value == 'enter your e-mail') {
		document.getElementById('email').value = '';
		return false;
	}
	if (document.getElementById('email').value == '') {
		document.getElementById('email').value = 'enter your e-mail';
		return false;
	}
}