
function valideaza_email(email)
{

xmlHttp=GetXmlHttpObject()

var url="/root/ajaxuri/ajax_validari.php?tip_validare=email&email="+email



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

function stateChanged_valideaza_email()
{

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		document.getElementById("mesaj_email").innerHTML=xmlHttp.responseText


	}
}

///////////////////////////////

function valideaza_username(username)
{

xmlHttp=GetXmlHttpObject()

var url="/root/ajaxuri/ajax_validari.php?tip_validare=username&username="+username



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

function stateChanged_valideaza_username()
{

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{

		document.getElementById("mesaj_username").innerHTML=xmlHttp.responseText


	}
}


///////////////////////////////

function verifica_existenta_email(email)
{

xmlHttp=GetXmlHttpObject()

var url="/root/ajaxuri/verifica_existenta_email.php?email="+email



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

function stateChanged_verifica_existenta_email()
{

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{

      if(xmlHttp.responseText == '1') {
		document.getElementById("exista_email").style.display='';
        document.getElementById("exista_email").innerHTML ='<span class="mesaj_informare">Exista deja un cont cu aceasta adresa de email</span>';
        document.getElementById("informatii_de_completat").style.display='none';
        document.getElementById('submit_adauga_anunt').type = 'button';

      }
      else if(xmlHttp.responseText == '2') {
		document.getElementById("exista_email").style.display='';
        $text = '<span class="mesaj_informare_verde">OK </span>';
        document.getElementById("informatii_de_completat").style.display='none';

        document.getElementById("exista_email").innerHTML = $text+'<input type="hidden" name="date_personala_stiute" value="1" />';
        document.getElementById('submit_adauga_anunt').type = 'submit';


      }

     else {

        //document.getElementById("exista_email").innerHTML = document.getElementById("informatii_de_completat").innerHTML;
        document.getElementById('submit_adauga_anunt').type = 'submit';
        document.getElementById("informatii_de_completat").style.display='';

     }


   }

}


function change_cod_captcha(width, height, characters)
{

document.getElementById("div_captcha").innerHTML= '<img  src="/root/captcha.php?width='+width+'&amp;height='+height+'&amp;characters='+characters+'&amp;seteaza_cod='+Math.floor(Math.random()*11)+'" alt="" />'
}



///////////////////////////////

function GetXmlHttpObject()
{
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}