<!--

// functii preluate din sablonul HTML

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];}
}

// --sfarsit functii preluate

// functie popup imagine proiect

function ArataImagineProiect(imagine, sx, sy)
{
	if(self._imgwnd != null && !self._imgwnd.closed)
		self._imgwnd.close();
		sx = sx + 50;
		sy = sy + 50;
	/* _imgwnd = window.open("/admin/imagine.html?id="+imagine+"&dim=mare", "_imgwnd", "toolbar=no,menubar=no,scrollbars=no,width=680,height=500,resizable=yes"); */
	//alert("Opening image X = 650, Y = "+sy);
		_imgwnd = window.open("/poza_proiect.html?id="+imagine, "_imgwnd", "toolbar=no,menubar=no,scrollbars=no,width=650,height="+sy+",resizable=yes");
	return false;
}

// functie validare e-mail
function emailCheck (emailStr) {
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) {
		//alert("Email address seems incorrect (check @ and .'s)")
		return false
	}
	var user=matchArray[1]
	var domain=matchArray[2]
	
	if (user.match(userPat)==null) {
		//alert("The username doesn't seem to be valid.")
		return false
	}
	
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
		// this is an IP address
		  for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				//alert("Destination IP address is invalid!")
			return false
			}
		}
		return true
	}
	
	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
		//alert("The domain name doesn't seem to be valid.")
		return false
	}
	
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || 
		domArr[domArr.length-1].length>3) {
		//alert("The address must end in a three-letter domain, or two letter country.")
	   return false
	}
	
	if (len<2) {
	   //var errStr="This address is missing a hostname!"
	   //alert(errStr)
	   return false
	}
	
	return true;
}

// functie popup
function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=200');");
}


function Over(NumeGif)
{
    document[NumeGif].src = eval(NumeGif + "a.src");
}

function Out(NumeGif)
{
    document[NumeGif].src = eval(NumeGif + ".src");
}

if(window.event + "" == "undefined") event = null;
function HM_f_PopUp(){return false};
function HM_f_PopDown(){return false};
popUp = HM_f_PopUp;
popDown = HM_f_PopDown;


HM_PG_MenuWidth = 80;
HM_PG_FontFamily = "Arial";
HM_PG_FontSize = 8;
HM_PG_FontBold = 0;
HM_PG_FontItalic = 0;

function MCPopUp(loc)
{
	newwin=window.open(loc,'Help','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=420,height=400');
}


function AfiseazaFereastraContact(id_oferta) {
	chooser = window.open("../formular_contact_oferta.html?id_oferta="+id_oferta, "chooser", "toolbar=no,menubar=no,scrollbars=yes,screenX=500,screenY=350,width=450,height=400,resizable=yes");
	return false;
}


function TrimiteFormularContact() {
	var form = document.Formular;
	// verific daca au fost introduse campurile obligatorii
	var mesaj = 'Urmatoarele campuri nu au fost completate:\n';
	var linie = '-----------------------------------------------------';
	mesaj += linie + '\n';
	var eroare='';
	if(!form.nume.value) eroare += "Nume\n";
	if(!form.e_mail.value) eroare += "E-mail\n";
	if(!form.telefon.value) eroare += "Telefon\n";
	if(!form.mesaj.value) eroare += "Mesaj\n";
	mesaj = mesaj + eroare + linie;
	
	if(eroare) {
		alert(mesaj);
		return false;
	}
	else {
		form.submit();
		return true;
	}
	
}

function TiparesteOferta(id_oferta) {
	chooser = window.open("../tipareste_oferta.html?id_oferta="+id_oferta, "chooser", "toolbar=no,menubar=no,scrollbars=yes,screenX=700,screenY=350,width=720,height=600,resizable=yes");
	return false;
}

function VerificaCautaId()
{
	if(document.Formular.id_cauta.value=="")
	{
		alert('Va rugam introduceti ID-ul cautat!');
		document.Formular.id_cauta.focus();
		return false;
	}
	else {
		document.Formular.submit();
		return true;
	}
}

function VerificaFiltruAux()
{
	var form = document.formular_filtru_aux;
	if(form.categorie.value!="")
	{
		form.action="/redirect_filtru_mic.html";
		return true;
	}
	else alert("Selectati categoria!");
	return false;
}


function ArataImagineOferta(imagine)
{
	
	if(self._imgwnd != null && !self._imgwnd.closed)
		self._imgwnd.close();
		//alert("opening: " + "/tools/arata_imagine.html?img="+escape(imagine));
	_imgwnd = window.open("/tools/arata_imagine.html?img="+escape(imagine), "_imgwnd", "toolbar=no,menubar=no,scrollbars=auto,width=10,height=10,resizable=no");

	return false;
}



function do_survey_popup(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " =window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=779,height=700,left = 0,top = 0');");
}
//-->
