function closeMenu(element){
     	var selectat;
		var submenu = document.getElementsByClassName('lista_categ');
		  
		for (var i = 0; i < submenu.length; i++){
			submenu[i].style.display = 'none';
		}
		if(selectat != null) selectat.className = '';
		
		selectat = element;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    if (restore) selObj.selectedIndex=0;
}

function clearInput(e){ 
if(e.value=='Cauta in site')e.value=""; 
} 

function open_fereastra(cale,x,y){
        eval("window.open('"+cale+"','','height='+y+',width='+x+',type=fullWindow,alwaysLowered=0,alwaysRaised=1,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,titlebar=0,toolbar=0, z-lock=1,screenX=0,screeny=0,left=10,top=50,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,fullscreen=no')");
}

function open_fereastra_fixa(cale){
eval("window.open('"+cale+"','',' toolbar=no, menubar=no,scrollbars=yes,resizable=no,height=500,width=500,top=10,left=10')");
}

function bookmarksite(title, url) {
                if (document.all)
                        window.external.AddFavorite(url, title);
                else if (window.sidebar)
                        window.sidebar.addPanel(title, url, "");
}

function setHomepage(){
	if (document.all)	{
		document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage('http://www.terenuri-online.net');
	}else
  		alert('Alege optiunea "Options" din meniul "Tools", dupa care optiunea "Main" din sectiunea de taburi. Click pe butonul "Use Current Page"');
}


function open_fereastra_(cale){
eval("window.open('"+cale+"','',' toolbar=no, menubar=no,scrollbars=yes,resizable=no,height=500,width=500,top=10,left=10')");
}

function openw(cale){
            eval("window.open('"+cale+"','',' toolbar=no, menubar=no,scrollbars=yes,resizable=no,height=650,width=550,top=10,left=10')");
}


function openw_poza_prod(cale){
	     eval("window.open('"+cale+"','',' toolbar=no, menubar=no,scrollbars=yes,resizable=no,height=520,width=450,top=10,left=10')");
}


function verifica(_f){
         var eroare="";
         if(document.frm_conditie.ch_accept_conditii.checked==false){
          eroare="Trebuie sa fiti de acord cu Termeni si Conditii !"
         }
         if(eroare=="") return true
         else{
              alert(eroare);
              return false
         }
}

function echeck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		var bun=true; 
		
		if (str.indexOf(at)==-1){
		   bun=false
		}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   bun=false
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    bun=false
		}
		 if (str.indexOf(at,(lat+1))!=-1){
		    bun=false
		 }
		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    bun=false
		 }
		 if (str.indexOf(dot,(lat+2))==-1){
		    bun=false
		 }
		 if (str.indexOf(" ")!=-1){
		    bun=false
		 }
 		 return bun	;}



function verificare_comanda(_f){
         var eroare="";
         
         err= echeck(_f.area_email.value);
         if(err==false) eroare="ATENTIE: Campul EMAIL nu a fost completat corect!"
         
          if(_f.area_email.value==""){
          eroare="ATENTIE: Campul EMAIL nu a fost completat !"
          _f.area_email.focus();
         }
         if(_f.area_telefon.value==""){
          eroare="ATENTIE: Campul TELEFON nu a fost completat !"
          _f.area_telefon.focus();
         }
         if(_f.area_nume.value==""){
          eroare="ATENTIE: Campul NUME nu a fost completat !"
          _f.area_nume.focus();
         }

         if(eroare=="") return true
         else{
              alert(eroare);
              return false
         }
}


function verificare_form(_f){
	         var eroare="";
			 if(_f.area_mesaj.value==""){
	          eroare="ATENTIE: Campul MESAJ nu a fost completat !"
	          _f.area_mesaj.focus();
	         }
	         
	         if(_f.area_mail.value=="") {
	          eroare="ATENTIE: Campul MAIL nu a fost completat !"
	          _f.area_mail.focus();
	         }
	         
	         var emailID=_f.area_mail;
	         if (echeck(emailID.value)==false) eroare="ATENTIE: Campul MAIL nu a fost completat corect!"
	         
	         if(_f.area_nume.value=="") {
	          eroare="ATENTIE: Campul NUME nu a fost completat !"
	          _f.area_nume.focus();
	         }
	         
	         if(eroare=="") return true
	         else{
	              alert(eroare); return false
	         }
}
	



/* galerie poze */
function gal_open_centered(url) {
	w = 700;
	h = 650;
	sw = screen.width;
	sh = screen.height;
	l = (sw - w) / 2;
	t = (sh - h) / 2;
	window.open(url, 'Galerie', 'width='+w+',height='+h+',top='+t+',left='+l+',scrollbars=yes,resizable=no');
}

function galerie_etape(url) {
	w = 800;
	h = 850;
	sw = screen.width;
	sh = screen.height;
	l = (sw - w) / 2;
	t = (sh - h) / 2;
	window.open(url, 'Galerie', 'width='+w+',height='+h+',top='+t+',left='+l+',scrollbars=yes,resizable=no');
}

function gal_open_emagia(url) {
	w = 627;
	h = 650;
	sw = screen.width;
	sh = screen.height;
	l = (sw - w) / 2;
	t = (sh - h) / 2;
	window.open(url, 'Galerie', 'width='+w+',height='+h+',top='+t+',left='+l+',scrollbars=no,resizable=no');
}

function showPic (whichpic) {
	if (document.getElementById) {
		/*document.getElementById('placeholder').src = whichpic.href.replace('thumbs', 'big');*/
		document.getElementById('placeholder').src = whichpic.href;
		document.getElementById('placeholder1').value = whichpic.title;
		if (whichpic.title) {
			document.getElementById('desc').childNodes[0].nodeValue = "alex";
		} else {
			document.getElementById('desc').childNodes[0].nodeValue = "alex";
		}
		return false;
	} else {
		return true;
	}
}
/* galerie poze ends*/
