//------------------------------------------
var what="tip";
function process_audit(i) {
  if(i) what=i;
  http.open("POST", "includes/form_micro_audit.php", true);
  http.onreadystatechange=getHttpRes;
  
  var first=document.getElementById('first').value;
  var last=document.getElementById('last').value;
  var company=document.getElementById('company').value;
  var state=document.getElementById('state').value;
  var phone=document.getElementById('phone').value;
  var email=document.getElementById('emaila').value;
  var confirmemail=document.getElementById('confirmemail').value;
  
  var params="first="+first+"&last="+last+"&company="+company+"&state="+state+"&phone="+phone+"&email="+email+"&confirmemail="+confirmemail;

  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http.setRequestHeader("Content-length", params.length);
  http.setRequestHeader("Connection", "close");

  http.send(params);
}
//------------------------------------------
function process() {
  http.open("POST", "includes/form_process.php", true);
  http.onreadystatechange=getHttpRes;
  
  var email=document.getElementById('email_tip').value;
  
  var params="do=form&email="+email;
  
  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http.setRequestHeader("Content-length", params.length);
  http.setRequestHeader("Connection", "close");

  http.send(params);
}
function getHttpRes( ) {
  if (http.readyState== 4 && http.status== 200) {
  	var res=http.responseText;
  	var next=res.split(':::');
    if(next[0]) alert(next[0]);
    if(what=='tip' && next[1]) document.getElementById('status').innerHTML=next[1];
    if(what=='audit' && next[1]) document.getElementById('status_audit').innerHTML=next[1];
    //if (next[1]==2) document.getElementById('floors').style.display='none'; 
    //if (next[1]==2) document.getElementById('add_area').style.display=''; 
    //if (next[1]==2) document.getElementById('items').innerHTML='Drag areas here!'; 
    //if (next[1]==3) document.getElementById('add_area').style.display='none'; 
    //if (next[1]==3) document.getElementById('rename').style.display=''; 
    //if (next[1]==3) document.getElementById('rename').innerHTML=next[2]; 
    //if (next[1]==4) setTimeout('window.location="index.php"', 2000); 
  }
}
function getXHTTP( ) {
  var xhttp;
   try {
      xhttp=new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xhttp=new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e2) {
	    try {
	      xhttp=new XMLHttpRequest();
	    } catch (e3) {
	      xhttp=false;
	    }
      }
    }
  return xhttp;
}
var http=getXHTTP();
//------------------------------------------
