﻿



//  CASCADING POPUP MENUS v5.2 - by Angus Turnbull - http://www.twinhelix.com
//  Visit my site for usage information and more scripts...











// *** COMMON CROSS-BROWSER COMPATIBILITY CODE ***

var isDOM=document.getElementById?1:0;
var isIE=document.all?1:0;
var isNS4=navigator.appName=='Netscape'&&!isDOM?1:0;
var isIE4=isIE&&!isDOM?1:0;
var isOp=window.opera?1:0;
var isDyn=isDOM||isIE||isNS4;


function getRef(id, par)
{
 par=!par?document:(par.navigator?par.document:par);
 return (isIE ? par.all[id] :
  (isDOM ? (par.getElementById?par:par.ownerDocument).getElementById(id) :
  (isNS4 ? par.layers[id] : null)));
}

function getSty(id, par)
{
 var r=getRef(id, par);
 return r?(isNS4?r:r.style):null;
}

if (!window.LayerObj) var LayerObj = new Function('id', 'par',
 'this.ref=getRef(id, par); this.sty=getSty(id, par); return this');
function getLyr(id, par) { return new LayerObj(id, par) }

function LyrFn(fn, fc)
{
 LayerObj.prototype[fn] = new Function('var a=arguments,p=a[0],px=isNS4||isOp?0:"px"; ' +
  'with (this) { '+fc+' }');
}
LyrFn('x','if (!isNaN(p)) sty.left=p+px; else return parseInt(sty.left)');
LyrFn('y','if (!isNaN(p)) sty.top=p+px; else return parseInt(sty.top)');
LyrFn('vis','sty.visibility=p');
LyrFn('bgColor','if (isNS4) sty.bgColor=p?p:null; ' +
 'else sty.background=p?p:"transparent"');
LyrFn('bgImage','if (isNS4) sty.background.src=p?p:null; ' +
 'else sty.background=p?"url("+p+")":"transparent"');
LyrFn('clip','if (isNS4) with(sty.clip){left=a[0];top=a[1];right=a[2];bottom=a[3]} ' +
 'else sty.clip="rect("+a[1]+"px "+a[2]+"px "+a[3]+"px "+a[0]+"px)" ');
LyrFn('write','if (isNS4) with (ref.document){write(p);close()} else ref.innerHTML=p');
LyrFn('alpha','var f=ref.filters,d=(p==null); if (f) {' +
 'if (!d&&sty.filter.indexOf("alpha")==-1) sty.filter+=" alpha(opacity="+p+")"; ' +
 'else if (f.length&&f.alpha) with(f.alpha){if(d)enabled=false;else{opacity=p;enabled=true}} }' +
 'else if (isDOM) sty.MozOpacity=d?"":p+"%"');


function setLyr(lVis, docW, par)
{
 if (!setLyr.seq) setLyr.seq=0;
 if (!docW) docW=0;
 var obj = (!par ? (isNS4 ? window : document.body) :
  (!isNS4 && par.navigator ? par.document.body : par));
 var IA='insertAdjacentHTML', AC='appendChild', newID='_js_layer_'+setLyr.seq++;

 if (obj[IA]) obj[IA]('beforeEnd', '<div id="'+newID+'" style="position:absolute"></div>');
 else if (obj[AC])
 {
  var newL=document.createElement('div');
  obj[AC](newL); newL.id=newID; newL.style.position='absolute';
 }
 else if (isNS4)
 {
  var newL=new Layer(docW, obj);
  newID=newL.id;
 }

 var lObj=getLyr(newID, par);
 with (lObj) if (ref) { vis(lVis); x(0); y(0); sty.width=docW+(isNS4?0:'px') }
 return lObj;
}


var CSSmode=document.compatMode?(document.compatMode.indexOf('CSS')>-1):(isDOM&&!isIE||isOp);

if (!window.page) var page = { win: window, minW: 0, minH: 0, MS: isIE&&!isOp,
 db: CSSmode?'documentElement':'body' }

page.winW=function()
 { with (this) return Math.max(minW, MS?win.document[db].clientWidth:win.innerWidth) }
page.winH=function()
 { with (this) return Math.max(minH, MS?win.document[db].clientHeight:win.innerHeight) }

page.scrollX=function()
 { with (this) return MS?win.document[db].scrollLeft:win.pageXOffset }
page.scrollY=function()
 { with (this) return MS?win.document[db].scrollTop:win.pageYOffset }







// *** POPUP MENU MAIN OBJECT CONSTRUCTOR ***


function PopupMenu(myName)
{
 this.myName = myName;

 this.showTimer = 0;
 this.hideTimer = 0;
 this.showDelay = 0;
 this.hideDelay = 500;

 this.menu =  new Array();

 this.litNow = new Array();
 this.litOld = new Array();


 this.overM = '';
 this.overI = 0;


 this.actMenu = null;


 PopupMenu.list[myName] = this;
}

PopupMenu.list = [];


var PmPt = PopupMenu.prototype;




// *** MOUSE EVENT CONTROL FUNCTIONS ***


// Most of these are passed the relevant 'menu Name' and 'item Number'.
// The 'with (this)' means it uses the properties and functions of the current menu object.
PmPt.over = function(mN, iN) { with (this)
{
 // Cancel any pending menu hides from a previous mouseout.
 clearTimeout(hideTimer);
 // Set the 'over' variables to point to this item.
 overM = mN;
 overI = iN;

 // Call the 'onmouseover' events for the menu and this item if the item number is valid.
 if (iN)
 {
  if (this.onmouseover) onmouseover(mN, iN);
  eval(menu[mN][iN].onmouseout);
 }


 // Remember what was lit last time, and compute a new hierarchy.
 litOld = litNow;
 litNow = new Array();
 var litM = mN, litI = iN;
 if (mN) do
 {
  litNow[litM] = litI;
  // These will become undefined at the top of the hierarchy, stopping the loop.
  // (Remember the root menu doesn't have a parent).
  litI = menu[litM][0].parentItem;
  litM = menu[litM][0].parentMenu;
 } while (litM);


 // If the two arrays are the same, return... no use hiding/lighting otherwise.
 var same = true;
 for (var z in menu) if (litNow[z] != litOld[z]) same = false;
 if (same) return;

 // If this is a different menu, clear another pending show.
 clearTimeout(showTimer);




 for (var thisM in menu) with (menu[thisM][0])
 {

  if (!lyr) continue;


  litI = litNow[thisM];
  oldI = litOld[thisM];

  if (litI != oldI)
  {
   if (litI) changeCol(thisM, litI);
   if (oldI) changeCol(thisM, oldI);
  }

  if (isRoot) continue;
  

  if (litI && !visNow) doVis(thisM, true);


  if (!litI && visNow) doVis(thisM, false);
 }



 nextMenu = '';
 if (menu[mN] && menu[mN][iN].type=='sm:')
 {

  var targ = menu[mN][iN].href, lyrM = menu[mN][0].lyr;


  if (menu[targ][0].subsOnClick) return true;

// EXTRA CODE - Uncomment these lines to enable dynamic create-as-needed menu support,
// where you can create only the root menu on page load and others when you point at them.
// I would recommend using this for single-frame menus only, and changing the "Events"
// section of the code to call pMenu.update(false, 'root') on page load for all browsers
// and disabling "fast" inline creation mode. Bear in mind this won't work in Opera 5/6.

//if (!menu[targ][0].lyr) update(false, targ);
//if (!menu[targ][0].lyr) return true;

  // Either position/show immediately or after a delay, via the doVis() function.
  // Set nextMenu to the impending show, so the popOut() function knows when not to cancel it.
  nextMenu = targ;
  if (showDelay) showTimer = setTimeout(myName+'.doVis("'+targ+'", true)', showDelay);
  else doVis(targ, true);
 }
}}


PmPt.out = function(mN, iN) { with (this)
{

 if (mN!=overM || iN!=overI) return;


 if (this.onmouseout) onmouseout(mN, iN);

 var thisI = menu[mN][iN];


 eval(thisI.onmouseout);


 if (thisI.href != nextMenu)
 {
  clearTimeout(showTimer);
  nextMenu = '';
 }

 // Dim/hide all menus rapidly (if it's a root menu item without a popout) or as specified.
 // Remember that the timeout is cancelled by another instance of the over function.
 // Calling 'over("", 0)' hides all menus but the root menu(s), and highlights no items.
 // If hideDelay equals zero the menus are never hidden.
 if (hideDelay)
 {
  var delay = (menu[mN][0].isRoot && (thisI.type != 'sm:')) ? 50 : hideDelay;
  hideTimer = setTimeout(myName + '.over("", 0)', delay);
 }

 // Clear the 'over' variables.
 overM = '';
 overI = 0;
}}


PmPt.click = function(mN, iN) { with (this)
{

 if (this.onclick) onclick(mN, iN);

 var thisI = menu[mN][iN], hideM = true;

 eval(thisI.onclick);

 with (thisI) switch (type)
 {

  case 'sm:':
  {
   if (menu[href][0].subsOnClick)
   {
    doVis(href, true);
    hideM = false;
   }
   break;
  }

  case 'js:': { eval(href); break }

  case '': type = 'window';
  default: if (href) eval(type + '.location.href = "' + href + '"');
 }


 if (hideM) over('', 0);
}}


PmPt.changeCol = function(mN, iN) { with (this.menu[mN][iN])
{
 if (!lyr || !lyr.ref) return;


 var bgFn = (outCol.indexOf('.')==-1) ? 'bgColor' : 'bgImage';

 var ovr = (this.litNow[mN]==iN)?1:0, doFX = (this.litNow[mN]!=this.litOld[mN]);

 var col = ovr?overCol:outCol


 if (fade[0])
 {

  clearTimeout(timer);
  col = '#';


  count = Math.max(0, Math.min(count+(2*ovr-1)*parseInt(fade[ovr][1]), 100));
  for (var i=2; i<5; i++)
  {

   var orig = parseInt('0x'+fade[0][i]), nc = '00'+parseInt(orig +
    (parseInt('0x'+fade[1][i])-orig)*(count/100)).toString(16);
   col += nc.substring(nc.length - 2);
  }


  if (count%100 > 0) timer = setTimeout(this.myName+'.changeCol("'+mN+'",'+iN+')', 50);
 }



 if (isNS4) lyr[bgFn](col);


 var reCSS = (overClass!=outClass || outBorder!=overBorder);
 if (doFX) with (lyr)
 {
  if (overText || overInd || (isNS4&&reCSS)) write(this.getHTML(mN, iN, ovr));
  if (!isNS4 && reCSS)
  {
   ref.className = (ovr ? overBorder : outBorder);
   var chl = (isDOM ? ref.childNodes : ref.children);
   if (chl && !overText) for (var i = 0; i < chl.length; i++)
    chl[i].className = ovr?overClass:outClass;
  }
 }

 if (!isNS4) lyr[bgFn](col);


 if (doFX && outAlpha!=overAlpha) lyr.alpha(ovr ? overAlpha : outAlpha);
}}


PmPt.position = function(posMN) { with (this)
{

 for (mN in menu) if (!posMN || posMN==mN) with (menu[mN][0])
 {

  if (!lyr || !lyr.ref || !visNow) continue;


  var pM, pI, newX = eval(offX), newY = eval(offY);

  if (!isRoot)
  {
   pM = menu[parentMenu];
   pI = pM[parentItem].lyr;

   if (!pI) continue;
  }


  var eP = eval(par), pW = (eP&&eP.navigator ? eP : window);

  with (pW.page) var sX=scrollX(), wX=sX+winW(), sY=scrollY(), wY=winH()+sY;
  wX = isNaN(wX)||!wX ? 9999 : wX;
  wY = isNaN(wY)||!wY ? 9999 : wY;

  // Relatively positioned submenus? Add parent menu/item position & check screen edges.
  // Subtract either 5px or 20px at the end to allow for padding and NS scrollbars.
  var sb = page.MS?5:20;
  if (pM && typeof(offX)=='number') newX = Math.max(sX,
   Math.min(newX+pM[0].lyr.x()+pI.x(), wX-menuW-sb));
  if (pM && typeof(offY)=='number') newY = Math.max(sY,
   Math.min(newY+pM[0].lyr.y()+pI.y(), wY-menuH-sb));

  // Assign the final calculated positions.
  lyr.x(newX);
  lyr.y(newY);
 }
}}





// *** MENU OBJECT CONSTRUCTION FUNCTIONS ***


function addProps(obj, data, names, addNull)
{
 for (var i = 0; i < names.length; i++) if(i < data.length || addNull) obj[names[i]] = data[i];
}

function ItemStyle()
{

 var names = ['len', 'spacing', 'popInd', 'popPos', 'pad', 'outCol', 'overCol', 'outClass',
  'overClass', 'outBorder', 'overBorder', 'outAlpha', 'overAlpha', 'normCursor', 'nullCursor'];
 addProps(this, arguments, names, true);
}

PmPt.startMenu = function(mName) { with (this)
{

 if (!menu[mName]) { menu[mName] = new Array(); menu[mName][0] = new Object(); }


 actMenu = menu[mName];
 aM = actMenu[0];
 actMenu.length = 1;


 var names = ['name', 'isVert', 'offX','offY', 'width', 'itemSty', 'par', 'subsOnClick',
  'visNow', 'parentMenu', 'parentItem', 'oncreate', 'isRoot'];
 addProps(aM, arguments, names, true);


 aM.extraHTML = '';

 aM.menuW = aM.menuH = 0;


 if (!aM.lyr) aM.lyr = null;

 if (mName.substring(0, 4) == 'root')
 {
  aM.isRoot = true;
  aM.oncreate = new Function('this.visNow=true; ' +
   myName + '.position("' + mName + '"); this.lyr.vis("visible")');
 }


 return aM;
}}


PmPt.addItem = function() { with (this) with (actMenu[0])
{


 var aI = actMenu[actMenu.length] = new Object();

 var names = ['text', 'href', 'type', 'itemSty', 'len', 'spacing', 'popInd', 'popPos',
  'pad', 'outCol', 'overCol', 'outClass', 'overClass', 'outBorder', 'overBorder',
  'outAlpha', 'overAlpha', 'normCursor', 'nullCursor',
  'iX', 'iY', 'iW', 'iH', 'overText', 'overInd', 'lyr', 'onclick', 'onmouseover', 'onmouseout'];
 addProps(aI, arguments, names, true);


 var iSty = (arguments[3] ? arguments[3] : actMenu[0].itemSty);

 for (prop in iSty) if (aI[prop]+'' == 'undefined') aI[prop] = iSty[prop];



 var re = /^SWAP:(.*)\^(.*)$/;

 with (RegExp)
 {
  if (aI.text.match(re)) { aI.text = $1; aI.overText = $2 }
  if (aI.popInd.match(re)) { aI.popInd = $1; aI.overInd = $2 }
 }

 aI.timer = aI.count = 0;
 aI.fade = ['outCol','overCol'];
 for (var i in aI.fade)
 {

  var oC = aI.fade[i];

  aI.fade[i] = aI[oC].match(/^(\d+)#(..)(..)(..)$/);

  if (aI.fade[i]) with (RegExp) aI[oC] = '#'+$2+$3+$4;
 }


 if (aI.outBorder && isNS4) aI.pad++;

 aI.iW = (isVert ? width : aI.len);
 aI.iH = (isVert ? aI.len : width);

 var lastGap = (actMenu.length > 2) ? actMenu[actMenu.length - 2].spacing : 0;

 var spc = ((actMenu.length > 2) && aI.outBorder ? 1 : 0);

 if (isVert)
 {
  menuH += lastGap - spc;
  aI.iX = 0; aI.iY = menuH;
  menuW = width; menuH += aI.iH;
 }
 else
 {
  menuW += lastGap - spc;
  aI.iX = menuW; aI.iY = 0;
  menuW += aI.iW; menuH = width;
 }


 if (aI.outBorder && CSSmode)
 {
  aI.iW -= 2;
  aI.iH -= 2;
 }


 return aI;
}}



// *** MAIN MENU CREATION/UPDATE FUNCTIONS ***



PmPt.getHTML = function(mN, iN, isOver) { with (this)
{
 var itemStr = '';
 with (menu[mN][iN])
 {

  var textClass = (isOver?overClass:outClass), txt = (isOver&&overText?overText:text),
   popI = (isOver&&overInd?overInd:popInd);


  if ((type == 'sm:') && popI)
  {
   if (isNS4) itemStr += '<layer class="' + textClass + '" left="'+ ((popPos+iW)%iW) +
    '" top="' + pad + '" height="' + (iH-2*pad) + '">' + popI + '</layer>';
   else itemStr += '<div class="' + textClass + '" style="position: absolute; left: ' +
    ((popPos+iW)%iW) + 'px; top: ' + pad + 'px; height: ' + (iH-2*pad) + 'px">' + popI + '</div>';
  }

  if (isNS4) itemStr += (outBorder ? '<span class="' + (isOver?overBorder:outBorder) +
   '"><spacer type="block" width="' + (iW-8) + '" height="' + (iH-8) + '"></span>' : '') +
   '<layer left="' + pad + '" top="' + pad + '" width="' + (iW-2*pad) + '" height="' +
   (iH-2*pad) + '"><a class="' + textClass + '" href="#" ' +
   'onClick="return false" onMouseOver="status=\'\'; ' + myName + '.over(\'' + mN + '\',' +
   iN + '); return true">' + txt + '</a></layer>';

  // IE4+/NS6 is an awful lot easier to work with sometimes.
  else itemStr += '<div class="' + textClass + '" style="position: absolute; left: ' + pad +
   'px; top: ' + pad + 'px; width: ' + (iW-2*pad) + 'px; height: ' + (iH-2*pad) + 'px">' +
   txt + '</div>';
 }
 return itemStr;
}}



PmPt.update = function(docWrite, upMN) { with (this)
{

 if (!isDyn) return;


 for (mN in menu) with (menu[mN][0])
 {

  if (upMN && (upMN != mN)) continue;


  var str = '';


  for (var iN = 1; iN < menu[mN].length; iN++) with (menu[mN][iN])
  {

   var itemID = myName + '_' + mN + '_' + iN;


   var targM = menu[href];
   if (targM && (type == 'sm:'))
   {
    targM[0].parentMenu = mN;
    targM[0].parentItem = iN;
   }


   var isImg = (outCol.indexOf('.') != -1) ? true : false;


   if (!isIE)
   {
    if (normCursor=='hand') normCursor = 'pointer';
    if (nullCursor=='hand') nullCursor = 'pointer';
   }


   if (isDOM || isIE4)
   {
    str += '<div id="' + itemID + '" ' + (outBorder ? 'class="'+outBorder+'" ' : '') +
     'style="position: absolute; left: ' + iX + 'px; top: ' + iY + 'px; width: ' + iW +
     'px; height: ' + iH + 'px; z-index: 1000; background: ' + (isImg?'url('+outCol+')':outCol) +
     ((typeof(outAlpha)=='number') ? '; filter: alpha(opacity='+ outAlpha + '); -moz-opacity: ' +
      (outAlpha/100) : '') +
     '; cursor: ' + ((type!='sm:' && href) ? normCursor : nullCursor) + '" ';
   }
   else if (isNS4)
   {

    str += '<layer id="' + itemID + '" left="' + iX + '" top="' + iY + '" width="' +
     iW + '" height="' + iH + '" z-index="1000" ' +
     (outCol ? (isImg ? 'background="' : 'bgcolor="') + outCol + '" ' : '');
   }


   var evtMN = '(\'' + mN + '\',' + iN + ')"';
   str += 'onMouseOver="' + myName + '.over' + evtMN + ' onMouseOut="' + myName + '.out' + evtMN +
    ' onClick="' + myName + '.click' + evtMN + '>' +  getHTML(mN, iN, false) +
    (isNS4 ? '</layer>' : '</div>');


  }



  var eP = eval(par);



  var sR = myName + '.setupRef(' + docWrite + ', "' + mN + '")';
  if (isOp) setTimeout(sR, 100);

  var mVis = (isOp && isRoot) ? 'visible' : 'hidden';


  if (docWrite)
  {

   var targFr = (eP && eP.navigator ? eP : window);

   targFr.document.write('<div id="' + myName + '_' + mN + '_Div" style="position: absolute; ' +
    'visibility: ' + mVis + '; left: 0px; top: 0px; width: ' + (menuW+2) + 'px; height: ' +
    (menuH+2) + 'px; z-index: 1000">' + str + extraHTML + '</div>');
  }
  else
  {

   if (!lyr || !lyr.ref) lyr = setLyr(mVis, menuW, eP);
   else if (isIE4) setTimeout(myName + '.menu.' + mN + '[0].lyr.sty.width=' + (menuW+2), 50);

   with (lyr) { sty.zIndex = 1000; write(str + extraHTML) }
  }

  if (!isOp) setTimeout(sR, 50);

 }
}}


PmPt.setupRef = function(docWrite, mN) { with (this) with (menu[mN][0])
{

 if (docWrite || !lyr || !lyr.ref) lyr = getLyr(myName + '_' + mN + '_Div', eval(par));

 for (var i = 1; i < menu[mN].length; i++)
  menu[mN][i].lyr = getLyr(myName + '_' + mN + '_' + i, (isNS4?lyr.ref:eval(par)));


 menu[mN][0].lyr.clip(0, 0, menuW+2, menuH+2);


 if (menu[mN][0].oncreate) oncreate();
}}


PmPt.doVis = function(mN, show) { with (this)
{

 var m = menu[mN], mA = (show?'show':'hide')+'Menu';

 if (!m) return;
 m[0].visNow = show;
 if (show) position(mN);

 if (this[mA]) this[mA](mN);
 else m[0].lyr.vis(show?'visible':'hidden');
}}














// ******************** START EDITING HERE ********************
//
// IMPORTANT: Before you start, make sure you've read the "Conditions Of Use" in this HTML
// document or on my site. To edit this menu, the script is split up into several sections:
//
// (1) ITEMSTYLES - These define the colour and size of menu items. Required.
// (2) MENU DATA - These specify the text and links in the menu. Required.
// (3) MENU EFFECTS - Want to remove, or change borders, shadows and animation? Edit them here,
//     or you can delete this section entirely to remove extra effects.
// (4) EVENTS - Activate the menu(s), and choose creation mode (Dynamic / Fast) etc. Required.
//     Read this if you're combining this scritp with other scripts on the same page.
// (5) OPTIONAL CODE - Extra features like adding clicking to 'sm:' items or status messages on
//     mouseover. Animation/effects functions are here too. You can skip or delete this entirely.
// (6) FRAMESET README - If you're using a frameset, read this, it explains what you need to do.






// ******************** (1) ITEMSTYLES ********************

///////////////  P O D E S A V A NJ E //////////////////////////////////////////////////////////////////


// ItemStyle(sirina , razmak po horizontali , ' > ' , ? , pading 2 , cell hover, cell color,  ...)
// startMenu( ime , false-horizontalno, horiz. udaljenost teksta , horiz. udaljenost celija , visina , osobine )

var hBar = new ItemStyle(100, 20, '', 0, 2, '', '', 'itemTop', 'hTop', 'noborder', 'noborder',null, null, 'default', 'default');
var iBar = new ItemStyle(100, 10, '', 0, 2, '', '', 'itemTop', 'iTop', 'noborder', 'noborder',null, null, 'default', 'default');
var mBar = new ItemStyle(100, 10, '', 0, 2, '', '', 'itemTop', 'iTop', 'noborder', 'noborder',null, null, 'hand', 'default');
var subM = new ItemStyle(22, 0, '', 0, 2, '#1F3F6A', '#1F3F6A', 'itemTxt', 'HTxt','mborder', 'mborder', null, null, 'hand', 'default');
var fBar = new ItemStyle(60, 40, '', 0, 2, '', '', 'itemTop', 'iTop', 'noborder', 'noborder',null, null, 'hand', 'hand');
var sBar = new ItemStyle(70, 40, '', 0, 2, '', '', 'itemTop', 'itemTop', 'noborder', 'noborder',null, null, 'default', 'default');
var txtBar = new ItemStyle(150, 1, '', 0, 0, '', '', 'Txt', 'Txt','noboder', 'noborder', null, null);

var pMenu = new PopupMenu('pMenu');
with (pMenu)
{

startMenu('root',false, 'page.winW()/2 - 300', '50', 19, hBar);

addItem('INFO', 'index.html','',mBar);
addItem('ŠKOLA', 'SKOLA', 'sm:',iBar);
addItem('ĐACI','DJACI', 'sm:',iBar);
addItem('GALERIJA', 'galerija_webizlozba.html', '',mBar);
addItem('KONTAKT', 'KONTAKT', 'sm:',iBar);
addItem('FORUM','void(window.open("http://www.suz.edu.rs/foroom/index.php","","width=800,height=500,scrollbars=1,menubar=1,toolbar=1,status=1,resizable=1"));', 'js:',mBar);

startMenu('SKOLA', true, 0, 20, 100, subM);
addItem('istorijat', 'skola_profil.html','');
addItem('profili', 'smerovi.html','');
addItem('predmeti', 'skola_predmeti.html','');
addItem('kolektiv', 'skola_zaposleni.html','');
addItem('priprema', 'skola_priprema.html','');
addItem('prijemni', 'skola_prijemni.html','');

startMenu('DJACI', true, 0, 20, 100, subM);
addItem('aktuelnosti', 'djaci_aktuelnosti10.php','');
addItem('prezentacije', 'djaci_prezentacije.html','');
addItem('generacije', 'djaci_generacije.html','');
addItem('foto album', 'djaci_fotoalbum.html','');
addItem('nagrade', 'djaci_nagrade.html','');
addItem('ispiti', 'djaci_ispiti.php','');
addItem('download', 'djaci_download.php','');
addItem('linkovi','djaci_linkovi.html', '');

startMenu('KONTAKT', true, 0, 20, 100, subM);
addItem('adrese','kontakt_adrese.php', '');
addItem('mapa','kontakt_mapa.html', '');

}




// ******************** (4) MENU ACTIVATION & EVENTS ********************
//
// In JavaScript, there are document 'events' you need to set so any scripts you are using
// are notified of things like page loading/clicking/scrolling. Unfortunately, every time you
// set them, they override a previous setting, so if you're adding multiple scripts to your
// page you may need to collate all the events in this one section. My syntax is:

//object.onevent = function()
//{
// function1();
// function2();
// ...
//}

// That's similar to: <BODY ONEVENT="function1(); function2(); ...">


// The most important event is one used to display the menu by calling one of several methods of
// any menu object(s) you have created. This is where you select the menu creation mode. 'Dynamic'
// mode inserts the menus into the document once it has finished loading and supports features
// like modifying the menu after creation. You update a menu in 'Dynamic' mode by just calling the
// .update() without a parameter.
//    'Fast' creation mode writes the menus to the document here and now, which is faster and
// more reliable in many browsers but only when the document's loading -- you do this by passing
// 'true' without quotes to the update function to signal that we're inline.
//    IE4/Mac and Opera 5/6 only support Fast mode and NS4 only supports in Dynamic mode, so we use
// browser-detect code here. If you find some browser has troubles with one mode or another, try
// the other menu creation method -- see the "Cross-Browser" code at the very top of the SCRIPT
// tag for the variables used.
//    Hardcore tweakers -- there's some extra code commented in the popOver() function at the top
// which lets you create the root menu on page load and other menus only as needed, which will
// give a massive speed boost to very large menus in a single frame. Look it up if you want.


// Basically, we loop through the list of PopupMenu objects, handling all of them in turn.

function doFunc(str)
{
 var PML = PopupMenu.list;
 for (var m in PML) with (PML[m]) eval(str);
}

if (!isNS4)
{
 // Write menus now in non-NS4 browsers, by calling the "Fast" mode .update(true) method.
 doFunc('update(true)');
}
else
{
 // For Netscape 4, back up the old onload function and make a new one to update our menus.
 // This is the regular "Dynamic" mode menu update, it works in IE and NS6+ too if required.
 var popOldOL = window.onload;
 window.onload = function()
 {
  if (popOldOL) popOldOL();
  doFunc('update()');
 }
}


// Other events must be assigned, these are less complicated, just add or remove menu objects.

var nsWinW = window.innerWidth, nsWinH = window.innerHeight, popOldOR = window.onresize;
window.onresize = function()
{
 if (popOldOR) popOldOR();
 if (isNS4 && (nsWinW!=innerWidth || nsWinH!=innerHeight)) history.go(0);
 doFunc('position()');
}

// Set a function to run on page scroll, use onscroll preferably or setInterval otherwise.
function scrollFunc()
{
 doFunc('position()');
}

if (window.onscroll==null) window.onscroll = scrollFunc;
else
{
 var nsPX=pageXOffset, nsPY=pageYOffset;
 setInterval('if (nsPX!=pageXOffset || nsPY!=pageYOffset) ' +
 '{ nsPX=pageXOffset; nsPY=pageYOffset; scrollFunc() }', 50);
}


// NS4 can't reliably capture clicks on layers, so here's a workaround.
if (isNS4)
{
 document.captureEvents(Event.CLICK);
 document.onclick = function(evt)
 {
  doFunc('if (overI) click(overM, overI)');
  return document.routeEvent(evt);
 }
}








// POSITIONING FROM PAGE ANCHORS:
//
// This function allows you to position the script from an <A NAME=... ID=...> tag on the page.
// It extends the "page" object in the cross-browser code, and is required if you are using this
// positioning feature, but can be deleted otherwise to reduce filesize.

page.elmPos=function(elm,par)
{
 var eX=0,eY=0,w=par?par:this.win;
 elm=elm?(elm.substr?(isNS4?w.document.anchors[elm]:getRef(elm,w)):elm):par;
 if (isNS4){ if(elm){eX=elm.x;eY=elm.y}; if(par){eX+=par.pageX;eY+=par.pageY} }
 else while(elm) with(elm){ eX+=offsetLeft;eY+=offsetTop;elm=offsetParent }
 return {x:eX,y:eY};
}


