
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 subcategorii_categorie(categorie)
{

xmlHttp_subcategorii_categorie=GetXmlHttpObject()

var url="/root/ajaxuri/ajax_subcategorii_categorie.php?categorie="+categorie;

xmlHttp_subcategorii_categorie.onreadystatechange=stateChanged_subcategorii_categorie
xmlHttp_subcategorii_categorie.open("GET",url,true)
xmlHttp_subcategorii_categorie.send(null)

}

function stateChanged_subcategorii_categorie()
{

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

		document.getElementById("subcategory_id").innerHTML=xmlHttp_subcategorii_categorie.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='';
        text = '<div class="mesaj_informare" style="width:350px">Exista deja un cont cu aceasta adresa de email';
        text = text + '<br />Pentru a va autentifica <a href="/contul-meu.html">click aici</a></div>';
        document.getElementById("exista_email").innerHTML = text;		
        document.getElementById("informatii_de_completat").style.display='none'; 
        document.getElementById('submit_adauga_anunt').style.display='none'; 
		
      }
	  
      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='';

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


      }

     else if(xmlHttp.responseText == '3'){
         document.getElementById("exista_email").innerHTML = 'OK';            
         document.getElementById('submit_adauga_anunt').style.display=''; 
         document.getElementById("informatii_de_completat").style.display='';

     }
	 else {
	 
		document.getElementById("exista_email").style.display='';
        text = '<div class="mesaj_informare" style="width:350px">Introduceti o adresa valida de email';       
        document.getElementById("exista_email").innerHTML = text;		       
        //document.getElementById('submit_adauga_anunt').style.display='none'; 
	 
	 }


   }

}


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 change_cod_captcha2(width, height, characters)
{

document.getElementById("div_captcha2").innerHTML= '<img  src="/root/captcha.php?width='+width+'&amp;height='+height+'&amp;characters='+characters+'&amp;variabila=security_code2'+'&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
}
