function showTvrtke() { obj=document.getElementById("tvrtkeDiv"); obj.style.display=obj.style.display=="block" ? "none":"block"; } function showNewUser() { document.usersForm.ime.value="" document.usersForm.prezime.value="" document.usersForm.usernamee.value="" document.usersForm.epassword.value="" document.usersForm.epassword_rep.value="" document.usersForm.editID.value="" document.usersForm.rightsA.checked=false document.usersForm.rightsK.checked=false obj=document.getElementById("tvrtkeDiv"); obj.style.display=obj.style.display=="block" } document.oncontextmenu=rightClickFunc var mandatory=new Array() function chooseFirm(ID) { xajax_chooseFirm(ID) } function chooseUser(ID) { xajax_chooseUser(ID) } function setFieldFocus(f) { document.getElementById('ffield'+f).style.backgroundColor='#FEF5B8' } function removeFieldFocus(f) { document.getElementById('ffield'+f).style.backgroundColor='#ffffff' } function newFirm(f) { if (confirm("Jeste li sigurni da želite upisati navedene podatke?")) { load() xajax_newFirm(xajax.getFormValues(f)); } return false } function newUser(f) { if (confirm("Jeste li sigurni da želite upisati navedene podatke?")) { load() xajax_newUser(xajax.getFormValues(f)); } return false } var cmenuval function rightClickFunc(e) { if (cmenuval) { showSubmenu(e) return false } } function showSubmenu(e) { clearTimeout(sto) scrT=getScrollTop() scrT=parseInt(scrT) tx=document.all ? window.event.clientX : e.pageX+1 ty=document.all ? window.event.clientY+scrT : e.pageY+1 document.getElementById('submenu').style.left=tx+"px" document.getElementById('submenu').style.top=ty+"px" document.getElementById('submenu').style.display='block' } var sto function hideSubmenu() { document.getElementById('submenu').style.display='none' } function changeBGColor(c, obj) { obj.style.backgroundColor=c } var lastObjSM var reltosm function setCMenu(v, obj) { cmenuval=v c="#ffffff" if (v) { reltosm=obj.id c="#FEF5B8" if (lastObjSM!=obj) hideSubmenu() if (lastObjSM) changeBGColor('#ffffff', lastObjSM) lastObjSM=obj } else { } changeBGColor(c, obj) } function setSubmenu(i) { document.getElementById('submenu').innerHTML=i } function goSublink(l, s, rep, r, pre) { if (!s) s=0 if (!rep) rep=0 f=new Array() f[r]=reltosm if (r=="edit") { pageLoad(l, s, '', '', reltosm) } else if (r=="specials") { specials(l, s, reltosm) } else if (s) { pageLoad(l, s, '', 'search', '', f) } else if (rep) { if (!pre) xajax_loadPage(l, '', rep, '', '', f, '', '', '', '', '') if (pre) pageLoad(l, '', rep, '', '', '', '', '', '', 1, reltosm) } } function specials(l, s, reltosm) { hideSubmenu() load() xajax_specials(l, s, reltosm) } function getWinWidth() { if (window.innerWidth) { tinW=document.body.offsetWidth } else { tinW=document.body.clientWidth } return tinW } function getWinHeight() { if (window.innerWidth) { tinH=document.body.offsetHeight; } else { tinH=document.body.clientHeight; } return tinH } function getInnerWidth() { if (window.innerHeight) { dinW = window.innerWidth-16; } else if (document.body) { dinW = document.body.offsetWidth-20; } return dinW } function getInnerHeight() { if (window.innerHeight) { dinH = window.innerHeight-16; } else if (document.body) { dinH = self.screen.availHeight-20; } return dinH } var specialWindows=0 var specialWinParentHeight=0 function newWin(l, s, t, g) { specialWindows++ if (document.all) { divp=document.createElement("
"); } else { divp=document.createElement('div'); divp.id="specialWin"+specialWindows divp.className="specialWinParent" } document.body.appendChild(divp) tinW=getWinWidth() tinH=getInnerHeight() specialWinParentHeight=tinH-20 document.getElementById('specialWin'+specialWindows).style.width=tinW-300+"px" document.getElementById('specialWin'+specialWindows).style.height=specialWinParentHeight+"px" document.getElementById('specialWin'+specialWindows).style.left="150px" document.getElementById('specialWin'+specialWindows).style.top="20px" document.getElementById('specialWin'+specialWindows).style.display="block" if (document.all) { divp=document.createElement("
"); } else { divp=document.createElement('div'); divp.className="specialMenu" divp.id='specialMenu'+specialWindows divp.onmousedown = function(e) { obj = e.currentTarget beginDrag(obj, e, "specialWin"+specialWindows) } divp.addEventListener('dblclick', minimizeThis, false) } document.getElementById('specialWin'+specialWindows).appendChild(divp) divp.innerHTML=t if (document.all) { divp=document.createElement(""); } else { divp=document.createElement('a'); divp.href="javascript:unload()" } document.getElementById('specialWin'+specialWindows).appendChild(divp) if (document.all) { divimg=document.createElement(""); } else { divimg=document.createElement('img'); divimg.src="img/cross.png" divimg.style.position="absolute" divimg.style.right="10px" divimg.style.top="3px" divimg.style.border="0px" } divp.appendChild(divimg) if (document.all) { divp=document.createElement("
"); } else { divp=document.createElement('div'); divp.id="specialWinHolder"+specialWindows divp.className="specialWinHolder" } document.getElementById('specialWin'+specialWindows).appendChild(divp) document.getElementById('specialWinHolder'+specialWindows).style.width=tinW-320+"px" document.getElementById('specialWinHolder'+specialWindows).style.height=tinH-50+"px" document.getElementById('specialWinHolder'+specialWindows).innerHTML="" xajax_specialWindowCreate(l, s, specialWindows, g) } function thisWin(l, s, g) { document.getElementById('specialWinHolder'+specialWindows).innerHTML="" xajax_specialWindowCreate(l, s, specialWindows, g) } function minimizeThis(e) { if(e.currentTarget) obj = e.currentTarget else if(window.event.srcElement) obj = window.event.srcElement obj.blur() tid=obj.id tid=tid.replace("specialMenu", "") if (document.getElementById('specialWinHolder'+tid).style.display!="none") { document.getElementById('specialWinHolder'+tid).style.display="none" document.getElementById('specialWin'+tid).style.height="20px" } else { document.getElementById('specialWinHolder'+tid).style.display="block" document.getElementById('specialWin'+tid).style.height=specialWinParentHeight+"px" } } function createCookie(name, value) { document.cookie = name+"="+value+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { createCookie(name,"",-1); } function init() { checkHeight() link=readCookie("link")=="undefined" ? "home":readCookie("link") sublink=readCookie("sublink")=="undefined" ? "":readCookie("sublink") report=readCookie("report")=="undefined" ? "":readCookie("report") action=readCookie("action")=="delete" ? "":readCookie("action") ID=readCookie("ID")=="undefined" ? "":readCookie("ID") form=readCookie("form") sortBy=readCookie("sortBy")=="undefined" ? "":readCookie("sortBy") sortHow=readCookie("sortHow")=="undefined" ? "asc":readCookie("sortHow") cpage=readCookie("cpage")=="undefined" ? "1":readCookie("cpage") pre=readCookie("pre")=="undefined" ? "":readCookie("pre") lastAction=action lastLink=link lastSublink=sublink lastForm=form lastsortBy=sortBy lastsortHow=sortHow lastPage if (pre && !form) { prerequisits(link, report) return } // alert(link+", "+sublink+", "+report+", "+action+", "+ID+", "+form+", "+sortBy+", "+sortHow+", "+page) xajax_loadPage(link, sublink, report, action, ID, form, sortBy, sortHow, cpage, "", "both") //pageLoad(link, sublink, report, action, ID, form, sortBy, sortHow, page, pre) } function login() { xajax_login(xajax.getFormValues('loginForm')); return false } function clearForm() { var form, elements, i, elm; form = document.getElementById ? document.getElementById("formName") : document.forms["formName"]; if (form) { elements = form.elements; for( i=0, elm; elm=elements[i++]; ) { if (elm.name!="link" && elm.name!="sublink") { if (elm.type == "text" || elm.type == "hidden") elm.value =''; if (elm.type == "textarea") { elm.innerText = ''; elm.value = ''; } if (elm.type == "radio" || elm.type == "checkbox") elm.checked = false; } } } return } function resetMandatory() { mandatory=null mandatory=new Array() } function setMandatory(k, v) { mandatory[k]=v } function getMandatory(f) { polja="" for (var i in mandatory) { if (i!="containsValue") { fieldname=mandatory[i] eval("field=document."+f+"."+i) if (field) { eval("v=document."+f+"."+i+".value") if (!v || v==0) { if (polja) polja+=", " polja+=fieldname } } } } return polja } function submitForm(f) { polja=getMandatory(f) if (!polja) { if (confirm("Jeste li sigurni da želite upisati navedene podatke?")) xajax_submitForm(xajax.getFormValues(f)); } else { alert("Unos polja "+polja+" obavezan") } return false } function ssubmitForm() { polja=getMandatory('formName') if (!polja) { if (confirm("Jeste li sigurni da želite upisati navedene podatke?")) xajax_submitForm(xajax.getFormValues('formName')); } else { alert("Unos polja "+polja+" obavezan") } } function changepage(p) { lastPage=p pageLoad(lastLink, lastSublink, "", "", "", lastForm, lastsortBy, lastsortHow, p) } rexpanded=false var lastLink var lastAction var lastSublink var lastsortBy var lastForm var lastsortHow var lastPage=1 var preLink var preReport function prerequisits(link, report, hidvals) { load() preLink=link preReport=report xajax_pre(link, report, hidvals) } function showPre() { document.getElementById("presbottom").style.display="block" presd=document.getElementById('pres') document.getElementById('loading').style.display='none' if (window.innerHeight) { inW = window.innerWidth-16; inH = window.innerHeight-16; } else if (document.body) { inW = document.body.offsetWidth-20; inH = self.screen.availHeight-20; } pW=presd.offsetWidth pH=presd.offsetHeight scrT=getScrollTop() scrT=parseInt(scrT) leftX=(inW-pW)/2 topX=inH/2-pH/2+scrT-50 if (!window.innerWidth) { topX=topX-50 } presd.style.left=leftX+"px" presd.style.top=topX+"px" presd.style.visibility="visible" document.getElementById('pres').style.width=document.getElementById('pres').offsetWidth+"px" document.getElementById('presbody').style.width=document.getElementById('presbody').offsetWidth+"px" } function preSend() { unloadpresc=0 var form, elements, i, elm; form = document.getElementById ? document.getElementById("preform") : document.forms["preform"]; if (form) { elements = form.elements; preRet=new Array() has=false for( i=0, elm; elm=elements[i++]; ) { elname=elm.name if ((elm.type == "text" || elm.type=="hidden" || elm.type == "textarea" || elm.type == "select-one") && elname && elname.indexOf("_new_value")==-1 && elm.value) { has=true preRet[elname]=elm.value } if ((elm.type == "radio" || elm.type == "checkbox") && elm.checked) { has=true preRet[elname]=elm.value } } if (has) pageLoad(preLink, '', preReport, '', '', preRet) } return false } function prePageLoad(link, sublink, report, action, ID, form, formVal) { f=new Array() forms=form.split("|") formVals=formVal.split("|") for (i=0; i < forms.length; i++) { ff=forms[i] ffv=formVals[i] f[ff]=ffv } pageLoad(link, sublink, report, action, ID, f) } var unloadpresc=1 function pageLoad(link, sublink, report, action, ID, form, sortBy, sortHow, page, pre, rlms) { cmenuval=0 if (link=="logout") { eraseCookie("link") eraseCookie("sublink") eraseCookie("report") eraseCookie("action") eraseCookie("ID") eraseCookie("form") eraseCookie("sortBy") eraseCookie("sortHow") eraseCookie("rexpanded") eraseCookie("cpage") eraseCookie("pre") unloadPres() } if (pre) { //lastLink=link //lastSublink=sublink unloadPres() if (!rlms) rlms=0 prerequisits(link, report, rlms) return } side="both" if (page || sortBy) { side="right" } if (lastLink==link && lastSublink==sublink && !report && !action && !ID && !form && !sortBy && !sortHow && !page) { eraseCookie("pre") side="both" page=1 lastPage=1 lastsortBy="" lastsortHow="" lastForm="" expandRcontract() //unloadPres() } if (lastLink==link && lastSublink==sublink && ID && action=="") side="left" if (lastLink==link && lastSublink==sublink && ID && action=="delete") side="right" if (lastLink==link && lastSublink==sublink && !ID && action=="search" && form) side="right" if (lastLink==link && lastSublink==sublink && !ID && action=="submited") { action="" side="right" clearForm() } if (lastLink!=link || lastSublink!=sublink) { eraseCookie("pre") side="both" lastForm="" unloadPres() if (sublink) clearForm() } if (!sublink) sublink="" if (!report) report="" if (!action) action="" if (!ID) ID="" if (ID && action=="") expandRcontract() if (!form) { if (lastLink!=link || lastSublink!=sublink) { form="" } else { form=lastForm } } if (!sortBy) { if (lastLink!=link || lastSublink!=sublink || form!=lastForm) { sortBy="" } else { sortBy=lastsortBy } } if (!sortHow) { if (lastLink!=link || lastSublink!=sublink || form!=lastForm) { sortHow="" } else { sortHow=lastsortHow } } if (!page) page=lastPage if (lastLink!=link || lastSublink!=sublink || form!=lastForm) { page=1 lastPage=1 //unloadPres() lastsortBy="" lastsortHow="" } if (!report) { lastAction=action lastLink=link lastSublink=sublink lastForm=form lastsortBy=sortBy lastsortHow=sortHow lastPage } checkHeight() clearTimeout(tt) hideMenu() load() if (!report) { createCookie("link", link) createCookie("sublink", sublink) createCookie("report", report) createCookie("action", action) createCookie("ID", ID) createCookie("form", form) createCookie("sortBy", sortBy) createCookie("sortHow", sortHow) createCookie("rexpanded", rexpanded) createCookie("cpage", page) if (report && !sublink) createCookie("pre", true) } //alert(link+", "+sublink+", "+report+", "+action+", "+ID+", "+form+", "+sortBy+", "+sortHow+", "+page+", "+rexpanded+", "+side) xajax_loadPage(link, sublink, report, action, ID, form, sortBy, sortHow, page, rexpanded, side) } function sortBy(link, sublink, sb) { xajax_sortBy(link, sublink, sb) } function load() { if (window.innerHeight && window.scrollMaxY) {// Firefox tinW=document.body.offsetWidth tinH=document.body.offsetHeight; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac tinH = document.body.scrollHeight; tinW = document.body.scrollWidth; } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari tinH = document.body.offsetHeight; tinW = document.body.offsetWidth; } document.getElementById('transDiv').style.width=tinW+"px" document.getElementById('transDiv').style.height=tinH+"px" document.getElementById('transDiv').style.display="block" //document.getElementById('page').className="transp50" if (window.innerHeight) { inW = window.innerWidth-16; inH = window.innerHeight-16; } else if (document.body) { inW = document.body.offsetWidth-20; inH = self.screen.availHeight-20; } scrT=getScrollTop() scrT=parseInt(scrT) leftX=(inW-10)/2 topX=inH/2-10/2+scrT if (!window.innerWidth) { topX=topX-50 } document.getElementById('loading').style.left=leftX+"px" document.getElementById('loading').style.top=topX+"px" document.getElementById('loading').style.display="block" return } var openTable var closeTable var header var reportPage var lastShownPage var lastShownPageID var rparentW function showReport() { if (window.innerHeight && window.scrollMaxY) {// Firefox tinW=document.body.offsetWidth tinH=document.body.offsetHeight; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac tinH = document.body.scrollHeight; tinW = document.body.scrollWidth; } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari tinH = document.body.offsetHeight; tinW = document.body.offsetWidth; } document.getElementById('transDiv').style.width=tinW+"px" document.getElementById('transDiv').style.height=tinH+"px" document.getElementById('transDiv').style.display="block" //document.getElementById('page').className="transp50" if (window.innerHeight) { inW = window.innerWidth-16; inH = window.innerHeight-16; } else if (document.body) { inW = document.body.offsetWidth-20; inH = self.screen.availHeight-20; } scrT=getScrollTop() scrT=parseInt(scrT) leftX=(inW-rparentW)/2 topX=10+scrT hX=inH-40 if (!window.innerWidth) { //topX=topX-50 hX=hX-140 } document.getElementById('reportparent').style.left=leftX+"px" document.getElementById('reportparent').style.top=topX+"px" //document.getElementById('reportparent').style.height=hX+"px" document.getElementById('reportparent').style.display="block" hX=hX-30 document.getElementById('reportchild').style.height=hX+"px" document.getElementById('reportchild').style.display="block" document.getElementById('reportchild').style.overflow="auto" } function doPageSetup(t) { rparentW=(t=="Landscape") ? 1060:920 document.getElementById('reportparent').className="parent"+t document.getElementById('reportchild').className="child"+t document.getElementById('reportholder').className="holder"+t } function clearReport(ot, h, ct) { openTable=ot closeTable=ct header=h reportPage=1 lastShownPageID=1 document.getElementById('reportholder').innerHTML=""; divp=document.createElement("DIV") if (document.all) { divp=document.createElement("
"); } else { divp=document.createElement('div'); divp.id="reportPage"+reportPage divp.style.position="absolute" } document.getElementById('reportholder').appendChild(divp) document.getElementById('reportPage'+reportPage).innerHTML=openTable+header } function appendReport(rin) { document.getElementById('reportPage'+reportPage).innerHTML=document.getElementById('reportPage'+reportPage).innerHTML+rin checkReportHeight() } function clearReportNew() { reportPage=0 lastShownPageID=1 document.getElementById('reportholder').innerHTML=""; if(document.getElementById('reportholder').hasChildNodes()) { while(document.getElementById('reportholder').childNodes.length >= 1 ) { document.getElementById('reportholder').removeChild(document.getElementById('reportholder').firstChild); } } } function appendReportNew(f, w, h) { reportPage++ divp=document.createElement("DIV") if (document.all) { divp=document.createElement("