var count=0;
var zindex=0;

function show_bar(ev,win,img) {	
if(document.getElementById(win).style.visibility!="visible")
{
	zindex++;
	document.getElementById("pusto").style.height="180px";
	obj = document.getElementById(win);
	obj.style.zIndex=zindex;
	var r=getOtnPos(document.getElementById(img),document.getElementById(win));
	obj.style.top=r.y+44+"px";
	obj.style.left=r.x+85+"px";
	obj.style.visibility = "visible";
	
	count=count+1;
}
else
{
	count=count-1;
	if (count==0) document.getElementById("pusto").style.height="26px";
	document.getElementById(win).style.visibility="hidden";
	document.getElementById(win).style.top="-100px";
}
}

function hide_bar(win) {
count=count-1;
document.getElementById(win).style.visibility="hidden";
document.getElementById(win).style.top="-100px";
if (count==0) document.getElementById("pusto").style.height="26px";
}

function getAbsPos(p) 
{
    var s = { x:0, y:0 };
    while (p.offsetParent) {
         s.x += p.offsetLeft;
         s.y += p.offsetTop;
         p = p.offsetParent;
    }
    return s;
}

function getOtnPos(p,d) {
    var s = { x:0, y:0 };
    while (p!=d.offsetParent) {
         s.x += p.offsetLeft;
         s.y += p.offsetTop;
         p = p.offsetParent;
    }
    return s;
}