<!--
var DHTML = 0, DOM = 0, MS = 0, NS = 0, OP = 0;
var gFormVal = "";
var gLayerLockFlag = false;
var gMainNavId = 0;
//var gSubLaySecOldId = 0;
//var gSubArrowFlag = true;


/* DEFINES Brovwser types */
//function DHTML_init() {

 if (window.opera) {
     OP = 1;
 }
 if(document.getElementById) {
   DHTML = 1;
   DOM = 1;
 }
 if(document.all && !OP) {
   DHTML = 1;
   MS = 1;
 }
if(document.layers && !OP) {
   DHTML = 1;
   NS = 1;
 }
//}

//alert(MS)
/*function setFormValue(val) {
//alert(gFormVal)
	gFormVal = val;
} */



function sendSearch(){

    gFormVal = document.thisform.searchexp.value
    if (gFormVal == "" || gFormVal.length <= 2)
    {
		alert(gMsgNoExp)
    } else {
		location.href= gPath + "main.php?db_id=" + gDbIdSearch + "&lang_id=" + gLang_id + "&searchexp=" + gFormVal
	}
}


function sendAppSearch(){

	document.thisform.searchexp.value = document.thisform.appartmentSearch.value
    sendSearch()

}

function findPosX(obj){
	var curleft = 0;
	if (document.getElementById || document.all)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (document.layers) {
		curleft += obj.x;
    }
	    return curleft;
}


function findPosY(obj){
	var curtop = 0;
	if (document.getElementById || document.all)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (document.layers) {
		curtop += obj.y;

    }
	return curtop;
}


function AcButt(id) {
    
    id = getLayerId(id);
    obj = eval(document.getElementById("mntd"+id));
    obj.style.backgroundColor = gArrMainNavbgCol[id];
    sLayPos(id);
}


function IacButt(id) {

    id = getLayerId(id);
    obj = eval(document.getElementById("mntd"+id));
    obj.style.backgroundColor  = gMainNavColIac;
    hLayPos(id);
}


function IacButtSubNav(id) {

    id = getLayerId(id);
    obj = eval(document.getElementById("mntd"+id));
	obj_a = eval(document.getElementById("mnArrowtd"+id));
    obj.style.backgroundColor  = gMainNavColIac;
	obj_a.style.backgroundColor  = gMainNavColIac;
    //hLayPos(id);
}

function AcButtSubNav(id) {
    
    id = getLayerId(id);
    obj = eval(document.getElementById("mntd"+id));
    obj_a = eval(document.getElementById("mnArrowtd"+id))
    obj.style.backgroundColor = gArrMainNavbgCol[gMainNavId];
    obj_a.style.backgroundColor = gArrMainNavbgCol[gMainNavId];
	//unLockMainNav();
	//hSecLayPos();

}

function IacSearch(id){

    obj = eval(document.getElementById(id));
    obj.style.backgroundColor  = "#eeeeee";
}


function AcSearch(id){

    obj = eval(document.getElementById(id));
    obj.style.backgroundColor  = "#ffffff";
}


// Returns layer id whithout prefixes;
function getLayerId(id) {

     id = id.replace( "mntd","");
     id = id.replace( "mna","");
     id = id.replace( "subnav","");
	 id = id.replace( "mnArrowtd","");

     return id;
}

function AcImg(name) {

    document.images[name].src = gPathImgG + "butt_" + name + "_ac.gif";
}

function IacImg(name) {

    document.images[name].src = gPathImgG + "butt_" + name + "_iac.gif";
}


function AcExtImg(name,file) {
	//alert(gPathImgG + "butt_" + file+ "_ac.gif");
	//file="more"
    document.images[name].src = gPathImgG + "butt_" + file+ "_ac.gif";

}

function IacExtImg(name,file) {
//file="more"
    document.images[name].src = gPathImgG + "butt_" + file+ "_iac.gif";
}

/* Hides and shows layer IE 4.x style */
function _ie4xLayer_change(id, status) {

    document.all[id].style.visibility = status;
}



/* Hides and shows layer DOM style */
function _domLayer_change(id, status) {
    
    document.getElementById(id).style.visibility = status;
}


function _NS4xLayer_change (id, status) {

   status == gLv ? status = "show" : status = "hide";
   document.layers[""+id].visibility = status;
}



function _layerVisiChange(id, status) {

        if (DOM && DHTML) {
            
            _domLayer_change(id, status);
        }

        else if (MS && DHTML) {
        
            _ie4xLayer_change(id, status)
        }

	    else if (NS && DHTML) {

			_NS4xLayer_change (id, status)
	    }
}


function hideLayer(id) {
	
	_layerVisiChange(id, gLh);
}


function showLayer(id) {
     
	_layerVisiChange(id, gLv);
}


function sLayPos(id) {
     
	 if (gUnlockMainNav)
	 {
		 omain = eval(document.getElementById("mna" + id));
		 o  = eval(document.getElementById("subnav" + id));
		 o.style.left = findPosX(omain) - 5;
		 o.style.top = 310;

		 showLayer("subnav" + id);
		 gSubLayOldId != 0 ? hideLayer("subnav" + gSubLayOldId) : gSubLayOldId;
		 gSubLayOldId = id;
	 }
}



function sLayNewsPos(id) {
     
	 //if (gUnlockMainNav)
	 //{
		 //omain = eval(document.getElementById("mna" + id));
		 o  = eval(document.getElementById(id));
		 o.style.left = findPosX(o) - 5;
		 o.style.top = 0;

		 showLayer(id);
		 //gSubLayOldId != 0 ? hideLayer("subnav" + gSubLayOldId) : gSubLayOldId;
		 //gSubLayOldId = id;
	 //}
}




function hLayPos(id) {

      if (!gLayerLockFlag)
      {   
        gSubLayOldId = 0;
        hideLayer("subnav" + id);
      }
}



function openPrint() {
   
   var url = gPath + "print.php?db_id=" + gDb_id + "&lang_id=" + gLang_id; 
   w = window.open(url,"Print","width=720,height=540,toolbar=no,scrollbars=yes,menubar=yes")
}


function openRecommend() {

    xpos = ( screen.width / 2 ) - 150  
	ypos = ( screen.height / 2 ) - 125
    

	    w = window.open(gPath + "recommend.php?db_id=" + gDb_id + "&lang_id=" + gLang_id ,"recommend","width=360,height=420,left=" + xpos + ",top=" + ypos);

	w.focus();
}



function openLargeImg(img,width,height) {

    xpos = ( screen.width / 2 ) - 150  
	ypos = ( screen.height / 2 ) - 125
    

	    w = window.open("img_large.php?img_name="+img+"&img_width="+width+"&img_height="+height,"recommend","width="+width+",height="+height+",left=" + xpos + ",top=" + ypos);

	w.focus();
}


function unLockMainNav() {

 gUnlockMainNav = true;

}

function showSecSubNavByArrow(id) {
     
	 if (gUnlockMainNav)
	 {
		 osub = eval(document.getElementById("mnArrowtd" + id));
		 o  = eval(document.getElementById("subnav" + id));
		 o.style.left = findPosX(osub) +16;
		 o.style.top = findPosY(osub)-5;

		 showLayer("subnav" + id);
		 gLayerLockFlag = true;
		 gSubLaySecOldId = id;
	 }
}

function showSecSubNav(id) {
     
	 if (gUnlockMainNav)
	 {
		 osub = eval(document.getElementById("mnArrowtd" + id));
		 o  = eval(document.getElementById("subnav" + id));
		 o.style.left = findPosX(osub) +11;
		 o.style.top = findPosY(osub)-5;
         
		 showLayer("subnav" + id);
		 showLayer("subnav" + gMainNavId);
		 gLayerLockFlag = true;
		 gSubLaySecOldId = id;
	 }
}

function hideSecSubNav(id) {

      if (gSubLaySecOldId == id)
      {   
        hideLayer("subnav" + id );
		hideLayer("subnav" + gMainNavId );
		gLayerLockFlag = false;
      }
}


function showSubNav(id){

		showLayer("subnav" + id);
}


function setMainNavId(id){

		gMainNavId = id;
}


function layerUnlock(){

	gLayerLockFlag = false;
}


var gUnlockMainNav = false;
window.onload = unLockMainNav

//-->