
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 loadDIV(url)
{
document.getElementById('Main').innerHTML = "<iframe src ="+url+"> </iframe>";
}

function Init_FiltruDomeniu()
{
var xmlHttp=GetXmlHttpObject()
var url="../php/listbox.php";
url+=" ?table=nom_dom&value=id_domeniu&caption=domeniu"
xmlHttp.onreadystatechange=function(){
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
      document.getElementById("FiltruDomeniu").innerHTML="<option value='00'>----- Toate domeniile -----</option>"+xmlHttp.responseText 
   }
xmlHttp.open("GET",url,true);
xmlHttp.send(null)
}


function Init_Ocupatie()
{

var xmlHttp=GetXmlHttpObject()
var url="../php/listbox.php";
url+="?table=nom_job&value=id_job&caption=job"
xmlHttp.onreadystatechange=function(){
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
      document.getElementById("Ocupatie").innerHTML=xmlHttp.responseText 
   }
xmlHttp.open("GET",url,true);
xmlHttp.send(null)
}


function Init_FiltruJob()
{

var xmlHttp=GetXmlHttpObject()
var url="../php/listbox.php";
url+="?table=nom_job&value=job&caption=job"
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=function(){
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
      document.getElementById("CampFiltru").innerHTML="<select name='FiltruJob' id='FiltruJob'><option value='00'>----- Toate ocupatiile -----</option>"+xmlHttp.responseText+"</select>"
//	  document.all['(FiltruJobExact'].innerHTML="<option value='00'>----- Toate ocupatiile ----- </option>"+xmlHttp.responseText
   }
   }
xmlHttp.open("GET",url,true);
xmlHttp.send(null)
}

function Init_FiltruFirma()
{
var xmlHttp=GetXmlHttpObject()
var url="../php/listbox.php";
url+="?table=firma&value=cui&caption=firma"
xmlHttp.onreadystatechange=function(){
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
      document.getElementById("FiltruFirma").innerHTML="<option value='00'>----- Toate firmele -----</option>"+xmlHttp.responseText 
   }
xmlHttp.open("GET",url,true);
xmlHttp.send(null)
}

function Init_ListJob(job,cuif,pag)
{
var xmlHttp=GetXmlHttpObject()
var url="../php/listJob.php";
url+="?job="+job+"&cuif="+cuif+"&pag="+pag
xmlHttp.onreadystatechange=function(){
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
      document.getElementById("ListJob").innerHTML=xmlHttp.responseText ;
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null)
}

function validareFirma(cui)
{
var xmlHttp=GetXmlHttpObject()
var url="../php/firma.php";
url+="?cui="+cui
xmlHttp.onreadystatechange=function(){
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
      if (xmlHttp.responseText=="ne") 
	  		window.location="../html/firma_noua.html";
     	else {
			document.getElementById("DateFirma").innerHTML=xmlHttp.responseText;
			document.getElementById("auth").innerHTML='';
			document.getElementById("Titlu").innerHTML="<p><strong>Cereri existente</strong></p>";
			document.getElementById('Adauga').style.display='inline';
			document.getElementById("cuif").value=cui
			Init_ListJob('',cui,'1');
			
			}
      }
   }
xmlHttp.open("GET",url,true);
xmlHttp.send(null)

}

function AdaugaJob(cuif,job,desc,termen,data)
{
var xmlHttp=GetXmlHttpObject()
var url="../php/adaugaJob.php";
url+="?cuif="+cuif+"&job="+job+"&desc="+desc+"&termen="+termen+"&nr="+data

xmlHttp.onreadystatechange=function(){
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
	   Init_ListJob('',cuif,'1')
	   }
   }
xmlHttp.open("GET",url,true);
xmlHttp.send(null)
}


function Sterge(cuif,id)
{
var xmlHttp=GetXmlHttpObject()
var url="../php/stergeJob.php";
url+="?id="+id

xmlHttp.onreadystatechange=function(){
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
	   Init_ListJob('',cuif,'1')
	   }
   }
xmlHttp.open("GET",url,true);
xmlHttp.send(null)
}



