(function() {
  var fs = {
    "-1024"      : "12px",
    "1025-1280"  : "13px",
    "1281-1400"  : "13px",
    "1401-1600"  : "1em",
    "1601-"      : "1.1em"
  }, w = screen.width, i, s, a, z;
  for (i in fs) {
    if (/^([0-9]*)-([0-9]*)$/.test(i)) {
      a = RegExp.$1;
      z = RegExp.$2;
      if (s = ((!a || w >= a) && (!z || w <= z) && fs[i])) {
	document.write("<style type='text/css'>body { font-size: "
		       + s + " }</style>");
	break;
      }
    }
  }
})();

function reload(form){
var val=form.grupe.options[form.grupe.options.selectedIndex].value;
var tabid=document.form.tabid.value;
var tabindex=document.form.tabindex.value;
var portalid=document.form.portalid.value;
var modid=document.form.modid.value;

self.location='i2.php?tabid=' + tabid + '&tabindex=' + tabindex + '&portalid=' + portalid +'&cat=' +val+'&modid=' +modid;
}
function create(form) {
var tip_polja=document.form.tip_polja.value;
self.location='i2.php?tabid=' + tabid + '&tabindex=' + tabindex + '&portalid=' + portalid +'&tip_polja=' +tip_polja;
}

<!--
function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}
//-->

function initShowHideDivs()
{
	var divs = document.getElementsByTagName('DIV');
	var divCounter = 1;
	for(var no=0;no<divs.length;no++){
		if(divs[no].className=='question'){
			divs[no].onclick = showHideContent;
			divs[no].id = 'dhtmlgoodies_q'+divCounter;
			var answer = divs[no].nextSibling;
			while(answer && answer.tagName!='DIV'){
				answer = answer.nextSibling;
			}
			answer.id = 'dhtmlgoodies_a'+divCounter;	
			contentDiv = answer.getElementsByTagName('DIV')[0];
			contentDiv.style.top = 0 - contentDiv.offsetHeight + 'px'; 	
			contentDiv.className='answer_content';
			contentDiv.id = 'dhtmlgoodies_ac' + divCounter;
			answer.style.display='none';
			answer.style.height='1px';
			divCounter++;
		}		
	}	
}

// JavaScript Document - Loading
document.write('<div id="loading"><br>Stranica se u&#269;itava...<br><br><image src=images/bg/loader.gif></div>');

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(function() {
  document.getElementById("loading").style.display="none";
});

// Kontakt forma - popup DIV
x = 30;
y = 40;
function setVisible(obj)
{
	obj = document.getElementById(obj);
	obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
}
function placeIt(obj)
{
	obj = document.getElementById(obj);
	if (document.documentElement)
	{
		theLeft = document.documentElement.scrollLeft;
		theTop = document.documentElement.scrollTop;
	}
	else if (document.body)
	{
		theLeft = document.body.scrollLeft;
		theTop = document.body.scrollTop;
	}
	theLeft += x;
	theTop += y;
	obj.style.left = theLeft + '%' ;
	obj.style.top = theTop + '%' ;
	setTimeout("placeIt('layer1')",500);
}

// IEUpdate
theObjects = document.getElementsByTagName("object");
	for (var i = 0; i < theObjects.length; i++) 
{
	theObjects[i].outerHTML = theObjects[i].outerHTML;
}

function UpozorenjeView()
	{
		alert("UPOZORENJE!!!"+ '\n' + "Ukljucivanjem ove opcije svi posetioci"+ '\n' + "mogu videti sadržaj ovog menija!!")
	}
function UpozorenjeEdit()
	{
		alert("UPOZORENJE!!!"+ '\n' + "Ukljucivanjem ove opcije omogućavate"+ '\n' + "svim posetiocima da menjaju, brišu i dodaju nove sadržaje!!")
	}

function checkedAll (id, checked) 
	{
	var el = document.getElementById(id);
	for (var i = 0; i < el.elements.length; i++) 
		{
	  	el.elements[i].checked = checked;
		}
  }