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;
}   
  

//This function will be called when the form is submited
function saveData() {
 var question=document.getElementById("taQuestion").value;
 var email = document.getElementById("txtEmail").value;
 var urlstring;
 urlstring = encodeURI("inc/db/addToAsk.asp?email=" + email + "&question=" + question)
 //By calling this file, we have saved the data.
 show(urlstring);
  
 return false;//Prevent the form from being submited
}  
    

function show(url){

	xmlHttp=GetXmlHttpObject()
	
	if (xmlHttp==null){
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(null);
	document.getElementById(div).innerHTML = '<img align=center id="submitImage" name="submitImage" src="inc/busy.gif" alt="loading...">';
} 

function stateChanged() { 
	if (xmlHttp.readyState==4) { 
		document.getElementById('lyrResponse').innerHTML=xmlHttp.responseText;
	}
}





