function ExpandColapse ( sId ) {
	
	oTarget = document.getElementById ( sId );
	
	if ( oTarget.style.display == 'none' ) oTarget.style.display = 'inline';
		else oTarget.style.display = 'none';

}


function populateCartierz () {
	oSelect = document.getElementById ( 'zona' );
	oCartier = document.getElementById ( 'cartierz' );
	oCartier.value = oSelect.value;
}

function golesteZona() {
	oZonag = document.getElementById( 'marime_22' );
 	oOrasg = document.getElementById( 'marime_12' );
	if(oOrasg.value!='Timisoara') {
		oZonag.selectedIndex=0;
		oZonag.disabled=true;
	}
	else
		oZonag.disabled = false;
}

function golesteZona2() {
	oZonag = document.getElementById( 'zona' );
 	oOrasg = document.getElementById( 'localitate' );
	if(oOrasg.value!='Timisoara') {
		oZonag.selectedIndex=0;
		oZonag.disabled=true;
	}
	else
		oZonag.disabled = false;
}


function isEmail(string) {
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
	else
		return false;
}

function ValidareFormCv() {
 oNume = document.getElementById( 'cv_nume' );
 oEmail = document.getElementById( 'cv_e_mail' );
 oTelefon = document.getElementById( 'cv_telefon' ); 
 oCvFile = document.getElementById( 'CVfile' );

 sMsg_1 = 'Numele este obligatoriu !';
 sMsg_2 = 'Email-ul este obligatoriu !';
 sMsg_5 = 'Telefonul este obligatoriu !'; 
 sMsg_3 = 'Fisierul care contine cv-ul este obligatoriu !';
 sMsg_4 = 'Adresa de mail nu este valida !';
 
 if ( oNume.value == '' ) {
	oNume.value = sMsg_1;
    oNume.style.color = '#ff9122';
 }

 if ( oTelefon.value == '' ) {
	oTelefon.value = sMsg_5;
    oTelefon.style.color = '#ff9122';
 }

if ( oEmail.value == '' ) {
	oEmail.value = sMsg_2;
    oEmail.style.color = '#ff9122';
 } 
 else
  if (!isEmail( oEmail.value )) { 
	oEmail.value = sMsg_4;
    oEmail.style.color = '#ff9122';
  }
  
 bCvFile = true;

 if ( oCvFile.value == '' ) {
 	bCvFile = false;
	oMsgFile = document.getElementById( 'msgfile' );
    oMsgFile.style.color = '#ff9122';
    oMsgFile.style.display = 'inline';	
 }


 if (( oNume.value != sMsg_1 ) && ( oEmail.value != sMsg_2 ) && ( bCvFile != false ) && ( oEmail.value != sMsg_4 )) {
	 document.formular.submit();   	
 }
}

function ResetColor( DivId ) {
    oTarget = document.getElementById( DivId );
	if ( oTarget.style.color == 'rgb(255, 145, 34)' ) oTarget.value = '';
	oTarget.style.color = '#000000';	

}

function ShowDiv( DivId ) {
	oTargetDiv = document.getElementById( DivId );	
    oTargetDiv.style.display = 'inline';
}

function HideDiv( Id1, Id2, Id3 ) {
	oTargetDiv1 = document.getElementById( 'servicii' + Id1 );	
    oTargetDiv1.style.display = 'none';

	oTargetDiv2 = document.getElementById( 'servicii' + Id2 );	
    oTargetDiv2.style.display = 'none';

	oTargetDiv3 = document.getElementById( 'servicii' + Id3 );	
    oTargetDiv3.style.display = 'none';

}

// 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;
}

function init_flash_rpl()
{
	if(typeof sIFR == "function"){
	sIFR.replaceElement(named({nWidth:50,nHeight:40,sSelector:"body h1", sFlashSrc:"/images/h1.swf", sColor:"#5a7079", sEmColor:"#FF6600", sStrongColor:"#FF0000", sSpanColor:"#ff7f0c", sLinkColor:"#ff7f0c", sBgColor:"#fff", sHoverColor:"#575757", sWmode:"transparent"}));
	
	sIFR.replaceElement(named({nWidth:50,nHeight:40,sSelector:"body h2", sFlashSrc:"/images/h2.swf", sColor:"#358fd6", sEmColor:"#FF6600", sStrongColor:"#FF0000", sSpanColor:"#ff7f0c", sLinkColor:"#d6d1cc", sBgColor:"#efefed", sHoverColor:"#ff7f0c", sWmode:"transparent"}));
		
	sIFR.replaceElement(named({nWidth:50,nHeight:40,sSelector:"body h3", sFlashSrc:"/images/h2.swf", sColor:"#5a7079", sEmColor:"#FF6600", sStrongColor:"#FF0000", sSpanColor:"#ff7f0c", sLinkColor:"#d6d1cc", sBgColor:"#efefed", sHoverColor:"#ff7f0c", sWmode:"transparent"}));
		
	};
}

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=545,height=425,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();

	_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 goCalculatorTaxe( sJudet ) {
	
	oSumaIntrodusa = document.getElementById ( 'iSumaIntrodusa' );
	iSumaIntrodusa = oSumaIntrodusa.value;

	if ( iSumaIntrodusa ) {

		oMoneda = document.getElementById ( 'sMoneda' );
		sMoneda = oMoneda.value;
		
		//window.open("http://test24.rm.ro/utile/rmp_calculator_taxe/index.html?iSumaIntrodusa=" + iSumaIntrodusa + "&sMoneda=" + sMoneda + "&sJudet=" + sJudet, "", "toolbar=no,menubar=no,scrollbars=auto,width=550,height=400,resizable=no");	
		window.open("http://www2.imobiliare.ro/utile/rmp_calculator_taxe/index.html?iSumaIntrodusa=" + iSumaIntrodusa + "&sMoneda=" + sMoneda + "&sJudet=" + sJudet, "", "toolbar=no,menubar=no,scrollbars=auto,width=550,height=400,resizable=no");
	} else {
		oMsgErrorDiv = document.getElementById ( 'sMsgDiv' );
		oMsgErrorDiv.style.display = 'inline';
	}
}

function goUtile(tip) {

	_mywnd = window.open("http://www2.imobiliare.ro/utile/index.html?tip="+tip, "", "toolbar=no,menubar=no,scrollbars=auto,width=500,height=400,resizable=no");

	return false;

}

/*---------------- convertor valutar ------------------------------  */
/*-------------------------------------------------------------------*/
/*begin--------------------------------------------------------------*/


// mredkj.com
function NumberFormat(num)
{
this.COMMA = ',';
this.PERIOD = '.';
this.DASH = '-'; 
this.LEFT_PAREN = '('; 
this.RIGHT_PAREN = ')'; 
this.LEFT_OUTSIDE = 0; 
this.LEFT_INSIDE = 1;  
this.RIGHT_INSIDE = 2;  
this.RIGHT_OUTSIDE = 3;  
this.LEFT_DASH = 0; 
this.RIGHT_DASH = 1; 
this.PARENTHESIS = 2; 
this.num;
this.numOriginal;
this.hasSeparators = false;  
this.separatorValue;  
this.inputDecimalValue; 
this.decimalValue;  
this.negativeFormat; 
this.negativeRed; 
this.hasCurrency;  
this.currencyPosition;  
this.currencyValue;  
this.places;
this.setNumber = setNumberNF;
this.toUnformatted = toUnformattedNF;
this.setInputDecimal = setInputDecimalNF; 
this.setSeparators = setSeparatorsNF; 
this.setCommas = setCommasNF;
this.setNegativeFormat = setNegativeFormatNF; 
this.setNegativeRed = setNegativeRedNF; 
this.setCurrency = setCurrencyNF;
this.setCurrencyPrefix = setCurrencyPrefixNF;
this.setCurrencyValue = setCurrencyValueNF; 
this.setCurrencyPosition = setCurrencyPositionNF; 
this.setPlaces = setPlacesNF;
this.toFormatted = toFormattedNF;
this.toPercentage = toPercentageNF;
this.getOriginal = getOriginalNF;
this.getRounded = getRoundedNF;
this.preserveZeros = preserveZerosNF;
this.justNumber = justNumberNF;
this.setInputDecimal(this.PERIOD); 
this.setNumber(num); 
this.setCommas(true);
this.setNegativeFormat(this.LEFT_DASH); 
this.setNegativeRed(false); 
this.setCurrency(true);
this.setCurrencyPrefix('$');
this.setPlaces(2);
}
function setInputDecimalNF(val)
{
this.inputDecimalValue = val;
}
function setNumberNF(num)
{
this.numOriginal = num;
this.num = this.justNumber(num);
}
function toUnformattedNF()
{
return (this.num);
}
function getOriginalNF()
{
return (this.numOriginal);
}
function setNegativeFormatNF(format)
{
this.negativeFormat = format;
}
function setNegativeRedNF(isRed)
{
this.negativeRed = isRed;
}
function setSeparatorsNF(isC, separator, decimal)
{
this.hasSeparators = isC;
if (separator == null) separator = this.COMMA;
if (decimal == null) decimal = this.PERIOD;
if (separator == decimal)
{
this.decimalValue = (decimal == this.PERIOD) ? this.COMMA : this.PERIOD;
}
else
{
this.decimalValue = decimal;
}
this.separatorValue = separator;
}
function setCommasNF(isC)
{
this.setSeparators(isC, this.COMMA, this.PERIOD);
}
function setCurrencyNF(isC)
{
this.hasCurrency = isC;
}
function setCurrencyValueNF(val)
{
this.currencyValue = val;
}
function setCurrencyPrefixNF(cp)
{
this.setCurrencyValue(cp);
this.setCurrencyPosition(this.LEFT_OUTSIDE);
}
function setCurrencyPositionNF(cp)
{
this.currencyPosition = cp
}
function setPlacesNF(p)
{
this.places = p;
}
function toFormattedNF()
{
var pos;
var nNum = this.num; 
var nStr;            
var splitString = new Array(2);   
nNum = this.getRounded(nNum);
nStr = this.preserveZeros(Math.abs(nNum)); 
if (nStr.indexOf(this.PERIOD) == -1)
{
splitString[0] = nStr;
splitString[1] = '';
}
else
{
splitString = nStr.split(this.PERIOD, 2);
}
if (this.hasSeparators)
{
pos = splitString[0].length;
while (pos > 0)
{
pos -= 3;
if (pos <= 0) break;
splitString[0] = splitString[0].substring(0,pos)
+ this.separatorValue
+ splitString[0].substring(pos, splitString[0].length);
}
}
if (splitString[1].length > 0)
{
nStr = splitString[0] + this.decimalValue + splitString[1];
}
else
{
nStr = splitString[0];
}
var c0 = '';
var n0 = '';
var c1 = '';
var n1 = '';
var n2 = '';
var c2 = '';
var n3 = '';
var c3 = '';
var negSignL = (this.negativeFormat == this.PARENTHESIS) ? this.LEFT_PAREN : this.DASH;
var negSignR = (this.negativeFormat == this.PARENTHESIS) ? this.RIGHT_PAREN : this.DASH;
if (this.currencyPosition == this.LEFT_OUTSIDE)
{
if (nNum < 0)
{
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n1 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n2 = negSignR;
}
if (this.hasCurrency) c0 = this.currencyValue;
}
else if (this.currencyPosition == this.LEFT_INSIDE)
{
if (nNum < 0)
{
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n0 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n3 = negSignR;
}
if (this.hasCurrency) c1 = this.currencyValue;
}
else if (this.currencyPosition == this.RIGHT_INSIDE)
{
if (nNum < 0)
{
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n0 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n3 = negSignR;
}
if (this.hasCurrency) c2 = this.currencyValue;
}
else if (this.currencyPosition == this.RIGHT_OUTSIDE)
{
if (nNum < 0)
{
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n1 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n2 = negSignR;
}
if (this.hasCurrency) c3 = this.currencyValue;
}
nStr = c0 + n0 + c1 + n1 + nStr + n2 + c2 + n3 + c3;
if (this.negativeRed && nNum < 0)
{
nStr = '<font color="red">' + nStr + '</font>';
}
return (nStr);
}
function toPercentageNF()
{
nNum = this.num * 100;
nNum = this.getRounded(nNum);
return nNum + '%';
}
function getRoundedNF(val)
{
var factor;
var i;
factor = 1;
for (i=0; i<this.places; i++)
{	factor *= 10; }
val *= factor;
val = Math.round(val);
val /= factor;
return (val);
}
function preserveZerosNF(val)
{
var i;
val = val + '';
if (this.places <= 0) return val; 
var decimalPos = val.indexOf('.');
if (decimalPos == -1)
{
val += '.';
for (i=0; i<this.places; i++)
{
val += '0';
}
}
else
{
var actualDecimals = (val.length - 1) - decimalPos;
var difference = this.places - actualDecimals;
for (i=0; i<difference; i++)
{
val += '0';
}
}
return val;
}
function justNumberNF(val)
{
val = (val==null) ? 0 : val;
var newVal = val + ""; 
var isPercentage = false;
var isFormattedNeg = false;
if (newVal.indexOf('%') != -1)
{
newVal = newVal.replace(/\%/g, '');
isPercentage = true;
}
if (newVal.indexOf(this.DASH) != -1
|| (newVal.indexOf(this.LEFT_PAREN) != -1 && newVal.indexOf(this.RIGHT_PAREN) != -1))
{
newVal = newVal.replace(/[\-\(\)]/g, '');
isFormattedNeg = true;
}
if (this.inputDecimalValue != this.PERIOD)
{
newVal = newVal.replace(/\./g, '');
}
var itrDecimal;
var tempVal = '';
var foundDecimal = false;
for (itrDecimal=0; itrDecimal<newVal.length; itrDecimal++)
{
if (newVal.charAt(itrDecimal) == this.inputDecimalValue)
{
if (foundDecimal)
{
}
else
{
tempVal = tempVal + this.PERIOD;
foundDecimal = true;
}
}
else
{
tempVal = tempVal + newVal.charAt(itrDecimal);
}
}
newVal = tempVal;
if (isFormattedNeg) newVal = '-' + newVal;
if (isNaN(newVal))
{
newVal = parseFloat(newVal.replace(/[^\d\.\-]/g, ''));
newVal = (isNaN(newVal) ? 0 : newVal); 
}
else if (!isFinite(newVal))
{
newVal = 0;
}
if (isPercentage)
{
newVal = newVal / 100;
}
return newVal;
}



function RComma(S) { S = String(S)
  var RgX = /^(.*\s)?([-+\u00A3\u20AC]?\d+)(\d{3}\b)/
  return S == (S=S.replace(RgX, "$1$2,$3")) ? S : RComma(S) 
}


function compute(form){

var valute= new Array(4);

    valute['ron']=1;
    valute['rol']=0.0001;
    valute['usd']=document.trans.curs_usd_lei.value;
    valute['eur']=document.trans.curs_eur_lei.value;

    var temp = 0;
    var rez = 0;
    var POUND = '';
   
	vmi=document.trans.mi.value;
	vmo=document.trans.mo.value;
	vin=document.trans.sin.value;
	vtva=document.trans.tva.checked;
	zecimale=2;
	POUND = '';

	temp=valute[vmi] * vin
	rez=temp / valute[vmo];

    outval=rez;
	if (vtva==true) {
		outval = rez * 1.19
	}
	var numberTest = new NumberFormat(outval);
	numberTest.setCommas(false);
	numberTest.setPlaces(zecimale);
	numberTest.setCurrencyPrefix(POUND);
   
	document.trans.sout.value=RComma(numberTest.toFormatted());
    document.trans.sout.value=RComma(numberTest.toFormatted());
}
