
var t;var v=0;function Check(forma){var niz=new Array();niz[0]="\"Ime:\"";niz[1]="\"Prezime:\"";niz[2]="\"Nadimak:\"";niz[3]="\"Datum Rodjenja:\"";niz[4]="\"Datum Uclanjenja:\"";niz[5]="\"Fakultet:\"";niz[6]="\"E-mail:\"";niz[7]="\"Broj Mobilnog:\"";niz[8]="\"Status:\"";niz[9]="\"Tim:\"";for(i=0;i<10;i++)
{if(i==8&&forma.elements[i].value==0)
{alert("Popunite polje "+niz[i]+".");forma.elements[i].focus();return false;}
if(forma.elements[i].value==""){alert("Popunite polje "+niz[i]+".");forma.elements[i].focus();return false;}}
return true;}
function mainCheck(forma){if(Check(forma))return true;else return false;}
function CheckFtpFileForm()
{var test=document.getElementById("newfile").value=="";if(test)
{alert("Morate izabrati datoteku!");return false;}
return true;}
function LoadBadgesForMember(divId){if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();document.getElementById(divId).innerHTML="<center><h2>Učitavanje...</h2></center>";document.getElementById("clanovi").disabled=true;document.getElementById("znacke").disabled=true;}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");document.getElementById(divId).innerHTML="<center><h2>Učitavanje...</h2></center>";document.getElementById("clanovi").disabled=true;}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){document.getElementById("clanovi").disabled=false;document.getElementById("znacke").disabled=false;document.getElementById(divId).innerHTML=xmlhttp.responseText; }}
var sel=document.getElementById("clanovi");var listLength=sel.options.length;var id;for(var i=0;i<listLength;i++){if(sel.options[i].selected){id=sel.options[i].value;break;}}
if(id<0)return;var string="badgesDiv.php"+"?id="+id;xmlhttp.open("POST",string);xmlhttp.send();}
function LoadBadgesForMemberStartup(divId){if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){document.getElementById("clanovi").disabled=false;document.getElementById(divId).innerHTML=xmlhttp.responseText; }}
var sel=document.getElementById("clanovi");var listLength=sel.options.length;var id;sel.options[2].selected=true;id=sel.options[2].value;if(id<0)return;var string="badgesDiv.php"+"?id="+id;xmlhttp.open("POST",string);xmlhttp.send();}
function LoadAddBadgesForm(divId){if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();document.getElementById(divId).innerHTML="<center><h2>Učitavanje...</h2></center>";document.getElementById("znacke").disabled=true;document.getElementById("clanovi").disabled=true;}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");document.getElementById(divId).innerHTML="<center><h2>Učitavanje...</h2></center>";document.getElementById("znacke").disabled=true;}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){document.getElementById("znacke").disabled=false;document.getElementById("clanovi").disabled=false;document.getElementById(divId).innerHTML=xmlhttp.responseText; }}
var sel=document.getElementById("znacke");var listLength=sel.options.length;var id;for(var i=0;i<listLength;i++){if(sel.options[i].selected){id=sel.options[i].value;break;}}
if(id<0)return;var string="badgesAddDiv.php"+"?id="+id;xmlhttp.open("POST",string);xmlhttp.send();}
function LoadAddBadgesFormStartup(divId){if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){document.getElementById(divId).innerHTML=xmlhttp.responseText; }}
var sel=document.getElementById("znacke");var listLength=sel.options.length;var id;sel.options[2].selected=true;id=sel.options[2].value;if(id<0)return;var string="badgesAddDiv.php"+"?id="+id;xmlhttp.open("POST",string);xmlhttp.send();}
function AddBadgeToMember(){if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();document.getElementById("znacke").disabled=true;document.getElementById("clanovi").disabled=true;}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");document.getElementById("znacke").disabled=true;}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){document.getElementById("znacke").disabled=false;document.getElementById("clanovi").disabled=false;document.getElementById("znackeForma").innerHTML=xmlhttp.responseText;LoadBadgesForMember("znackeClan");}}
var sel=document.getElementById("znacke");var listLength=sel.options.length;var clanId,znackaId,opis;for(var i=0;i<listLength;i++){if(sel.options[i].selected){znackaId=sel.options[i].value;break;}}
sel=document.getElementById("clanovi");listLength=sel.options.length;for(var i=0;i<listLength;i++){if(sel.options[i].selected){clanId=sel.options[i].value;break;}}
if(clanId<0||znackaId<0)return;opis=document.getElementById("znackaOpis").value;var string="badgesAddToMember.php"+"?clanId="+clanId;string+="&znackaId="+znackaId+"&opis="+opis;xmlhttp.open("POST",string);xmlhttp.send();}
function DeleteBadge()
{var sel=document.getElementById("znacke");if(!confirm("Brisanje bedža iz sistema briše bedž sa ovom slikom i imenom kod svih članova! Da li želite da obrišete bedž?"))
return;if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();document.getElementById("addBadgePage").innerHTML="<center><h2>Učitavanje...</h2></center>";}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){document.getElementById("addBadgePage").innerHTML=xmlhttp.responseText; 
StartUp();}}
var listLength=sel.options.length;var znackaId,opis;for(var i=0;i<listLength;i++){if(sel.options[i].selected){znackaId=sel.options[i].value;break;}}
if(znackaId<0)return;var string="badgesDeleteBadgeFromSystem.php"+"?badgeId="+znackaId;xmlhttp.open("POST",string);xmlhttp.send();}
function DeleteBadgeFromMember(badgeId)
{if(!confirm("Da li želite da obrišete bedž?"))
return;if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){document.getElementById("znackeClan").innerHTML=xmlhttp.responseText; }}
var clanId=-1;sel=document.getElementById("clanovi");listLength=sel.options.length;for(var i=0;i<listLength;i++){if(sel.options[i].selected){clanId=sel.options[i].value;break;}}
if(clanId<0||badgeId<0)return;var string="badgesDeleteBadgeFromMember.php"+"?clanId="+clanId;string+="&badgeId="+badgeId;xmlhttp.open("POST",string);xmlhttp.send();}
function ftp_open(link){if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();document.getElementById("innerpage").innerHTML="<center><h3>Učitavanje...</hr><br><table><tr><td><div style='width:200px;height:10px;' id='progressbar'></div></td></tr></table></center>";$("#progressbar").progressbar({value:0});t=setInterval("Tick()",100);}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");document.getElementById("innerpage").innerHTML="Učitavanje..."}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){v=0;clearTimeout(t);document.getElementById("innerpage").innerHTML=xmlhttp.responseText;}}
xmlhttp.open("POST",link);xmlhttp.send();}
function Tick()
{if(v==100)
{v=0;}
else
{v=v+5;}
$("#progressbar").progressbar({value:v});}
function ftp_delete_file(link){if(confirm("Da li želite da obrišete izabrani dokument/folder?")){if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();document.getElementById("innerpage").innerHTML="<center><h3>Učitavanje...</hr><br><table><tr><td><div style='width:200px;height:10px;' id='progressbar'></div></td></tr></table></center>";$("#progressbar").progressbar({value:0});t=setInterval("Tick()",100);}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");document.getElementById("innerpage").innerHTML="Učitavanje..."}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){v=0;clearTimeout(t);document.getElementById("innerpage").innerHTML=xmlhttp.responseText;}}
xmlhttp.open("POST",link);xmlhttp.send();}}
function ftp_mkdir(current){var name=document.getElementById("addfolder").value;if(name=="")
{alert("Morate uneti ime direktorijuma!")
return;}
if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();document.getElementById("innerpage").innerHTML="<center><h3>Učitavanje...</hr><br><table><tr><td><div style='width:200px;height:10px;' id='progressbar'></div></td></tr></table></center>";$("#progressbar").progressbar({value:0});t=setInterval("Tick()",100);}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");document.getElementById("innerpage").innerHTML="Učitavanje..."}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){v=0;clearTimeout(t);document.getElementById("innerpage").innerHTML=xmlhttp.responseText;}}
link="dokumenta.php?folder="+current+"&make_dir="+name;xmlhttp.open("POST",link);xmlhttp.send();}
function ftp_sort(type,current){if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();document.getElementById("innerpage").innerHTML="<center><h3>Učitavanje...</hr><br><table><tr><td><div style='width:200px;height:10px;' id='progressbar'></div></td></tr></table></center>";$("#progressbar").progressbar({value:0});t=setInterval("Tick()",100);}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");document.getElementById("innerpage").innerHTML="Učitavanje..."}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){v=0;clearTimeout(t);document.getElementById("innerpage").innerHTML=xmlhttp.responseText;}}
link="dokumenta.php?folder="+current+"&"+type+"=1";xmlhttp.open("POST",link);xmlhttp.send();}
function ClanAutocomplete()
{(function($){$.widget("ui.combobox",{_create:function(){var self=this,select=this.element.hide(),selected=select.children(":selected"),value=selected.val()?selected.text():"";var input=this.input=$("<input>").insertAfter(select).val(value).autocomplete({disabled:false,delay:0,minLength:0,source:function(request,response){var matcher=new RegExp($.ui.autocomplete.escapeRegex(request.term),"i");response(select.children("option").map(function(){var text=$(this).text();if(this.value&&(!request.term||matcher.test(text)))
return{label:text.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+
$.ui.autocomplete.escapeRegex(request.term)+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>"),value:text,option:this};}));},select:function(event,ui){ui.item.option.selected=true;self._trigger("selected",event,{item:ui.item.option});},change:function(event,ui){if(!ui.item){var matcher=new RegExp("^"+$.ui.autocomplete.escapeRegex($(this).val())+"$","i"),valid=false;select.children("option").each(function(){if($(this).text().match(matcher)){this.selected=valid=true;return false;}});if(!valid){$(this).val("");select.val("");input.data("autocomplete").term="";return false;}}}}).addClass("ui-widget ui-widget-content ui-corner-left");input.data("autocomplete")._renderItem=function(ul,item){return $("<li></li>").data("item.autocomplete",item).append("<a>"+item.label+"</a>").appendTo(ul);};this.button=$("<button type='button'>&nbsp;</button>").attr("tabIndex",-1).attr("title","Prikaži sve opcije").insertAfter(input).button({icons:{primary:"ui-icon-triangle-1-s"},text:false}).removeClass("ui-corner-all").addClass("ui-corner-right ui-button-icon").click(function(){if(input.autocomplete("widget").is(":visible")){input.autocomplete("close");return;}
$(this).blur();input.autocomplete("search","");input.focus();});},destroy:function(){this.input.remove();this.button.remove();this.element.show();$.Widget.prototype.destroy.call(this);}});})(jQuery);}
function AddMemberToList(listId)
{var list=document.getElementById(listId);var memberId=$("#clanovi").val();var membersInList=list.childNodes;if(membersInList.length>1)
{for(var i=1;i<membersInList.length;i++)
{var clan=membersInList[i];if(clan.value==memberId)
{alert("Član je već dodat u listu!");return;}}}
var clanovi=document.getElementById("clanovi").childNodes;var memberName;for(var i=0;i<clanovi.length;i++)
{var clan=clanovi[i].nextSibling;if(clan.value==memberId)
{memberName=clan.innerHTML;break;}}
var optionElement=document.createElement("option");optionElement.setAttribute("value",memberId);optionElement.innerHTML=memberName;list.appendChild(optionElement);}
function RemoveMemberFromList(listId)
{var list=document.getElementById(listId);var membersInList=list.childNodes;var membersToRemove=new Array();if(membersInList.length>1)
{for(var i=1,j=0;i<membersInList.length;i++)
{var clan=membersInList[i];if(clan.value!="-1"&&clan.selected)
{membersToRemove[j++]=clan;}}
for(var i=0;i<membersToRemove.length;i++)
{list.removeChild(membersToRemove[i]);}}}
function AddNewEvent()
{var form=document.createElement("form");form.setAttribute("action","dodajDogadjaj.php");form.setAttribute("method","post");var naziv=document.createElement("input");naziv.setAttribute("type","hidden");naziv.setAttribute("name","naziv");naziv.setAttribute("value",$("#eventName").val());form.appendChild(naziv);var organizer=document.createElement("input");organizer.setAttribute("type","hidden");organizer.setAttribute("name","organizator");organizer.setAttribute("value",$("#organizer").val());form.appendChild(organizer);var mesto=document.createElement("input");mesto.setAttribute("type","hidden");mesto.setAttribute("name","mesto");mesto.setAttribute("value",$("#eventPlace").val());form.appendChild(mesto);var opis=document.createElement("input");opis.setAttribute("type","hidden");opis.setAttribute("name","opis");opis.setAttribute("value",$("#eventDesc").val());form.appendChild(opis);var participants="";var partList=document.getElementById("partBox").options;for(var i=1;i<partList.length;i++)
{participants+=partList[i].value+";";}
var ucesnici=document.createElement("input");ucesnici.setAttribute("type","hidden");ucesnici.setAttribute("name","ucesnici");ucesnici.setAttribute("value",participants);form.appendChild(ucesnici);var mos="";var moList=document.getElementById("orgBox").options;for(var i=1;i<moList.length;i++)
{mos+=moList[i].value+";";}
var odgovorni=document.createElement("input");odgovorni.setAttribute("type","hidden");odgovorni.setAttribute("name","odgovorni");odgovorni.setAttribute("value",mos);form.appendChild(odgovorni);var frs="";var frList=document.getElementById("frBox").options;for(var i=1;i<frList.length;i++)
{frs+=frList[i].value+";";}
var fratori=document.createElement("input");fratori.setAttribute("type","hidden");fratori.setAttribute("name","fratori");fratori.setAttribute("value",frs);form.appendChild(fratori);var fromDate=$("#from").val();if(!CheckDate(fromDate))
return;var toDate=$("#to").val();if(!CheckDate(toDate))
return;var datump=document.createElement("input");datump.setAttribute("type","hidden");datump.setAttribute("name","datump");datump.setAttribute("value",fromDate);form.appendChild(datump);var datumk=document.createElement("input");datumk.setAttribute("type","hidden");datumk.setAttribute("name","datumk");datumk.setAttribute("value",toDate);form.appendChild(datumk);document.body.appendChild(form);form.submit();document.body.removeChild(form);}
function SaveEventData()
{var form=document.createElement("form");form.setAttribute("action","izmeniulogedogadjaj.php");form.setAttribute("method","post");var idP=document.createElement("input");idP.setAttribute("type","hidden");idP.setAttribute("name","idP");idP.setAttribute("value",$("#idP").val());form.appendChild(idP);var naziv=document.createElement("input");naziv.setAttribute("type","hidden");naziv.setAttribute("name","naziv");naziv.setAttribute("value",$("#eventName").val());form.appendChild(naziv);var organizer=document.createElement("input");organizer.setAttribute("type","hidden");organizer.setAttribute("name","organizator");organizer.setAttribute("value",$("#organizer").val());form.appendChild(organizer);var mesto=document.createElement("input");mesto.setAttribute("type","hidden");mesto.setAttribute("name","mesto");mesto.setAttribute("value",$("#eventPlace").val());form.appendChild(mesto);var opis=document.createElement("input");opis.setAttribute("type","hidden");opis.setAttribute("name","opis");opis.setAttribute("value",$("#eventDesc").val());form.appendChild(opis);var participants="";var partList=document.getElementById("partBox").options;for(var i=1;i<partList.length;i++)
{participants+=partList[i].value+";";}
var ucesnici=document.createElement("input");ucesnici.setAttribute("type","hidden");ucesnici.setAttribute("name","ucesnici");ucesnici.setAttribute("value",participants);form.appendChild(ucesnici);var mos="";var moList=document.getElementById("orgBox").options;for(var i=1;i<moList.length;i++)
{mos+=moList[i].value+";";}
var odgovorni=document.createElement("input");odgovorni.setAttribute("type","hidden");odgovorni.setAttribute("name","odgovorni");odgovorni.setAttribute("value",mos);form.appendChild(odgovorni);var frs="";var frList=document.getElementById("frBox").options;for(var i=1;i<frList.length;i++)
{frs+=frList[i].value+";";}
var fratori=document.createElement("input");fratori.setAttribute("type","hidden");fratori.setAttribute("name","fratori");fratori.setAttribute("value",frs);form.appendChild(fratori);var fromDate=$("#from").val();if(!CheckDate(fromDate))
return;var toDate=$("#to").val();if(!CheckDate(toDate))
return;var datump=document.createElement("input");datump.setAttribute("type","hidden");datump.setAttribute("name","datump");datump.setAttribute("value",fromDate);form.appendChild(datump);var datumk=document.createElement("input");datumk.setAttribute("type","hidden");datumk.setAttribute("name","datumk");datumk.setAttribute("value",toDate);form.appendChild(datumk);document.body.appendChild(form);form.submit();document.body.removeChild(form);}
function AddNewProject()
{var form=document.createElement("form");form.setAttribute("action","dodajProjekat.php");form.setAttribute("method","post");var naziv=document.createElement("input");naziv.setAttribute("type","hidden");naziv.setAttribute("name","naziv");naziv.setAttribute("value",$("#eventName").val());form.appendChild(naziv);var organizer=document.createElement("input");organizer.setAttribute("type","hidden");organizer.setAttribute("name","organizator");organizer.setAttribute("value",$("#organizer").val());form.appendChild(organizer);var mesto=document.createElement("input");mesto.setAttribute("type","hidden");mesto.setAttribute("name","mesto");mesto.setAttribute("value",$("#eventPlace").val());form.appendChild(mesto);var opis=document.createElement("input");opis.setAttribute("type","hidden");opis.setAttribute("name","opis");opis.setAttribute("value",$("#eventDesc").val());form.appendChild(opis);var participants="";var partList=document.getElementById("partBox").options;for(var i=1;i<partList.length;i++)
{participants+=partList[i].value+";";}
var ucesnici=document.createElement("input");ucesnici.setAttribute("type","hidden");ucesnici.setAttribute("name","ucesnici");ucesnici.setAttribute("value",participants);form.appendChild(ucesnici);var mos="";var moList=document.getElementById("orgBox").options;for(var i=1;i<moList.length;i++)
{mos+=moList[i].value+";";}
var odgovorni=document.createElement("input");odgovorni.setAttribute("type","hidden");odgovorni.setAttribute("name","odgovorni");odgovorni.setAttribute("value",mos);form.appendChild(odgovorni);var frs="";var frList=document.getElementById("frBox").options;for(var i=1;i<frList.length;i++)
{frs+=frList[i].value+";";}
var fratori=document.createElement("input");fratori.setAttribute("type","hidden");fratori.setAttribute("name","fratori");fratori.setAttribute("value",frs);form.appendChild(fratori);var fromDate=$("#from").val();if(!CheckDate(fromDate))
return;var toDate=$("#to").val();if(!CheckDate(toDate))
return;var datump=document.createElement("input");datump.setAttribute("type","hidden");datump.setAttribute("name","datump");datump.setAttribute("value",fromDate);form.appendChild(datump);var datumk=document.createElement("input");datumk.setAttribute("type","hidden");datumk.setAttribute("name","datumk");datumk.setAttribute("value",toDate);form.appendChild(datumk);document.body.appendChild(form);form.submit();document.body.removeChild(form);}
function SaveProjectData()
{var form=document.createElement("form");form.setAttribute("action","izmeniulogeprojekat.php");form.setAttribute("method","post");var idP=document.createElement("input");idP.setAttribute("type","hidden");idP.setAttribute("name","idP");idP.setAttribute("value",$("#idP").val());form.appendChild(idP);var naziv=document.createElement("input");naziv.setAttribute("type","hidden");naziv.setAttribute("name","naziv");naziv.setAttribute("value",$("#eventName").val());form.appendChild(naziv);var organizer=document.createElement("input");organizer.setAttribute("type","hidden");organizer.setAttribute("name","organizator");organizer.setAttribute("value",$("#organizer").val());form.appendChild(organizer);var mesto=document.createElement("input");mesto.setAttribute("type","hidden");mesto.setAttribute("name","mesto");mesto.setAttribute("value",$("#eventPlace").val());form.appendChild(mesto);var opis=document.createElement("input");opis.setAttribute("type","hidden");opis.setAttribute("name","opis");opis.setAttribute("value",$("#eventDesc").val());form.appendChild(opis);var participants="";var partList=document.getElementById("partBox").options;for(var i=1;i<partList.length;i++)
{participants+=partList[i].value+";";}
var ucesnici=document.createElement("input");ucesnici.setAttribute("type","hidden");ucesnici.setAttribute("name","ucesnici");ucesnici.setAttribute("value",participants);form.appendChild(ucesnici);var mos="";var moList=document.getElementById("orgBox").options;for(var i=1;i<moList.length;i++)
{mos+=moList[i].value+";";}
var odgovorni=document.createElement("input");odgovorni.setAttribute("type","hidden");odgovorni.setAttribute("name","odgovorni");odgovorni.setAttribute("value",mos);form.appendChild(odgovorni);var frs="";var frList=document.getElementById("frBox").options;for(var i=1;i<frList.length;i++)
{frs+=frList[i].value+";";}
var fratori=document.createElement("input");fratori.setAttribute("type","hidden");fratori.setAttribute("name","fratori");fratori.setAttribute("value",frs);form.appendChild(fratori);var fromDate=$("#from").val();if(!CheckDate(fromDate))
return;var toDate=$("#to").val();if(!CheckDate(toDate))
return;var datump=document.createElement("input");datump.setAttribute("type","hidden");datump.setAttribute("name","datump");datump.setAttribute("value",fromDate);form.appendChild(datump);var datumk=document.createElement("input");datumk.setAttribute("type","hidden");datumk.setAttribute("name","datumk");datumk.setAttribute("value",toDate);form.appendChild(datumk);document.body.appendChild(form);form.submit();document.body.removeChild(form);}
function CheckDate(date)
{var dateTokens=date.split("-");if(dateTokens.length!=3)
{alert("Datum je nepravilan!");return false;}
if(dateTokens[0]<1||dateTokens[0]>31)
{alert("Datum je nepravilan!");return false;}
if(dateTokens[1]<1||dateTokens[1]>12)
{alert("Datum je nepravilan!");return false;}
if(dateTokens[2]<2007||dateTokens[2]>3000)
{alert("Datum je nepravilan!");return false;}
return true;}
function searchAsYouType()
{var members=document.getElementsByClassName("okvir","page");var searchValue=document.getElementsByName("pretraga")[0].value;var childCount=members.length;for(var i=0;i<childCount;i++)
{members[i].style.display="none";var values=members[i].getElementsByTagName("label");for(var j=0;j<5;j++)
{var proveri=values[j].innerHTML.substring(0,searchValue.length);if(j==4)
if(values[j].childNodes.length>1)
proveri=values[j].getElementsByClassName("skype_pnh_text_span")[0].innerHTML.substring(0,searchValue.length);if(proveri.toLowerCase()==searchValue.toLowerCase())
members[i].style.display="block";}}}
function getCheckedValue(radioObj){if(!radioObj)
return"";var radioLength=radioObj.length;if(radioLength==undefined)
if(radioObj.checked)
return radioObj.value;else
return"";for(var i=0;i<radioLength;i++){if(radioObj[i].checked){return radioObj[i].value;}}
return"";}
function setCheckedValue(radioObj,newValue){if(!radioObj)
return;var radioLength=radioObj.length;if(radioLength==undefined){radioObj.checked=(radioObj.value==newValue.toString());return;}
for(var i=0;i<radioLength;i++){radioObj[i].checked=false;if(radioObj[i].value==newValue.toString()){radioObj[i].checked=true;}}}
function getElementsByClassName(node,classname){if(node.getElementsByClassName){return node.getElementsByClassName(classname);}else{return(function getElementsByClass(searchClass,node){if(node==null)
node=document;var classElements=[],els=node.getElementsByTagName("*"),elsLen=els.length,pattern=new RegExp("(^|\\s)"+searchClass+"(\\s|$)"),i,j;for(i=0,j=0;i<elsLen;i++){if(pattern.test(els[i].className)){classElements[j]=els[i];j++;}}
return classElements;})(classname,node);}}
