/////////////////////////////////////////////////////////////////////////////////
//
// ZZJZCK Javascript
//
// (c)2005-2008 by Abacus, info (at) abacus.hr
//
// v1.06 8.5.2009. DSalopek
//
/////////////////////////////////////////////////////////////////////////////////

//-------------------------------------------------------------------------------
//
// globalne varijable
//
//-------------------------------------------------------------------------------

var xMENU='NAS';
var xWSPCID=978;
var xNS = (navigator.appName.indexOf("Netscape") != -1);
var xDOC = document;
var xAJAXURI;

//-------------------------------------------------------------------------------
//
// status
//
//-------------------------------------------------------------------------------

window.defaultStatus='ZAVOD ZA JAVNO ZDRAVSTVO MEĐIMURSKE ŽUPANIJE';

function S(Msg) {
  if (Msg!='') { Msg='ZAVOD ZA JAVNO ZDRAVSTVO MEĐIMURSKE ŽUPANIJE: '+Msg }
  window.status=Msg;
  return(true);
}


//-------------------------------------------------------------------------------
//
// AJAX
//
//-------------------------------------------------------------------------------

function ajaxEvaluate (pTXT) {
  var rSCRIPT = new RegExp('(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)', 'img');
  var tSCRIPT = '';
  while (tSCRIPT = rSCRIPT.exec(pTXT)) { eval(tSCRIPT[1]) }
}

function getDataReturnText (pURL, pTAG) { 
  var XMLHttpRequestObject = false; 
  if (window.XMLHttpRequest) {
    XMLHttpRequestObject = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    XMLHttpRequestObject = new 
     ActiveXObject("Microsoft.XMLHTTP");
  }

  if(XMLHttpRequestObject) {
    XMLHttpRequestObject.open('GET', pURL+'&DUMMY='+new Date().getTime()); 

    XMLHttpRequestObject.onreadystatechange = function() 
    { 
      if (XMLHttpRequestObject.readyState == 4 && 
        XMLHttpRequestObject.status == 200) { 
          ajaxCallback(XMLHttpRequestObject.responseText, pTAG);
          delete XMLHttpRequestObject;
          XMLHttpRequestObject = null;
      } 
    } 

    XMLHttpRequestObject.send(null); 
  }
}


function ajaxCallback (pTXT,pTAG) {
  ajaxEvaluate(pTXT);
  if (pTAG==undefined) { 
    pTAG='BODY';
    if (xAJAXURI) {
      getDataReturnText('?JSRS=STRANA-RIGHT&'+xAJAXURI,'STRANA-RIGHT');
      getDataReturnText('?JSRS=MENU-TOP&'+xAJAXURI,'MENU-TOP');
    }
  }
  rNAVIG=/^<NAVIGATOR>(.*?)<\/NAVIGATOR>/m;
  var NAVIG=rNAVIG.exec(pTXT);
  if (NAVIG) {
    pTXT=pTXT.replace(rNAVIG,'');
  }
  if (xDOC.getElementById(pTAG)) { xDOC.getElementById(pTAG).innerHTML=pTXT; DekodirajURI(); }
  if (xDOC.getElementById('NAVIGATOR')) { xDOC.getElementById('NAVIGATOR').innerHTML=NAVIG[1] }
  if (xDOC.getElementById('vmarquee')) { initializemarquee() }
  if (pTAG=='BODY') { document.body.scrollTop=0; if (document.getElementById('navbar')) { sfHover(); } }

}


function Update(pTAG,pURI) {
  if (pTAG=='BODY') { 
    xURI=pURI;
    getDataReturnText('?JSRS=STRANA-RIGHT&'+pURI,'STRANA-RIGHT');
    getDataReturnText('?JSRS=MENU-TOP&'+pURI,'MENU-TOP');
    xSAL.PassAjaxResponseToFunction('?JSRS='+pTAG+'&'+pURI+'&DUMMY='+new Date().getTime(),'ajaxCallback');
  }
  else { getDataReturnText('?JSRS='+pTAG+'&'+pURI,pTAG) }
}


function encodeHtml(pTXT) {
  var tRET=escape(pTXT);
  tRET=tRET.replace(/&/g, '%26');
  tRET=tRET.replace(/\//g,'%2F');
  tRET=tRET.replace(/=/g, '%3D');
  tRET=tRET.replace(/\?/g,'%3F');
  tRET=tRET.replace(/@/g, '%40');
  return(tRET);
} 


function getElementFormValues(pE) {
  var uri='';
  var rTAG=/^(TABLE|TBODY|TR|TD|NOBR|CENTER|DIV|BR|A|SPAN|LABEL|FIELDSET|H1|H2)$/;
  for (var i=0; i<pE.childNodes.length; i++) {
    var NODE=pE.childNodes[i];
    if (rTAG.test(NODE.tagName))  { uri+=getElementFormValues(NODE) }
    if (NODE.name) {
      if (NODE.tagName=='INPUT') {
        if (NODE.type=='text')      { uri+=NODE.name+'='+encodeHtml(NODE.value)+'&' }
        if (NODE.type=='password')  { uri+=NODE.name+'='+encodeHtml(NODE.value)+'&' }
        if (NODE.type=='hidden')    { uri+=NODE.name+'='+encodeHtml(NODE.value)+'&' }
        if (NODE.type=='checkbox')  { if (NODE.checked) { uri+=NODE.name+'='+encodeHtml(NODE.value)+'&' } }
        if (NODE.type=='radio')     { if (NODE.checked) { uri+=NODE.name+'='+encodeHtml(NODE.value)+'&' } }
      }
      else if (NODE.tagName=='TEXTAREA') { uri+=NODE.name+'='+encodeHtml(NODE.value)+'&' }
      else if (NODE.tagName=='SELECT')   { uri+=NODE.name+'='+encodeHtml(NODE.options[NODE.selectedIndex].value)+'&' }
    }
  }
  return(uri);
}

function UpdateForm(pTAG,pFORMID) {
  var tURI=getElementFormValues(getO(pFORMID));
  Update(pTAG,tURI);
}

///////////////////////////////////////////////////////////////////////////////////
//
// vracanje vrijednosti polja u dokumentu
//
///////////////////////////////////////////////////////////////////////////////////

function getSelectValue (ID) {
  var SEL=eval('xDOC.FOR.'+ID);
  if (SEL && SEL.selectedIndex>=0) { return(SEL.options[SEL.selectedIndex].value) }
  return('')
}

function getValue(ID) {
  var SEL='';
  if (ID && ID.selectedIndex) { SEL=ID }
  else { SEL=xDOC.getElementById(ID) }
  if (SEL && SEL.selectedIndex>=0) { return(SEL.options[SEL.selectedIndex].value) }
  return('')
}

function getS(pID) {
  var tSEL=xDOC.getElementById(pID);
  if (tSEL && tSEL.selectedIndex>=0) { return(tSEL.options[tSEL.selectedIndex].value) }
  return('')
}

function getT(pID) {
  var tTXT=xDOC.getElementById(pID);
  if (tTXT) { return(tTXT.value) }
  return('')
}

function getO(pID) {
  return(xDOC.getElementById(pID))
}

//-------------------------------------------------------------------------------
//
// dekodiranja E-mailova
//
//-------------------------------------------------------------------------------

function DekodirajURI() {
  if (!xDOC.getElementsByTagName && !xDOC.createElement && !xDOC.createTextNode) return;
  var cvorovi=xDOC.getElementsByTagName('span');
  for(var i=cvorovi.length-1;i>=0;i--) {
    if (cvorovi[i].className=='DECODE') {
      var na=/ \(na\) /;
      var tocka=/ \(tocka\) /g;
      var cvor=xDOC.createElement('a');
      var URI=cvorovi[i].firstChild.nodeValue;

      URI = URI.replace(na,'@');
      URI = URI.replace(tocka,'.');
      cvor.setAttribute('href','mailto:'+URI);
      cvor.setAttribute('className','LINK');
      cvor.setAttribute('class','LINK');
      cvor.appendChild(xDOC.createTextNode(URI));
      
      var ispis = cvorovi[i].parentNode;
      for(var j=0;j<ispis.childNodes.length;j++)
        if (ispis.childNodes[j] == cvorovi[i]) {
          if (!ispis.replaceChild) return;
          ispis.replaceChild(cvor,ispis.childNodes[j]);
          break;
        }
    }
  }
}

//-------------------------------------------------------------------------------
//
// provjera formi
//
//-------------------------------------------------------------------------------

function CheckForm(form,name) {
    var email=/[\w\-\.]+\@[\-\w\.]+\.[\w\-\.]{2,4}/;
    var ime=/[\w\.]+.*\s+.*[\w\.]+/;
    var prazno=/[\d\w]+/;
    var captcha=/^[\d]{5}$/;
    if (name=='LIN') {
      if (!captcha.test(form.LIN_CODE.value)) {
        alert('Niste upisali kontrolni kod!');
        form.LIN_CODE.focus();
        return(false);
      }
      else if (!ime.test(form.IME.value)) {
        alert('Niste upisali ime i prezime!');
        form.IME.focus();
        return(false);
      }
      else if (!email.test(form.EPO.value)) {
        alert('Niste upisali ispravni E-mail!');
        form.EPO.focus();
        return(false);
      }
      else if (!email.test(form.EPR.value)) {
        alert('Niste upisali ispravni E-mail!');
        form.EPR.focus();
        return(false);
      }
    }
    
    // prijava rezulatat pješke ili biciklom na posao
    
    else if (name=='PRI') {
      if (!captcha.test(form.PRI_CODE.value)) {
        alert('Niste upisali ispravni kontrolni kod!');
        form.PRI_CODE.focus();
        return(false);
      }
      else if (!ime.test(form.IME.value)) {
        alert('Niste upisali ime i prezime sudionika!');
        form.IME.focus();
        return(false);
      }
      else if (!checkRadio(form.KAT)) {
        alert('Niste odabrali kategoriju!');
        return(false);
      }
      else if (!prazno.test(form.ULI.value)) {
        alert('Niste upisali ulicu stanovanja!');
        form.ULI.focus();
        return(false);
      }
      else if (!prazno.test(form.MJE.value)) {
        alert('Niste upisali mjesto stanovanja!');
        form.MJE.focus();
        return(false);
      }
      else if (!prazno.test(form.TEL.value)) {
        alert('Niste upisali Telefon!');
        form.TEL.focus();
        return(false);
      }
      else if (!email.test(form.EMA.value)) {
        alert('Niste upisali ispravni E-mail sudionika!');
        form.EMA.focus();
        return(false);
      }
      else if (!prazno.test(form.ZAN.value)) {
        alert('Niste upisali zanimanje!');
        form.ZAN.focus();
        return(false);
      }
      else if (!prazno.test(form.GRO.value)) {
        alert('Niste upisali godinu rođenja!');
        form.GRO.focus();
        return(false);
      }
      else if (!checkRadio(form.SPO)) {
        alert('Niste odabrali spol!');
        return(false);
      }
      else if (!prazno.test(form.TVR.value)) {
        alert('Niste upisali naziv tvtke ili ustanove!');
        form.TVR.focus();
        return(false);
      }
      else if (!prazno.test(form.ADP.value)) {
        alert('Niste upisali adresu tvtke ili ustanove!');
        form.ADP.focus();
        return(false);
      }
      else if (!prazno.test(form.KM1.value)) {
        alert('Niste upisali udaljenost od mjesta stanovanja do posla!');
        form.KM1.focus();
        return(false);
      }
      else if (!prazno.test(form.KM2.value)) {
        alert('Niste upisali ukupan broj prijeđenih kilometara!');
        form.KM2.focus();
        return(false);
      }
      else if (!prazno.test(form.DOL.value)) {
        alert('Niste upisali kako obicno dolazite na posao!');
        form.DOL.focus();
        return(false);
      }
      else if (!ime.test(form.SVJ.value)) {
        alert('Niste upisali ime i prezime svjedoka!');
        form.SVJ.focus();
        return(false);
      }
      else if (!prazno.test(form.TES.value)) {
        alert('Niste upisali telefon svjedoka!');
        form.TES.focus();
        return(false);
      }
      
    }
    
    else {
      if (!captcha.test(form.KON_CODE.value)) {
        alert('Niste upisali kontrolni kod!');
        form.KON_CODE.focus();
        return(false);
      }
      else if (!ime.test(form.IME.value)) {
        alert('Niste upisali ime i prezime!');
        form.IME.focus();
        return(false);
      }
      else if (!email.test(form.EMA.value)) {
        alert('Niste upisali ispravni E-mail!');
        form.EMA.focus();
        return(false);
      }
      else if (!prazno.test(form.TEM.value)) {
        alert('Niste upisali temu poruke!');
        form.TEM.focus();
        return(false);
      }
      else if (!prazno.test(form.POR.value)) {
        alert('Niste upisali tekst poruke!');
        form.POR.focus();
        return(false);
      }
    }
    return(true);
}


///////////////////////////////////////////////////////////////////////////////////
//
// vraca vrijednost izabrane radio opcije, ako nista nije vraca prazno
//
///////////////////////////////////////////////////////////////////////////////////

function checkRadio(RADIO) {
  var tVALUE='';
  for (var tI=0;tI<RADIO.length;tI++) {
    if (RADIO[tI].checked) { tVALUE=RADIO[tI].value }
  }
  return(tVALUE);
}


//-------------------------------------------------------------------------------
//
//  WSP Capcha zastita formula
//
//-------------------------------------------------------------------------------

function WSPCaptcha(ID) {
  if (!ID) { ID='WSP' }
  var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
  var wsp_key_length = 32;
  var wsp_key = '';
  for (var i=0; i<wsp_key_length; i++) {
    var rnum = Math.floor(Math.random() * (chars.length-1));
    wsp_key += chars.substring(rnum, rnum+1);
  }
  xDOC.getElementById(ID+'_CAPTCHA').src = 'http://webspamprotect.com/captcha.php?id=' + xWSPCID + '&key=' + wsp_key;
  xDOC.getElementById(ID+'_KEY').value   = wsp_key;
}

//-------------------------------------------------------------------------------
//
// vraca vrijednost izabrane radio opcije, ako nista nije vraca prazno
//
//-------------------------------------------------------------------------------

function checkRadio(RADIO) {
  var tVALUE='';
  for (var tI=0;tI<RADIO.length;tI++) {
    if (RADIO[tI].checked) { tVALUE=RADIO[tI].value }
  }
  return(tVALUE);
}

//-------------------------------------------------------------------------------
// You may use this code for free on any web page provided that 
// these comment lines and the following credit remain in the code.
// Floating Div from http://www.javascript-fx.com
//-------------------------------------------------------------------------------

function FloatDiv (id, sx, sy) {

  var EL=xDOC.getElementById?xDOC.getElementById(id):xDOC.all?xDOC.all[id]:xDOC.layers[id];
  var PX = xDOC.layers ? "" : "px";
  window[id + "_obj"] = EL;
  if (xDOC.layers) EL.style=EL;
  EL.cx = EL.sx = sx;
  EL.cy = EL.sy = sy;

  EL.sP=function(x,y) { 
    this.style.left=x+PX;this.style.top=y+PX; 
  };

  EL.floatIt=function () {
    var pX, pY;
    pX = (this.sx >= 0) ? 0 : xNS ? innerWidth : 
	xDOC.documentElement && xDOC.documentElement.clientWidth ? 
	xDOC.documentElement.clientWidth : xDOC.body.clientWidth;
    pY = xNS ? pageYOffset : xDOC.documentElement && xDOC.documentElement.scrollTop ? 
	xDOC.documentElement.scrollTop : xDOC.body.scrollTop;
    if (this.sy<0) 
    pY += xNS ? innerHeight : xDOC.documentElement && xDOC.documentElement.clientHeight ? 
	    xDOC.documentElement.clientHeight : xDOC.body.clientHeight;
    this.cx += (pX + this.sx - this.cx)/8;this.cy += (pY + this.sy - this.cy)/8;
    this.sP(this.cx, this.cy);
    setTimeout(this.id + "_obj.floatIt()", 40);
  }
  return EL;
}

//-------------------------------------------------------------------------------
//
// slanje linka
//
//-------------------------------------------------------------------------------

function ShowSendLink () {
  GrayOut(true);
  var X=xDOC.getElementById('DIVSENDLINK').offsetWidth;
  var Y=xDOC.getElementById('DIVSENDLINK').offsetHeight;
  FloatDiv('DIVSENDLINK',parseInt((ClientWidth()-X)/2),parseInt((ClientHeight()-Y)/2)).floatIt();
  xDOC.getElementById('DIVSENDLINK').style.visibility='visible';
}

function SendLink (form) {
  var tURI=xURI.replace(/=/g,'%3D');
  Update('SENDLINK','A=LIN&SEND=LIN&URI='+tURI+'&IME='+form.IME.value+'&EPR='+form.EPR.value+'&EPO='+form.EPO.value+
		'&LIN_KEY='+form.LIN_KEY.value+'&LIN_CODE='+form.LIN_CODE.value);
}

function HideSendLink () {
  xDOC.getElementById('DIVSENDLINK').style.visibility='hidden';
  GrayOut(false);
}   


//-------------------------------------------------------------------------------
//
// prikaz i sakrivanje slike
//
//-------------------------------------------------------------------------------

function ShowPicture (BID,X,Y) {
  var I=xDOC.getElementById('IMGSRC');
  GrayOut(true);
  X+=0;
  Y+=0;
  I.src=BID;
  I.width=X;
  I.height=Y;
  var XD=xDOC.getElementById('DIVIMG').offsetWidth;
  var YD=xDOC.getElementById('DIVIMG').offsetHeight;
  FloatDiv('DIVIMG',parseInt((ClientWidth()-XD)/2),parseInt((ClientHeight()-YD)/2)).floatIt();
  xDOC.getElementById('DIVIMG').style.visibility='visible';
}


function HidePicture () {
  var DIV=xDOC.getElementById('DIVIMG');
  DIV.style.visibility='hidden';
  var I=xDOC.getElementById('IMGSRC');
  I.src='_.gif';
  I.width=100;
  I.height=70;
  GrayOut(false);
}

//-------------------------------------------------------------------------------
//
// print
//
//-------------------------------------------------------------------------------

function PrintBody () {
  window.open('index.cgi?&PRINT=Y&'+xURI,'PRINT','width=800,height=600,screenX=20,screenY=20,left=20,top=20')
}


//-------------------------------------------------------------------------------
//
// zatamnjenje ekrana
//
//-------------------------------------------------------------------------------

function GrayOut(vis, options) {
  // Pass true to gray out screen, false to ungray
  // options are optional.  This is a JSON object with the following (optional) properties
  // opacity:0-100         // Lower number = less grayout higher = more of a blackout 
  // zindex: #             // HTML elements with a higher zindex appear on top of the gray out
  // bgcolor: (#xxxxxx)    // Standard RGB Hex color code
  // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
  // Because options is JSON opacity/zindex/bgcolor are all optional and can appear
  // in any order.  Pass only the properties you need to set.
  var options = options || {}; 
  var zindex = options.zindex || 50;
  var opacity = options.opacity || 80;
  var opaque = (opacity / 100);
  var bgcolor = options.bgcolor || '#0C59BF';
  var dark=xDOC.getElementById('darkenScreenObject');
  if (!dark) {
    // The dark layer doesn't exist, it's never been created.  So we'll
    // create it here and apply some basic styles.
    // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
    var tbody = xDOC.getElementsByTagName("body")[0];
    var tnode = xDOC.createElement('div');           // Create the layer.
        tnode.style.position='absolute';                 // Position absolutely
        tnode.style.top='0px';                           // In the top
        tnode.style.left='0px';                          // Left corner of the page
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='darkenScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    dark=xDOC.getElementById('darkenScreenObject');  // Get the object.
  }
  if (vis) {
    // Calculate the page width and height 
    if( xDOC.body && ( xDOC.body.scrollWidth || xDOC.body.scrollHeight ) ) {
        var pageWidth = xDOC.body.scrollWidth+'px';
        var pageHeight = xDOC.body.scrollHeight+'px';
    } else if( xDOC.body.offsetWidth ) {
      var pageWidth = xDOC.body.offsetWidth+'px';
      var pageHeight = xDOC.body.offsetHeight+'px';
    } else {
       var pageWidth='100%';
       var pageHeight='100%';
    }   
    //set the shader to cover the entire page and make it visible.
    dark.style.opacity=opaque;                      
    dark.style.MozOpacity=opaque;                   
    dark.style.filter='alpha(opacity='+opacity+')'; 
    dark.style.zIndex=zindex;        
    dark.style.backgroundColor=bgcolor;  
    dark.style.width= pageWidth;
    dark.style.height= pageHeight;
    dark.style.display='block';				 
  } 
  else {
     dark.style.display='none';
  }
}

function ShowData(ID) {
  GrayOut(true);
  var DIV=xDOC.getElementById('DATA'+ID);
  DIV.style.left=10;
  DIV.style.top=10;
  DIV.style.visibility='visible';
}

function HideData (ID) {
  xDOC.getElementById('DATA'+ID).style.visibility='hidden';
  GrayOut(false);
}

//-------------------------------------------------------------------------------
//
// functions by tigra @ softcomplex
//
// http://www.softcomplex.com/docs/get_window_size_and_scrollbar_position.html
//
//-------------------------------------------------------------------------------

function ClientWidth() {
	return PositionResult (
		window.innerWidth ? window.innerWidth : 0,
		xDOC.documentElement ? xDOC.documentElement.clientWidth : 0,
		xDOC.body ? xDOC.body.clientWidth : 0
	);
}

function ClientHeight() {
	return PositionResult (
		window.innerHeight ? window.innerHeight : 0,
		xDOC.documentElement ? xDOC.documentElement.clientHeight : 0,
		xDOC.body ? xDOC.body.clientHeight : 0
	);
}

function ScrollLeft() {
	return PositionResult (
		window.pageXOffset ? window.pageXOffset : 0,
		xDOC.documentElement ? xDOC.documentElement.scrollLeft : 0,
		xDOC.body ? xDOC.body.scrollLeft : 0
	);
}

function ScrollTop() {
	return PositionResult (
		window.pageYOffset ? window.pageYOffset : 0,
		xDOC.documentElement ? xDOC.documentElement.scrollTop : 0,
		xDOC.body ? xDOC.body.scrollTop : 0
	);
}

function PositionResult(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}


//-------------------------------------------------------------------------------------
// Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
// This notice MUST stay intact for legal use
// Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
//-------------------------------------------------------------------------------------

var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=xDOC.all
var ns6=xDOC.getElementById && !xDOC.all
var enabletip=false

function ietruebody(){
  return (xDOC.compatMode && xDOC.compatMode!="BackCompat")? xDOC.documentElement : xDOC.body
}

function ddrivetip(thetext, thecolor, thewidth){
  if (ns6||ie){
    var tipobj=xDOC.all? xDOC.all["dhtmltooltip"] : xDOC.getElementById? xDOC.getElementById("dhtmltooltip") : ""
    if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
    if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
    tipobj.innerHTML=thetext
    enabletip=true
    return false
  }
}

function positiontip(e){
  if (enabletip){
    var tipobj=xDOC.all? xDOC.all["dhtmltooltip"] : xDOC.getElementById? xDOC.getElementById("dhtmltooltip") : ""
    var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
    var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
    //Find out how close the mouse is to the corner of the window
    var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
    var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

    var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

    //if the horizontal distance isn't enough to accomodate the width of the context menu
    if (rightedge<tipobj.offsetWidth)
      //move the horizontal position of the menu to the left by it's width
      tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
    else if (curX<leftedge)
      tipobj.style.left="5px"
    else
      //position the horizontal position of the menu where the mouse is positioned
      tipobj.style.left=curX+offsetxpoint+"px"

    //same concept with the vertical position
    if (bottomedge<tipobj.offsetHeight)
      tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
    else
      tipobj.style.top=curY+offsetypoint+"px"

    tipobj.style.visibility="visible"
  }
}

function hideddrivetip(){
  var tipobj=xDOC.all? xDOC.all["dhtmltooltip"] : xDOC.getElementById? xDOC.getElementById("dhtmltooltip") : ""
  if (ns6||ie){
    enabletip=false
    tipobj.style.visibility="hidden"
    tipobj.style.left="-1000px"
    tipobj.style.backgroundColor=''
    tipobj.style.width=''
  }
}

xDOC.onmousemove=positiontip 


//-------------------------------------------------------------------------------
//
// Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
// This notice MUST stay intact for legal use
// Visit http://www.dynamicdrive.com/ for this script and 100s more.
//
//-------------------------------------------------------------------------------

var xDELAYSCROLLTIMEOUT;
var xSCROLLTIMEOUT;

var delayb4scroll=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''

function scrollmarquee(){
  if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+0))
    cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
  else
    cross_marquee.style.top=parseInt(marqueeheight)+0+"px"
}

function initializemarquee(){
  if (xDELAYSCROLLTIMEOUT) { clearTimeout(xDELAYSCROLLTIMEOUT) }
  if (xSCROLLTIMEOUT) { clearTimeout(xSCROLLTIMEOUT) }
  cross_marquee=document.getElementById("vmarquee")
  cross_marquee.style.top=0
  marqueeheight=document.getElementById("marqueecontainer").offsetHeight
  actualheight=cross_marquee.offsetHeight
  if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
    cross_marquee.style.height=marqueeheight+"px"
    cross_marquee.style.overflow="scroll"
    return
  }
  xDELAYSCROLLTIMEOUT=setTimeout('xSCROLLTIMEOUT=setInterval("scrollmarquee()",30)', delayb4scroll);
}

//-------------------------------------------------------------------------------
//
// Show hide div izbornik
//
//-------------------------------------------------------------------------------

menu_status = new Array(); 

function showHide(theid){
  if (document.getElementById) {
    var switch_id = document.getElementById(theid);

    if (menu_status[theid] != 'show') {
      switch_id.className = 'show';
      menu_status[theid] = 'show';
    }
    else {
      switch_id.className = 'hide';
      menu_status[theid] = 'hide';
    }
  }
}

var last_expanded = ''; 

function showHide(id) { 
  var obj = document.getElementById(id); 
  var status = obj.className; 

  if (status == 'hide') { 

    if (last_expanded != '') { 
      var last_obj = document.getElementById(last_expanded); 
      last_obj.className = 'hide'; 
    } 

    obj.className = 'show'; 

    last_expanded = id; 
  } 
  else { obj.className = 'hide' } 
} 


sfHover = function() {
    var sfEls = document.getElementById("navbar").getElementsByTagName("li");
    for (var i=0; i<sfEls.length; i++) {
        sfEls[i].onmouseover=function() {
            this.className+=" hover";
        }
        sfEls[i].onmouseout=function() {
            this.className=this.className.replace(new RegExp(" hover\\b"), "");
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

