function navigateTo( link ) {	
	window.location.href =link;
}

function OpenLinkIfConfirm( link, message ) {
	var result = confirm(message);
	if( result ) navigateTo( link );
}


function setCookie( cookieName, cookieValue ) {
	var exp = new Date();
	exp.setTime( exp.getTime() + 60*1000);
	var value = cookieName + "=" + escape(cookieValue)+ "; expires="+exp.toGMTString()+"; path=/";	  
	
	document.cookie = value;		
}

function deleteCookie( cookieName )
{
	var cookie_date = new Date ( 1990, 01, 01 );

	var value = cookieName + "=; expires="+cookie_date.toGMTString()+"; path=/";	  
	document.cookie = value;
}


var browserType;
if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {browserType= "gecko"}

function getObject(id_name) {
	var strE = "document.getElementById('"+id_name+"')";
	var strS = "document.all['"+id_name+"']";
	var strP = "document.layers['"+id_name+"']";
	
	if (browserType == "gecko" ) document.poppedLayer = eval(strE);
    else if (browserType == "ie") document.poppedLayer = eval(strS);
    else document.poppedLayer = eval(strP);
	return document.poppedLayer; 
}

function hideDIV(id_name) {	
    var pLayer = getObject(id_name);
    if( pLayer.style.visibility == "hidden") return;
   
    pLayer.style.visibility = "hidden";
    pLayer.style.position = "absolute";    
}


function showDIV(id_name) {		
    var pLayer = getObject(id_name);
    if( pLayer.style.visibility == "visible") return;
    
    pLayer.style.visibility = "visible";
    pLayer.style.position = "";    
}


function reloadDiv( divName, link ) {
	var div = getObject( divName );
	if( !div ) return false;
	
	var content = getLinkContent( link );
	if( !content) return false;
		
	div.innerHTML = content;
}


function getLinkContent( link ) {
	var http_request = false; 
	if(window.XMLHttpRequest) http_request=new XMLHttpRequest();
	else if (window.ActiveXObject) http_request = new ActiveXObject("Microsoft.XMLHTTP");	
	if( !http_request ) return false; 
	
	window.status = "Please wait...";
	http_request.open('GET', link, false); 
	http_request.send("empty"); 
	window.status = ""; 
	
	if (http_request.readyState == 4 && http_request.status == 200 ) return http_request.responseText; 
	else return false;
}

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement &&
      ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

function hideHint( obj ) { obj.style.cursor = 'default'; hideDIV("divHint"); }

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false
// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var mouseX = 0
var mouseY = 0

// Main function to retrieve mouse x-y pos.s
function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    mouseX = event.clientX + document.body.scrollLeft
    mouseY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    mouseX = e.pageX
    mouseY = e.pageY
  }  

  return true
}

function showHint( obj, htmlText ) {
	var hintDiv = getObject( "divHint" );
	if( !hintDiv )  return;
	
	var s = "<table cellpadding=1 cellspacing=1> <tr><Td bgcolor=white><table cellpadding=2 cellspacing=1 bgcolor='#9d8777'><tr><Td style='font-size:9px; font-family:verdana;color:white;'>&nbsp; <b>Informacija</b></TD></tr><tr bgcolor=white><td>";
	hintDiv.innerHTML = s + htmlText + "</td></tr></table></TD></tr></table>";
	
	hintDiv.style.visibility = "visible";
	hintDiv.style.position = "absolute";
		
	obj.style.cursor = 'help';
	
	//var e = obj;
	
	hintDiv.style.left = mouseX;
	hintDiv.style.top  = mouseY+10;
	
}