// JavaScript Document


//miniss.js
var markedRow = new Array();
function setPointer(theRow, thePointerColor, theNormalBgColor)
{
var theCells = null;
if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
return false;
}
if (typeof(document.getElementsByTagName) != 'undefined') {
theCells = theRow.getElementsByTagName('td');
}
else if (typeof(theRow.cells) != 'undefined') {
theCells = theRow.cells;
}
else {
return false;
}
var rowCellsCnt = theCells.length;
var currentColor = null;
var newColor   = null;
// Opera does not return valid values width "getAttribute"
if (typeof(window.opera) == 'undefined'
&& typeof(theCells[0].getAttribute) != 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') {
currentColor = theCells[0].getAttribute('bgcolor');
newColor   = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
? theNormalBgColor
: thePointerColor;
for (var c = 0; c < rowCellsCnt; c++) {
theCells[c].setAttribute('bgcolor', newColor, 0);
} // end for
}
else {
currentColor = theCells[0].style.backgroundColor;
newColor   = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
? theNormalBgColor
: thePointerColor;
for (var c = 0; c < rowCellsCnt; c++) {
theCells[c].style.backgroundColor = newColor;
}
}

return true;
}

// meniu.js

var	d = document;
PreloadImages();
function	PreloadImages()
{	d.imgMaxMin = new Array();
d.imgStick = new Array();
d.imgMaxMin[0] = new Image;	d.imgMaxMin[0].src="http://static.imobiliarebaiamare.ro/images/basic/bArata.gif";
d.imgMaxMin[1] = new Image;	d.imgMaxMin[1].src="http://static.imobiliarebaiamare.ro/images/basic/bAscunde.gif";
d.imgStick[0] = new Image;	d.imgStick[0].src="http://static.imobiliarebaiamare.ro/images/basic/bArata.gif";
d.imgStick[1] = new Image;	d.imgStick[1].src="http://static.imobiliarebaiamare.ro/images/basic/bAscunde.gif";
}
function	SwapState(row, img)
{
if(row.style.display == "none")	row.style.display="";
else	row.style.display="none";
if(img.src == d.imgMaxMin[0].src)	img.src = d.imgMaxMin[1].src;
else img.src = d.imgMaxMin[0].src;
return false;
}
function	GlueRegion(img)
{
if(img.src == d.imgStick[0].src) {
img.src = d.imgStick[1].src;
}
else {
img.src = d.imgStick[0].src;
}
return false;
}
function SeteazaActiune(sw)
{
if(sw==1)
{
var _tip_cautare = document.FormRedirectare.tip_cautare;
document.FormRedirectare.action = "motor/cautare/"+_tip_cautare.value+"/filtru.php";
}
if(sw==2)
{
document.FormRedirectareCautareId.action = "cauta_oferta.php";
}
}

// alege_zona.js


function AfiseazaFereastra(tip){
if (self.chooser != null && !self.chooser.closed) self.chooser.focus();
else{
if (tip == 4) {
window.open('/motor/judete.php','WChooser','toolbar=no,menubar=no,scrollbars=yes,width=200,height=450,resizable=no');			
}
if (tip == 1) {	
if(document.ifield.judet_hid.value==''){	alert("@L_ALEGE_JUD@");	}			
else {window.open('/motor/localitati.php?judet='+escape(document.ifield.judet_hid.value)+'','WChooser','toolbar=no,menubar=no,scrollbars=yes,width=200,height=450,resizable=no');}
}
if(tip == 2) {
if(document.ifield.oras_hid.value==''){	alert("@L_ALEGE_LOC@");	}
else {window.open("/motor/cartiere.php?oras="+escape(document.ifield.oras_hid.value),'WChooser','toolbar=no,menubar=no,scrollbars=yes,width=200,height=450,resizable=no');}
}
if(tip == 3) {
if(document.ifield.cartier_hid.value==''){	alert("@L_ALEGE_CART@");	}
else chooser = window.open("../motor/zone.php?cartier="+escape(document.ifield.cartier_hid.value), "WChooser", "toolbar=no,menubar=no,scrollbars=yes,width=200,height=300,resizable=yes");
chooser.ifield = ifield;
//chooser.focus();
}
}

}

function AfiseazaFereastraFrom(tip,from){

if (self.chooser != null && !self.chooser.closed) self.chooser.focus();
else{
if (tip == 4) window.open('/motor/judete.php?from='+from,'WChooser','toolbar=no,menubar=no,scrollbars=yes,width=200,height=450,resizable=no');
if (tip == 1) {	
if(document.ifield.judet_hid.value==''){	alert("@L_ALEGE_JUD@");	}			
else {window.open('/motor/localitati.php?from='+from+'&judet='+escape(document.ifield.judet_hid.value)+'','WChooser','toolbar=no,menubar=no,scrollbars=yes,width=200,height=450,resizable=no');}
}
if(tip == 2) {
if(document.ifield.oras_hid.value==''){	alert("@L_ALEGE_LOC@");	}
else {window.open("/motor/cartiere.php?from="+from+"&oras="+escape(document.ifield.oras_hid.value),'WChooser','toolbar=no,menubar=no,scrollbars=yes,width=200,height=450,resizable=no');}
}
if(tip == 3) {			
if(document.ifield.cartier_hid.value==''){	alert("@L_ALEGE_CART@");	}
else chooser = window.open("../motor/zone.php?cartier="+escape(document.ifield.cartier_hid.value), "WChooser", "toolbar=no,menubar=no,scrollbars=yes,width=200,height=300,resizable=yes");
chooser.ifield = ifield;			
}
}
}


function openIT(id) {
window.open(id,"_blank", "height=800,width=600,status=no,toolbar=no,menubar=no,location=no");
}

function confirm_del(mesaj){
conf = confirm(mesaj);
if (conf) return true;
else return false;
}

function ShowFilters(){
if (document.getElementById('moreFilters').style.display=="block"){
document.getElementById('moreFilters').style.display="none";
document.getElementById('plusFilters').style.display="block";
document.getElementById('minusFilters').style.display="none";
document.getElementById('plus_filters_hid').value="1";
}else{
document.getElementById('moreFilters').style.display="block";
document.getElementById('plusFilters').style.display="none";
document.getElementById('minusFilters').style.display="block";
document.getElementById('plus_filters_hid').value="0";
}
}
