function getCoords(obj)
{ 
        var left=0,top=0;
        while(obj)
        { 
                left+=obj.offsetLeft-obj.scrollLeft;
                top+=obj.offsetTop-obj.scrollTop;
                if(obj.style.borderTopWidth!='')
                        top+=parseInt(obj.style.borderTopWidth);
                if(obj.style.borderLeftWidth!='')
                        left+=parseInt(obj.style.borderLeftWidth);

                obj=obj.offsetParent; 
        }

        return {x:left,y:top};
}

/*
function smart_image_popup (url, w, h)
{
	var id = "image_"+(Math.floor(Math.random()*1000000));
	var w = (parseInt(w)+40);
	var h = (parseInt(h)+40);

	var w = window.open(url, id, "width="+w+",height="+h+",resizable,status,location,scrollbars,menubar");
	if (!w) return true;

	w.focus();
	return false;
}
*/

var openVideo = Array();

function showVideo(id, obj)
{
	var c = getCoords(obj)
	var el = document.getElementById("file"+id);
	var txt = document.getElementById("filehref"+id);

        if (openVideo[id] == 1)
        {
		el.style.display='none';
		openVideo[id] = 0;
		txt.innerHTML = 'Смотреть';
        }else
        {
                //alert(obj.top); return false;
		el.style.top = c.y - 370;
		el.style.left = c.x;
		el.style.display='block';
		openVideo[id] = 1;
		txt.innerHTML = 'Закрыть';
	}
	return false;
}
