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

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

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

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

window.defaultStatus='Udruga inovatora Hrvatske';
window.name='INOVATORSTVO';

function S(Msg) {
  if (Msg!='') { Msg='Udruga inovatora Hrvatske: '+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-LEFT&'+xAJAXURI,'STRANA-LEFT'); getDataReturnText('?JSRS=MENU-TOP&'+xAJAXURI,'MENU-TOP'); }
  }
  rNAVIG=/<NAVIGATOR>((\n|\r|.)*?)<\/NAVIGATOR>/mi;
  var tNAVIG=rNAVIG.exec(pTXT);
  if (tNAVIG) {
    pTXT=pTXT.replace(rNAVIG,'');
    if (xDOC.getElementById('NAVIGATOR')) {
      xDOC.getElementById('NAVIGATOR').innerHTML=tNAVIG[1];
    }
  }
  if (document.getElementById(pTAG)) { document.getElementById(pTAG).innerHTML=pTXT; DekodirajURI(); }
  if (xDOC.getElementById('vmarquee')) { initializemarquee() }
  if (cssdropdown != 'undefined' && pTAG=='MENU-TOP') { cssdropdown.startchrome('chromemenu') }
  if (pTAG=='BODY') { 
    document.body.scrollTop=0; 
    if (xDOC.getElementById('PRVA')) { document.getElementById('PRVA').onclick(); } 
  }
}

function Update(pTAG,pURI) {
  if( hs ) hs.close();
  xURI=pURI;
  if (pTAG=='BODY') { 
    getDataReturnText('?JSRS=STRANA-LEFT&'+pURI,'STRANA-LEFT');
    getDataReturnText('?JSRS=MENU-TOP&'+xAJAXURI,'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(E) {
  var uri='';
  var rTAG=/^(TABLE|TBODY|TR|TD|NOBR|CENTER|DIV|SPAN|A|FIELDSET|LEGEND)$/;
  for (var i=0; i<E.childNodes.length; i++) {
    var NODE=E.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=='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)+'&' } }
      }
      if (NODE.tagName=='TEXTAREA') { uri+=NODE.name+'='+encodeHtml(NODE.value)+'&' }
      if (NODE.tagName=='SELECT')   { uri+=NODE.name+'='+encodeHtml(NODE.options[NODE.selectedIndex].value)+'&' }
    }
  }
  return(uri);
}


function UpdateForm(TAG,FORMID) {
  var FORM=xDOC.getElementById(FORMID);
  var URI=getElementFormValues(FORM);
  Update(TAG,URI);
}

//-------------------------------------------------------------------------------
//
// 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=/^[\w]{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);
      }
    }
    
    else if (name=='REG') {
      if (!captcha.test(form.REG_CODE.value)) {
        alert('Niste upisali ispravni kontrolni kod!');
        form.REG_CODE.focus();
        return(false);
      }
      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.ULI.value)) {
        alert('Niste upisali adresu!');
        form.ULI.focus();
        return(false);
      }
      else if (!prazno.test(form.MJE.value)) {
        alert('Niste upisali mjesto!');
        form.MJE.focus();
        return(false);
      }
      else if (!prazno.test(form.TEL.value)) {
        alert('Niste upisali broj telefona!');
        form.TEL.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);
}

//-------------------------------------------------------------------------------
//
//  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);
}


//-------------------------------------------------------------------------------
//
// karta udruga
//
//-------------------------------------------------------------------------------

var xXZ=[243,273,292,184,305,359,382,80,159,462,432,458,143,555,223,637,316,1,383,351,294];
var xYZ=[80,49,153,132,23,39,74,151,250,94,172,200,353,106,413,185,455,176,596,0,96];

//var xXZ=[243,273,293,184,305,359,382,80,159,462,432,458,143,555,223,637,316,1,383,351,294];
//var xYZ=[80,49,153,132,23,39,74,151,250,94,172,200,353,106,413,185,455,176,596,0,96];

var xZUPANIJA={};
var xUDRUGE={};

function Zupanija(pID) {
  var tI;
  var tCOORDS=FindXY('KARTA');
  for (tI=1;tI<22;tI=tI+1) {
    var tVIS='hidden';
    if (tI==pID) { tVIS='visible' }
    var tZ=xDOC.getElementById('zup'+tI);
    var tOPIS=xDOC.getElementById('OPIS');
    if (tZ) { 
      if (tVIS=='visible') {
        tZ.style.left=tCOORDS.x+xXZ[tI-1];
        tZ.style.top=tCOORDS.y+xYZ[tI-1];
        tOPIS.style.left=tCOORDS.x+370;
        tOPIS.style.top=tCOORDS.y+280;
        tOPIS.style.visibility='visible';
        xDOC.getElementById('ZUP').innerHTML=xZUPANIJA[pID];
        var tUDR='';
        if (xUDRUGE[pID]) { tUDR=xUDRUGE[pID] }
        xDOC.getElementById('UDR').innerHTML=tUDR;
      }
      tZ.style.visibility=tVIS;
    }
  }
}

function FindXY(pID) {
  var tO=xDOC.getElementById(pID);
  var tCOORDS=new Object();
  if (tO.offsetParent) {
    tCOORDS.x=tO.offsetLeft
    tCOORDS.y=tO.offsetTop
    while (tO=tO.offsetParent) {
      tCOORDS.x+=tO.offsetLeft
      tCOORDS.y+=tO.offsetTop
    }
  }
  return(tCOORDS)
}

//-------------------------------------------------------------------------------
// 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=980,height=600,screenX=20,screenY=20,left=20,top=20')
}

function PrintNaslovna () {
  window.open('index.cgi?&PRINT=Y&A=NOV&S=PRN','PRINT','width=980,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 



///////////////////////////////////////////////////////////////////////////////////
//
//Chrome Drop Down Menu v2.01- Author: Dynamic Drive (http://www.dynamicdrive.com)
//Last updated: November 14th 06- added iframe shim technique
//
///////////////////////////////////////////////////////////////////////////////////

var cssdropdown={
disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout
disablemenuclick: false, //when user clicks on a menu item with a drop down menu, disable menu item's link?
enableswipe: 1, //enable swipe effect? 1 for yes, 0 for no
enableiframeshim: 1, //enable "iframe shim" technique to get drop down menus to correctly appear on top of controls such as form objects in IE5.5/IE6? 1 for yes, 0 for no

//No need to edit beyond here////////////////////////
dropmenuobj: null, ie: xDOC.all, firefox: xDOC.getElementById&&!xDOC.all, swipetimer: undefined, bottomclip:0,

getposOffset:function(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
},

swipeeffect:function(){
if (this.bottomclip<parseInt(this.dropmenuobj.offsetHeight)){
this.bottomclip+=10+(this.bottomclip/10) //unclip drop down menu visibility gradually
this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)"
}
else
return
this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 10)
},

showhide:function(obj, e){
if (this.ie || this.firefox)
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
if (this.enableswipe==1){
if (typeof this.swipetimer!="undefined")
clearTimeout(this.swipetimer)
obj.clip="rect(0 auto 0 0)" //hide menu via clipping
this.bottomclip=0
this.swipeeffect()
}
obj.visibility="visible"
}
else if (e.type=="click")
obj.visibility="hidden"
},

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

clearbrowseredge:function(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
},

dropit:function(obj, e, dropmenuID){
if (this.dropmenuobj!=null) //hide previous menu
this.dropmenuobj.style.visibility="hidden" //hide menu
this.clearhidemenu()
if (this.ie||this.firefox){
obj.onmouseout=function(){cssdropdown.delayhidemenu()}
obj.onclick=function(){return !cssdropdown.disablemenuclick} //disable main menu item link onclick?
this.dropmenuobj=xDOC.getElementById(dropmenuID)
this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()}
this.dropmenuobj.onmouseout=function(e){cssdropdown.dynamichide(e)}
this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
this.showhide(this.dropmenuobj.style, e)
this.dropmenuobj.x=this.getposOffset(obj, "left")
this.dropmenuobj.y=this.getposOffset(obj, "top")
this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
this.positionshim() //call iframe shim function
}
},

positionshim:function(){ //display iframe shim function
if (this.enableiframeshim && typeof this.shimobject!="undefined"){
if (this.dropmenuobj.style.visibility=="visible"){
this.shimobject.style.width=this.dropmenuobj.offsetWidth+"px"
this.shimobject.style.height=this.dropmenuobj.offsetHeight+"px"
this.shimobject.style.left=this.dropmenuobj.style.left
this.shimobject.style.top=this.dropmenuobj.style.top
}
this.shimobject.style.display=(this.dropmenuobj.style.visibility=="visible")? "block" : "none"
}
},

hideshim:function(){
if (this.enableiframeshim && typeof this.shimobject!="undefined")
this.shimobject.style.display='none'
},

contains_firefox:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},

dynamichide:function(e){
var evtobj=window.event? window.event : e
if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
this.delayhidemenu()
else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
this.delayhidemenu()
},

delayhidemenu:function(){
this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'; cssdropdown.hideshim()",this.disappeardelay) //hide menu
},

clearhidemenu:function(){
if (this.delayhide!="undefined")
clearTimeout(this.delayhide)
},

startchrome:function(){
for (var ids=0; ids<arguments.length; ids++){
var menuitems=xDOC.getElementById(arguments[ids]).getElementsByTagName("a")
for (var i=0; i<menuitems.length; i++){
if (menuitems[i].getAttribute("rel")){
var relvalue=menuitems[i].getAttribute("rel")
menuitems[i].onmouseover=function(e){
var event=typeof e!="undefined"? e : window.event
cssdropdown.dropit(this,event,this.getAttribute("rel"))
}
}
}
}
if (window.createPopup && 0){ //if IE5.5 to IE6, create iframe for iframe shim technique
xDOC.write('<IFRAME id="iframeshim"  src="" style="display: none; left: 0; top: 0; z-index: 90; position: absolute; filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" frameBorder="0" scrolling="no"></IFRAME>')
this.shimobject=xDOC.getElementById("iframeshim") //reference iframe object
}
}

}

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

menu_status = new Array(); 

function showHide(theid){
  if (xDOC.getElementById) {
    var switch_id = xDOC.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 = xDOC.getElementById(id); 
  var status = obj.className; 

  if (status == 'hide') { 

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

    obj.className = 'show'; 

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

///////////////////////////////////////////////////////////////////////////////////
//
// Style switch
//
///////////////////////////////////////////////////////////////////////////////////

function C(pO,pID) {
   pO.className=pO.className.substr(0,pO.className.length-1)+pID;
}


//-------------------------------------------------------------------------------
// tabovi
//-------------------------------------------------------------------------------

/***********************************************
* Tab Content script v2.2- © 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
***********************************************/

//** Tab Content script v2.0- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
//** Updated Oct 7th, 07 to version 2.0. Contains numerous improvements:
//   -Added Auto Mode: Script auto rotates the tabs based on an interval, until a tab is explicitly selected
//   -Ability to expand/contract arbitrary DIVs on the page as the tabbed content is expanded/ contracted
//   -Ability to dynamically select a tab either based on its position within its peers, or its ID attribute (give the target tab one 1st)
//   -Ability to set where the CSS classname "selected" get assigned- either to the target tab's link ("A"), or its parent container
//** Updated Feb 18th, 08 to version 2.1: Adds a "tabinstance.cycleit(dir)" method to cycle forward or backward between tabs dynamically
//** Updated April 8th, 08 to version 2.2: Adds support for expanding a tab using a URL parameter (ie: http://mysite.com/tabcontent.htm?tabinterfaceid=0) 

////NO NEED TO EDIT BELOW////////////////////////

function ddtabcontent(tabinterfaceid){
	this.tabinterfaceid=tabinterfaceid //ID of Tab Menu main container
	this.tabs=document.getElementById(tabinterfaceid).getElementsByTagName("a") //Get all tab links within container
	this.enabletabpersistence=true
	this.hottabspositions=[] //Array to store position of tabs that have a "rel" attr defined, relative to all tab links, within container
	this.currentTabIndex=0 //Index of currently selected hot tab (tab with sub content) within hottabspositions[] array
	this.subcontentids=[] //Array to store ids of the sub contents ("rel" attr values)
	this.revcontentids=[] //Array to store ids of arbitrary contents to expand/contact as well ("rev" attr values)
	this.selectedClassTarget="link" //keyword to indicate which target element to assign "selected" CSS class ("linkparent" or "link")
}

ddtabcontent.getCookie=function(Name){ 
	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
	return ""
}

ddtabcontent.setCookie=function(name, value){
	document.cookie = name+"="+value+";path=/" //cookie value is domain wide (path=/)
}

ddtabcontent.prototype={

	expandit:function(tabid_or_position){ //PUBLIC function to select a tab either by its ID or position(int) within its peers
		this.cancelautorun() //stop auto cycling of tabs (if running)
		var tabref=""
		try{
			if (typeof tabid_or_position=="string" && document.getElementById(tabid_or_position).getAttribute("rel")) //if specified tab contains "rel" attr
				tabref=document.getElementById(tabid_or_position)
			else if (parseInt(tabid_or_position)!=NaN && this.tabs[tabid_or_position].getAttribute("rel")) //if specified tab contains "rel" attr
				tabref=this.tabs[tabid_or_position]
		}
		catch(err){alert("Invalid Tab ID or position entered!")}
		if (tabref!="") //if a valid tab is found based on function parameter
			this.expandtab(tabref) //expand this tab
	},

	cycleit:function(dir, autorun){ //PUBLIC function to move foward or backwards through each hot tab (tabinstance.cycleit('foward/back') )
		if (dir=="next"){
			var currentTabIndex=(this.currentTabIndex<this.hottabspositions.length-1)? this.currentTabIndex+1 : 0
		}
		else if (dir=="prev"){
			var currentTabIndex=(this.currentTabIndex>0)? this.currentTabIndex-1 : this.hottabspositions.length-1
		}
		if (typeof autorun=="undefined") //if cycleit() is being called by user, versus autorun() function
			this.cancelautorun() //stop auto cycling of tabs (if running)
		this.expandtab(this.tabs[this.hottabspositions[currentTabIndex]])
	},

	setpersist:function(bool){ //PUBLIC function to toggle persistence feature
			this.enabletabpersistence=bool
	},

	setselectedClassTarget:function(objstr){ //PUBLIC function to set which target element to assign "selected" CSS class ("linkparent" or "link")
		this.selectedClassTarget=objstr || "link"
	},

	getselectedClassTarget:function(tabref){ //Returns target element to assign "selected" CSS class to
		return (this.selectedClassTarget==("linkparent".toLowerCase()))? tabref.parentNode : tabref
	},

	urlparamselect:function(tabinterfaceid){
		var result=window.location.search.match(new RegExp(tabinterfaceid+"=(\\d+)", "i")) //check for "?tabinterfaceid=2" in URL
		return (result==null)? null : parseInt(RegExp.$1) //returns null or index, where index (int) is the selected tab's index
	},

	expandtab:function(tabref){
		var subcontentid=tabref.getAttribute("rel") //Get id of subcontent to expand
		//Get "rev" attr as a string of IDs in the format ",john,george,trey,etc," to easily search through
		var associatedrevids=(tabref.getAttribute("rev"))? ","+tabref.getAttribute("rev").replace(/\s+/, "")+"," : ""
		this.expandsubcontent(subcontentid)
		this.expandrevcontent(associatedrevids)
		for (var i=0; i<this.tabs.length; i++){ //Loop through all tabs, and assign only the selected tab the CSS class "selected"
			this.getselectedClassTarget(this.tabs[i]).className=(this.tabs[i].getAttribute("rel")==subcontentid)? "selected" : ""
		}
		if (this.enabletabpersistence) //if persistence enabled, save selected tab position(int) relative to its peers
			ddtabcontent.setCookie(this.tabinterfaceid, tabref.tabposition)
		this.setcurrenttabindex(tabref.tabposition) //remember position of selected tab within hottabspositions[] array
	},

	expandsubcontent:function(subcontentid){
		for (var i=0; i<this.subcontentids.length; i++){
			var subcontent=document.getElementById(this.subcontentids[i]) //cache current subcontent obj (in for loop)
			subcontent.style.display=(subcontent.id==subcontentid)? "block" : "none" //"show" or hide sub content based on matching id attr value
		}
	},

	expandrevcontent:function(associatedrevids){
		var allrevids=this.revcontentids
		for (var i=0; i<allrevids.length; i++){ //Loop through rev attributes for all tabs in this tab interface
			//if any values stored within associatedrevids matches one within allrevids, expand that DIV, otherwise, contract it
			document.getElementById(allrevids[i]).style.display=(associatedrevids.indexOf(","+allrevids[i]+",")!=-1)? "block" : "none"
		}
	},

	setcurrenttabindex:function(tabposition){ //store current position of tab (within hottabspositions[] array)
		for (var i=0; i<this.hottabspositions.length; i++){
			if (tabposition==this.hottabspositions[i]){
				this.currentTabIndex=i
				break
			}
		}
	},

	autorun:function(){ //function to auto cycle through and select tabs based on a set interval
		this.cycleit('next', true)
	},

	cancelautorun:function(){
		if (typeof this.autoruntimer!="undefined")
			clearInterval(this.autoruntimer)
	},

	init:function(automodeperiod){
		var persistedtab=ddtabcontent.getCookie(this.tabinterfaceid) //get position of persisted tab (applicable if persistence is enabled)
		var selectedtab=-1 //Currently selected tab index (-1 meaning none)
		var selectedtabfromurl=this.urlparamselect(this.tabinterfaceid) //returns null or index from: tabcontent.htm?tabinterfaceid=index
		this.automodeperiod=automodeperiod || 0
		for (var i=0; i<this.tabs.length; i++){
			this.tabs[i].tabposition=i //remember position of tab relative to its peers
			if (this.tabs[i].getAttribute("rel")){
				var tabinstance=this
				this.hottabspositions[this.hottabspositions.length]=i //store position of "hot" tab ("rel" attr defined) relative to its peers
				this.subcontentids[this.subcontentids.length]=this.tabs[i].getAttribute("rel") //store id of sub content ("rel" attr value)
				this.tabs[i].onclick=function(){
					tabinstance.expandtab(this)
					tabinstance.cancelautorun() //stop auto cycling of tabs (if running)
					return false
				}
				if (this.tabs[i].getAttribute("rev")){ //if "rev" attr defined, store each value within "rev" as an array element
					this.revcontentids=this.revcontentids.concat(this.tabs[i].getAttribute("rev").split(/\s*,\s*/))
				}
				if (selectedtabfromurl==i || this.enabletabpersistence && selectedtab==-1 && parseInt(persistedtab)==i || !this.enabletabpersistence && selectedtab==-1 && this.getselectedClassTarget(this.tabs[i]).className=="selected"){
					selectedtab=i //Selected tab index, if found
				}
			}
		} //END for loop
		if (selectedtab!=-1) //if a valid default selected tab index is found
			this.expandtab(this.tabs[selectedtab]) //expand selected tab (either from URL parameter, persistent feature, or class="selected" class)
		else //if no valid default selected index found
			this.expandtab(this.tabs[this.hottabspositions[0]]) //Just select first tab that contains a "rel" attr
		if (parseInt(this.automodeperiod)>500 && this.hottabspositions.length>1){
			this.autoruntimer=setInterval(function(){tabinstance.autorun()}, this.automodeperiod)
		}
	} //END int() function

} //END Prototype assignment


/***********************************************
* Object Oriented 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.
* Modified in http://www.dynamicdrive.com/forums by jscheuer1
* For multiple use and functionality in Opera and NS 7
***********************************************/

//////// NO NEED TO EDIT ////////////
function cross_marquee(delayb4scroll, marqueespeed, pauseit){
if(!cross_marquee.ar)
cross_marquee.ar=[];
cross_marquee.ar[this.mqid=cross_marquee.ar.length]=this;
this.delayb4scroll=delayb4scroll;
this.marqueespeed=marqueespeed;
this.pauseit=pauseit;


this.copyspeed=this.marqueespeed
this.pausespeed=(this.pauseit==0)? this.copyspeed: 0;
this.actualheight=''
document.write('<div id="marqueecontainer'+this.mqid+'" onMouseover="cross_marquee.ar['+this.mqid+'].copyspeed=cross_marquee.ar['+this.mqid+'].pausespeed" onMouseout="cross_marquee.ar['+this.mqid+'].copyspeed=cross_marquee.ar['+this.mqid+'].marqueespeed">\n'+
'<div id="vmarquee'+this.mqid+'" style="position: absolute; width: 98%;">')

this.cross_marquee=document.getElementById("vmarquee"+this.mqid)
this.cross_marquee.style.top=0
this.marqueeheight=document.getElementById("marqueecontainer"+this.mqid).offsetHeight
var cacheobj=this;
setTimeout(function(){cacheobj.lefttime=setInterval("cross_marquee.ar["+cacheobj.mqid+"].scrollmarquee()",30)}, cacheobj.delayb4scroll)
}

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