function bookmarksite(title, url){
	if (document.all){
		window.external.AddFavorite(url, title);
	}else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_findObj(n, d) 
 { //v4.01
  var p,i,x;  if(!d) d=document; 
  if((p=n.indexOf("?"))>0&&parent.frames.length){
	  d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
  }
  if(!(x=d[n])&&d.all) x=d.all[n]; 
  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers(){
	var i,p,v,obj,args=MM_showHideLayers.arguments;
    for (i=0; i<(args.length-2); i+=3) 
    	if ((obj=MM_findObj(args[i]))!=null){
			v=args[i+2];
       		if (obj.style){
				obj=obj.style;
				v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
	    	}
       		obj.visibility=v; 
	 	}
}

function MM_openBrWindow(theURL,winName,features){ 
	window.open(theURL,winName,features);
}

function ShowSubMenu(mode){
	var name = '';
	var elements = 1;
	var id = 0;
	
	// Close all sub-menus using mootols
  $$('#meni_levo  dd').each(function(el){
		 el.setStyle('display', 'none');
	});

	for (i=0; i<elements; i++){
		name = mode+'submenu'+i;
		name = document.getElementById(name);
		if (name != null){
			elements++;
			if (name.style.display == ''){
				name.style.display = 'none'
			}else{
				name.style.display = '';
			}
		}
	}
}

function DeletePollOption(id){
	object = document.getElementById(id);
	table = document.getElementById('pollTable');
	try{
		table.removeChild(object);
	}catch(ex){
	}
	var count = document.getElementById('pollOptionsCount');
	count.setAttribute('value', (count.value-1))
}

function AddPollOption(){
	var table = document.getElementById('pollTable');
	var count = document.getElementById('pollOptionsCount');
	var number = (count.value-1+2);
	var objectr = table.insertRow(-1); 
	objectr.setAttribute('id','polltr'+number);
	var objecttd = objectr.insertCell(-1); 
	var pollinput = document.createElement('input');
	pollinput.setAttribute('type', 'text');
	pollinput.setAttribute('id', 'pollOptions'+number);
	pollinput.setAttribute('name','pollOptions[]');
	pollinput.setAttribute('size','35');
	objecttd.appendChild(pollinput);
	var name = 'polltr'+number;
	objecttd.innerHTML += '<a href="javascript:DeletePollOption(\''+name+'\');">	<img src="/images/gumbi/slo_skupnost_izbrisi.png" alt="Zbrisi" title="Zbrisi" style="border:0px; height:16px; width:16px" /></a>';
	table.appendChild(objectr);
	count.setAttribute('value',(count.value-1+2));
}

function ChangeDownloadChoice(){
	var urltable = document.getElementById('urlchoice');
	var filetable = document.getElementById('filechoice');
	if (urltable.style.display == ''){
		urltable.style.display = 'none'
		filetable.style.display = ''
	}else{
		urltable.style.display = '';
		filetable.style.display = 'none'
	}
}

function addHTMLCode(){
	var commandinput = document.getElementById('commandinput');
	var htmlselect = document.getElementById('html_commands');
	var option = htmlselect.options[htmlselect.selectedIndex].value;
	if (option == 'br'){
		commandinput.value = '<br>';
	}else{
		if (option == 'img'){
			commandinput.value = '<img name="IME SLIKE" src="LINK DO DATOTEKE" width="200" height="200" alt="CE NE NAJDE SLIKE BO NAPISAL KAR NAPISETE SEMLE">';
		}else{
			if (option == 'href'){
				commandinput.value = '<a href="LINK(URL) KAMOR NAJ TE PREUSMERI" target="_blank">LINK TEKST (PRIMER: TOLE je domaca stran XYZ)</a>';
			}
		}
	}
}
				
function redirect(link,interval){
	if (typeof(this.time) == 'undefined'){
		this.time = interval;
	}
 
	if (this.time == 0){
		this.time = interval;
		location.href = link;
	}else{
		this.time = this.time-1;
		spantime = document.getElementById('timespan');
		spantime.innerHTML = this.time;
	}
}