var xmlHttp

function sendEmail()
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="contact/send-email.php"
url=url+"?name="+document.getElementById("fname").value
url=url+"&email="+document.getElementById("email").value
url=url+"&details="+document.getElementById("details").value
xmlHttp.onreadystatechange=stateChanged2 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged2() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("contact-error").innerHTML=xmlHttp.responseText
 if(xmlHttp.responseText=="<p>Thank you for your interest, we will get back to you as soon as possible.</p>")
 document.getElementById("contact-information-form").innerHTML="" 
 } 
}

function callUs()
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="http://www.explosiveapps.com/contact/callus.php"
url=url+"?pname="+document.getElementById("pname").value
url=url+"&company="+document.getElementById("company").value
url=url+"&phone="+document.getElementById("phone").value
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("have-us-call-you-error").innerHTML=xmlHttp.responseText
  if(xmlHttp.responseText=="<p>Thank you for your interest in SleepStream, we will call you before the close of the next business day.</p><p class='small-button'><a href='javascript:hidePopup();' title='close'><strong><em>close</em></strong></a></p>")
  document.getElementById("have-us-call-you").innerHTML=""
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
	function showPopup(){
		document.getElementById('hide-show').style.display = 'block';
		document.getElementById('have-us-call-you-error').innerHTML=""
		document.getElementById('have-us-call-you').innerHTML="<p>Please enter your information below...</p><form action='callus.php' method='post' id='sendphone'><input type='text' name='pname' id='pname' /><label for='pname'>Name</label><input type='text' name='company' id='company' /><label for='company'>Company</label><input type='text' name='phone' id='phone' /><label for='phone'>Phone</label><input type='button' onclick='callUs();' value='call me' class='button' /><input type='button' value='close' class='button' onclick='hidePopup();' /></form>"
		
	}
	function hidePopup(){
		document.getElementById('hide-show').style.display = 'none';
	}
