function max(t1,t2){
	   if((t1.checked!=1)&&(t2.checked!=1))document.getElementById("max").style.visibility = "hidden";
	   if((t1.checked==1)&&(t2.checked!=1))document.getElementById("max").style.visibility = "visible";
	   if((t1.checked!=1)&&(t2.checked==1))document.getElementById("max").style.visibility = "visible";
	   if((t1.checked==1)&&(t2.checked)==1)document.getElementById("max").style.visibility = "visible";
	}
	function zone(){
	   var i
		if(document.getElementById("trimite1").style.display == "block"){
		   document.getElementById("trimite1").style.display = "none"
		   document.getElementById("click").style.display = "none"
		   document.getElementById("trimite2").style.display = "block"
		   document.getElementById("zone").style.display = "block"
		   document.getElementById("inapoi").style.display = "block"
		   i=1
		   for(i=1;i<=25;i++)document.getElementById("zone-default"+i).style.display = "none"
	   }else{
		   document.getElementById("trimite1").style.display = "block"
		   document.getElementById("click").style.display = "block"
		   document.getElementById("trimite2").style.display = "none"
		   document.getElementById("zone").style.display = "none"
		   document.getElementById("inapoi").style.display = "none"
		   i=1
		   for(i=1;i<=25;i++)document.getElementById("zone-default"+i).style.display = "block"
		}
	}
	function form(i){
	   var formular = document.getElementById("formular"+i);
	   if(formular.style.display == "block"){
	      formular.style.display = "none";
	   } else {
    	  formular.style.display = "block";
	   }
	}
	function selectare(cat,categorie,n){
	  var i;
	  if(cat)for(i=1;i<=n;i++)document.getElementById("zona"+i+"cat"+categorie).checked=true;
	  else for(i=1;i<=n;i++)document.getElementById("zona"+i+"cat"+categorie).checked=false;
	}
	function bifat(){
		var p=document.getElementById("mp").style;
		if(document.getElementById("tip7").checked||document.getElementById("tip9").checked||document.getElementById("itip").checked||document.getElementById("itip9").checked||document.getElementById("ptip7").checked||document.getElementById("ptip9").checked)p.display="inline";
		else p.display="none";
	}
	function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
}
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}
function setHome()
{
   document.body.style.behavior='url(#default#homepage)';
   document.body.setHomePage(window.location.href);
}
function open_win(id)
{
 window.open("actualizare_anunturi/index.php?anunt="+id,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=800, height=500")
}
function open_wind(id)
{
 window.open("ist.php?anunt="+id,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=800, height=500")
}
function open_window(id)
{
 window.open("asoc.php?anunt="+id,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=500")
}
function open_windows(id)
{
 window.open("casoc.php?anunt="+id,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=500")
}
function open_cwin(id)
{
 window.open("actualizare_oferte/index.php?anunt="+id,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=800, height=500")
}
function open_edit(id)
{
 	window.open("agentie_actualizare_oferte/index.php?anunt="+id,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=800, height=500")
}
function form(i){
		   var formular = document.getElementById("formular"+i);
		   if(formular.style.display == "block"){
		      formular.style.display = "none";
		   } else {
		      formular.style.display = "block";
		   }
		}
function city(){
		if(!document.getElementById("oras1").checked&&document.getElementById("oras2").checked){
			document.getElementById("bucuresti").style.display="none";
			document.getElementById("ilfov").style.display="block";
			document.getElementById("buc").style.display="none";
			document.getElementById("ilf").style.display="block";
		}else{
			document.getElementById("bucuresti").style.display="block";
			document.getElementById("ilfov").style.display="none";
			if(!document.getElementById("oras1").checked&&!document.getElementById("oras2").checked){
				document.getElementById("buc").style.display="none";
				document.getElementById("ilf").style.display="none";
			}
			if(document.getElementById("oras1").checked&&document.getElementById("oras2").checked){
				document.getElementById("buc").style.display="block";
				document.getElementById("ilf").style.display="block";
			}
			if(document.getElementById("oras1").checked&&!document.getElementById("oras2").checked){
				document.getElementById("buc").style.display="block";
				document.getElementById("ilf").style.display="none";
			}
		}
}

function L(t){
	if('BUCURESTI'==t){
		document.getElementById('loc').value='Bucuresti';
		document.getElementById('loc').readOnly=true;
	}else{
		if(document.getElementById('loc').value.toLowerCase()=='bucuresti')document.getElementById('loc').value='';
		document.getElementById('loc').readOnly=false;
	}
}

function ch(t,s){
	var d=document.getElementById('addag').style;
	if(t.value==s)d.display='block';
	else d.display='none';
}

function add(){
	var d=document.getElementById('addag').style;
	d.display='none';
}

function confirmare(_link,_intrebare) {

	var raspuns = confirm(_intrebare);
	if(raspuns)window.location = _link;
}

function Lx(t){
	if('B'==t){
		document.getElementById('loc').value='Bucuresti';
		document.getElementById('loc').disabled=1;
	}else{
		document.getElementById('loc').value='';
		document.getElementById('loc').disabled=0;
	}
}

function num_form(t,id){
	var r='',i,j=1;
	var x = t.split("");
	for(i=t.length-1;i>=0;i--)if(x[i]!='.'){
		r=x[i]+r;
		if((j%3==0)&&(i>0))r='.'+r;
		j++;
	}
	document.getElementById(id).value=r;
}
function opn(){
	window.open("panou/pdf/upload.php","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=800, height=500");
}

function toTitleCase(str)
{
    return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
}
