/////////////////////////////////////////////////////////////////////////////////
//
// OU JS
//
// v1.35 17.7.2010. TCrnicki
//
/////////////////////////////////////////////////////////////////////////////////

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

window.defaultStatus="Oprema-uredjaji";

function S(Msg) {
  if (Msg=='') { Msg='Oprema-uredjaji' }
  else { Msg='Oprema-uredjaji: '+Msg }
  window.status=Msg;
  return(true);
} 

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

function DekodirajURI() {
  if (!document.getElementsByTagName && !document.createElement && !document.createTextNode) return;
  var cvorovi=document.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=document.createElement('a');
      var URI=cvorovi[i].firstChild.nodeValue;

      URI = URI.replace(na,'@');
      URI = URI.replace(tocka,'.');
      cvor.setAttribute('href','mailto:'+URI);
      cvor.setAttribute('className','F8L');
      cvor.setAttribute('class','F8L');
      cvor.appendChild(document.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;
        }
    }
  }
}

//-------------------------------------------------------------------------------
// menu
//-------------------------------------------------------------------------------

function ddInit() {

  if ( getO('ouMENU') ) {
    ddsmoothmenu.init({
      mainmenuid: 'ouMENU',
      orientation: 'h',
      classname: 'ddsmoothmenu',
      contentsource: 'markup'
    })
  }

  if ( getO('ouKONT') ) {
    ddsmoothmenu.init({
      mainmenuid: 'ouKONT',
      orientation: 'v',
      classname: 'ddsmoothmenu-v',
      contentsource: 'markup'
    })
  }

  if ( getO('ouDIST') ) {
    ddsmoothmenu.init({
      mainmenuid: 'ouDIST',
      orientation: 'v',
      classname: 'ddsmoothmenu-v',
      contentsource: 'markup'
    })
  }

  if ( getO('ouCOO1') ) {
    ddsmoothmenu.init({
      mainmenuid: 'ouCOO1',
      orientation: 'v',
      classname: 'ddsmoothmenu-v',
      contentsource: 'markup'
    })
  }

  if ( getO('ouCOO2') ) {
    ddsmoothmenu.init({
      mainmenuid: 'ouCOO2',
      orientation: 'v',
      classname: 'ddsmoothmenu-v',
      contentsource: 'markup'
    })
  }

  if ( getO('ouCOO3') ) {
    ddsmoothmenu.init({
      mainmenuid: 'ouCOO3',
      orientation: 'v',
      classname: 'ddsmoothmenu-v',
      contentsource: 'markup'
    })
  }

}


//-------------------------------------------------------------------------------
// style/button switch
//-------------------------------------------------------------------------------

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

function B(pO,pID) {
  pO.src=pO.src.replace(/[0-2]./,pID+'.');
}

//-------------------------------------------------------------------------------
// vracanje vrijednosti polja
//-------------------------------------------------------------------------------

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

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

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

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

function retVal(pID) {
  var tVAL=eval(pID);
  return(tVAL)
}


//-------------------------------------------------------------------------------
// support menu
//-------------------------------------------------------------------------------

function showPOD(pID) {
  for (var tI=0; tI<4; tI++) {
    getO('poddiv'+tI).style.display='none';
    getO('podtd'+tI).className='tdSUP00'
  }
  getO('poddiv'+pID).style.display='block';
  getO('podtd'+pID).className='tdSUP10'
  
}
