//***functii generale
function inchiriere(){
document.getElementById('image').style.background="url(images/tit_cautare_1.gif) repeat-y";
document.getElementById('tab_inchiriere').style.display="block"
document.getElementById('tab_vanzare').style.display="none"
}

function vanzare(){
document.getElementById('image').style.background="url(images/tit_cautare_2.gif) repeat-y";
document.getElementById('tab_inchiriere').style.display="none"
document.getElementById('tab_vanzare').style.display="block"
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}






//******functii in site
function MM_jumpMenu(targ,selObj,restore){ //v3.0
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    if (restore) selObj.selectedIndex=0;
}

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 openw(cale){
            eval("window.open('"+cale+"','',' toolbar=no, menubar=no,scrollbars=yes,resizable=no,height=800,width=860,top=0,left=0')");
}


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 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 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_oferta(_f){
         var eroare="";
         
         if(_f.txt_telefon.value==""){
          eroare="ATENTIE: Campul TELEFON nu a fost completat !"
          _f.txt_telefon.focus();
         }
         err= echeck(_f.txt_email.value);
         if(err==false) eroare="ATENTIE: Campul EMAIL nu a fost completat corect!"
         
          if(_f.txt_email.value==""){
          eroare="ATENTIE: Campul EMAIL nu a fost completat !"
          _f.txt_email.focus();
         }
         
         if(_f.txt_nume.value==""){
          eroare="ATENTIE: Campul NUME nu a fost completat !"
          _f.txt_nume.focus();
         }
         if(_f.txt_zona.value==""){
          eroare="ATENTIE: Campul ZONA nu a fost completat !"
          _f.txt_zona.focus();
         }

         if(eroare=="") return true
         else{
              alert(eroare);
              return false
         }
}


/* galerie poze */
function gal_open_centered(url) {
	w = 800;
	h = 750;
	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 = whichpic.title;
		} else {
			document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
		}
		return false;
	} else {
		return true;
	}
}
/* galerie poze ends*/
