var xmlHttp;

function ajax_func(fisier, str, pag)	{

    xmlHttp=GetXmlHttpObject();

    if (xmlHttp==null)	{
	alert ("Your browser does not support AJAX!");
	return;
    } 

    var url= fisier;
    url=url+"?q="+str;
    url=url+"&sid="+Math.random();


    /*************************************************************************/

    if (pag == "cautare")	{

	if (str.length==0)	{ 
	    document.getElementById("rezcautare").innerHTML="";
	    return;
	}
	if (str.length >3) {

	    xmlHttp.onreadystatechange=statusChanged_cautare;
	    xmlHttp.open("GET",url,true);
	    xmlHttp.send(null);
		
		document.getElementById("span_popup_cautare").style.display = "block";
	} else {
    		document.getElementById("span_popup_cautare").style.display = "none";
	}   
	 
    }
    

    /*************************************************************************/

    if (pag == "contulmeu_email")	{

	xmlHttp.onreadystatechange=statusChanged_contulmeu_email;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	 
    }

    /*************************************************************************/




} 


function statusChanged_cautare() 	{ 
   
    if (xmlHttp.readyState==4)	{ var xmlDoc=xmlHttp.responseXML.documentElement;

	    document.getElementById("rezcautare").style.display = "block";
	    document.getElementById("span_popup_cautare").innerHTML=xmlHttp.responseText;

    }

}


/*************************************************************************/

function statusChanged_contulmeu_email() 	{ 
   
    if (xmlHttp.readyState==4)	{ var xmlDoc=xmlHttp.responseXML.documentElement;
	
	if (document.getElementById("admin_date_email_tmp").value == document.getElementById("admin_date_email_tmp2").value) {
	
	    document.getElementById("contulmeu_valabil").innerHTML = xmlDoc.getElementsByTagName("raspuns")[0].childNodes[0].nodeValue;
	    var este = xmlDoc.getElementsByTagName("da")[0].childNodes[0].nodeValue;
	
	    if (este == 1)	{
	
		//document.getElementById("prod_exist").value= 1;
		document.getElementById("contulmeu_valabil").style.color = "#56a700";
		document.getElementById("contulmeu_valabil").style.font = "bold 14px arial";
	
	    } else { 
	
		//document.getElementById("prod_exist").value= 0;
		document.getElementById("contulmeu_valabil").style.color = "#ff0000";
		document.getElementById("contulmeu_valabil").style.font = "bold 14px arial";

	    }
	}

    }

}

/*************************************************************************/





