function getElementPosition(elemID) {
	var offsetTrail = document.getElementById(elemID);
	var offsetLeft = 0;
	var offsetTop = 0;
	
	while (offsetTrail) {
	    offsetLeft += offsetTrail.offsetLeft;
	    offsetTop += offsetTrail.offsetTop;
	    offsetTrail = offsetTrail.offsetParent;
	}
	
	if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined") {
	    offsetLeft += document.body.leftMargin;
	    offsetTop += document.body.topMargin;
	}
	
	return {left:offsetLeft, top:offsetTop};
}
function hide(me) { 
	obj=document.getElementById(me);
	var d=document.getElementById(me).style.display;
	if(d=="none") d="";	else d="none";
	document.getElementById(me).style.display=d;
}
function desniKlikMeni(parent_id, e) {
	if (browserName=="Microsoft Internet Explorer") {
		pos_x = event.clientX-4;
		pos_y = event.clientY-4;
	} else {
		pos_x = e.clientX-4;
		pos_y = e.clientY-4;		
	}
			
	var meni = document.getElementById("r_meni")
	
	tmp=getElementPosition(parent_id);
	meni.style.position = "absolute";
	
	meni.style.top = pos_y;
	meni.style.left = pos_x;
		
	meni.style.display="";		
}

function meniUp(el,mm)
{
	document.getElementById(mm).className="meniUp";
	el.className="meniShadow";
}
function meniDown(el,mm)
{
	document.getElementById(mm).className="meniDown";
	el.className="meniCell";
}
function meniPush(el,mm)
{
	document.getElementById(mm).className="meniPush";
	el.className="meniCell";
}
function findPosX(obj)
{
var curleft = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (obj.x)
curleft += obj.x;
return curleft;
}

function findPosY(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)
curtop += obj.y;
return curtop;
}


function openpopup(popurl,w,h){
  w=w+20;
  h=h+30;
  sx=(screen.width-w)/2;
  sy=(screen.height-h)/2;
  opt="width=" + w + ",height=" + h + ",ScreenX=" + sx + ",ScreenY=" + sy + ",left=" + sx + ",top=" + sy + "toolbar=1,location=0,directories=0,status=0,scrollbars=0,menubar=0,resizable=1";
  nw=window.open(popurl,"wwww",opt);
}

function verify() 
{
	var conf = window.confirm("Jeste li sigurni?");
	if(!conf) {
	    return false;
	}
	else {
	    return true;
	}
}

