var xmlHttp

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 verification()
{
  
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null)
      {
          alert ("Браузърът не поддържа HTTP Request")
          return
      }
    var url="/tpl/links1.php"
    url=url+"?id=1&action=sql"
    xmlHttp.onreadystatechange=stateChanged
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
} 

function sendRequestForm1(){
	var oForm = document.form1;
	var sBody = getRequestBody(oForm);
	
	xmlHttp=GetXmlHttpObject()
	    if (xmlHttp==null)
      {
          alert ("Браузърът не поддържа HTTP Request")
          return
      }
	xmlHttp.open("post", oForm.action, true)
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", sBody.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.onreadystatechange = stateChangedForm1
	xmlHttp.send(sBody)
}

function stateChanged()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {
         document.getElementById("user").innerHTML=xmlHttp.responseText
		 document.getElementById('calc').style.display = ""; 
		 
     }
}

function stateChangedForm1()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {
         document.getElementById("user").innerHTML=xmlHttp.responseText
		 document.getElementById('calc').style.display = ""; 
		 
     }
}

function getRequestBody(oForm){
	var aParams = new Array();
	
	for(var i=0; i < oForm.elements.length; i++){
		var sParam = encodeURIComponent(oForm.elements[i].name);
		sParam += "=";
		sParam += encodeURIComponent(oForm.elements[i].name);
		aParams.push(sParam);
	}
	
	return aParams.join("&");
}