<!--

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

/**
 * Ascunde sau arata un DIV identificat prin id-ul DivId
 * - caracteristici DivId : 
 *   + daca se doreste ca starea initiala sa fie 'inchisa' : class="maximizat" style="display:none"
 *   + daca se doreste ca starea initiala sa fie 'deschisa' : class="minimizat" style="display:inline"
 */

function ShowHideDiv( DivId ) {
	oTargetDiv = document.getElementById( DivId );	
    if ( oTargetDiv.className == 'minimizat' ) {
        oTargetDiv.style.display = 'none';
        oTargetDiv.className = 'maximizat';
    }
    else  {
        oTargetDiv.style.display = 'inline';
        oTargetDiv.className = 'minimizat';
    }

}

function init_flash_rpl()
{
	if(typeof sIFR == "function"){		
		sIFR.replaceElement(named({sSelector:"h2", sFlashSrc:"/images/gillsans.swf", sColor:"#212121", sWmode: "transparent"}));
		sIFR.replaceElement(named({sSelector:"h4", sFlashSrc:"/images/gillsans.swf", sColor:"#980f11", sWmode: "transparent"}));
	};
}

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];}
}


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+"&afisare_detalii=1", "chooser", "toolbar=no,menubar=no,scrollbars=yes,screenX=700,screenY=350,width=720,height=800,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();

	_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 SelectCriteriuOrdonare(frm) {

	if(frm.criteriu_ordonare.value!="") {
		frm.submit();
	}
}

function SelectTipOrdonare(frm) {

	if(frm.tip_ordonare.value!="") {
		frm.submit();
	}
}

function getkey(e)
{
if (window.event)
   return window.event.keyCode;
else if (e)
   return e.which;
else
   return null;
}

function goodchars(e, goods)
{

var key, keychar;
key = getkey(e);
if (key == null) return true;

// get character
keychar = String.fromCharCode(key);
keychar = keychar.toLowerCase();
goods = goods.toLowerCase();

// check goodkeys
if (goods.indexOf(keychar) != -1)
	return true;

// control keys
if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
   return true;

// else return false
return false;
}

//-->

function goUtile(tip) {
	_mywnd = window.open("http://www.imobiliare.ro/utile/index.html?tip="+tip, "", "toolbar=no,menubar=no,scrollbars=auto,width=500,height=400,resizable=no");

	return false;

}

function getSize() {
	parent.resizeiframe(document.body.scrollHeight + 10) ;
	//alert("resized");
}

function get_hostname(url) {
	return url.match(/:\/\/(.[^/]+)/)[1];
} 

function replaceAll(search, replace, subject){
 var newUrl = subject;
 while (newUrl.search(search) != -1){
   newUrl = newUrl.replace(search, replace);
   //alert(newUrl);
  }
 return newUrl; 
}

function DisplayFrame(){
 var currentUrl = parent.document.location.href;
 //alert(currentUrl);
 //var pos = currentUrl.search(/anunturi/i);
 if (get_hostname(currentUrl)=="anunturi.sedako.ro"){
  //we redirect it
  var newUrl = currentUrl;
  newUrl = replaceAll("/", "*", newUrl);
  
  var arr = new Array();
  arr = newUrl.split("?");
  newUrl = arr.join("^");
  
  newUrl = replaceAll("&", "~", newUrl);
  
  window.location.href = "http://www.sedako.ro/pages/addp/url/" + newUrl;
 } 
}



