var is_ie = navigator.appName == "Microsoft Internet Explorer";
var is_nav = navigator.appName == "Netscape";
var is_op = navigator.appName == "Opera";

function fetch_object(idname)
{
	if (document.getElementById)
	{
		return document.getElementById(idname);
	}
	else if (document.all)
	{
		return document.all[idname];
	}
	else if (document.layers)
	{
		return document.layers[idname];
	}
	else
	{
		return null;
	}
}

// ---------------------------------------------
function navi__animate(e, t, id)
{
    if (t == 1){
        h = 100;
        bg = 'url(img/navi_exp.gif) no-repeat';
        bg = "url(upload/sections_icons/" + id + ".gif) no-repeat";
    } else {
        h = 41;
        bg = "url(img/navi.gif) no-repeat";
    }
    
    e.style.height = h;
    e.style.background = bg;
}

function estate_list__highlight(h, t, ic)
{
    var bc;
    
    if (t == 1){
        bc = '#d6eeff';
    } else {
        bc = ic;
    }
    
    h.style.background = bc;
}

function estate_list__show_estate(id)
{
    sw = screen.width;
    sh = screen.height;
    
    //w = 800;
    //h = 500;
    
    w = Math.round(sw / 2);
    if (w > 1000 || w < 700){
        w = 900;
    }
    
    h = Math.round(w / 1.4);
    
    url = 'estate__view.php?eid=' + id;
    wname = 'estate_' + id;
    st = 1;
    tool = 0;
    scrolll = 1;
    resize = 1;
    
    window.open(url, wname, 'width=' + w + ', height=' + h + ', status=' + st + ', toolbar=' + tool + ', scrollbars=' + scrolll + ', resizable=' + resize);
}

function estate__photo_enlarge(filename)
{
    h = fetch_object('photo_enlarged');
    
    h.innerHTML = '<img src="http://lif.lv/upload/estate/3/' + filename + '">';
}

function gh_numbers__show_pics(id)
{
    var trid = 'pics_' + id;
    var s1 = 'none';
    var s2;
    var s;
    
    if (is_ie){
         s2 = 'block';
    } else {
        s2 = 'table-cell';
    }
    
    h = fetch_object(trid);
    s = h.style.display;
    
    if (s == s1){
        s = s2;
    } else {
        s = s1;
    }
    //alert(s);
    //return;
    
    h.style.display = s;
}

