var site_const = {mt:0.952381, max_dobitak:300000, max_sist_dobitak:500000, max_koeff:1000000, valuta:'Kn', min_uplata:5, min_uplata_sistem:0.01, default_uplata:10, grupa_komb_default_uplata:5, max_br_dogadjaja:30, max_br_sistemskih_dog:18, loto_sportID:20, superprognoza_sportID:18, superprognoza_naziv_dativ:'super prognozi', superprognoza_naziv_genitiv:'super prognoze', ispisRezultata:0, sSiteTitle:'Germania Sport', sSiteURL:'www.germaniasport.hr', ttxRefreshRate:10000, ttxDefaultPage:731, ttxDefaultSubPage:1, ttxStartPage:730, ttxEndPage:736, provListRefreshRate:30000, menuRefreshRate:180000, sGoogleAnalyticsCode:'UA-305909-6' };
Date.prototype.parseHRDate = function(inString)
{try {this.setFullYear(inString.substr(0,4)-0);this.setMonth(inString.substr(4,2)-1, inString.substr(6,2)-0);} catch(E) {};try {this.setHours(inString.substr(9,2));this.setMinutes(inString.substr(12,2));} catch(E) {};try {this.setSeconds(inString.substr(15,2));} catch(E) {};}
Date.prototype.parseTime = function(inTime)
{try {this.setHours(Math.floor(inTime/100));this.setMinutes(Math.floor(inTime%100));} catch(E) {};}
Date.prototype.getHRString = function(inShort)
{var sDate = (100 + this.getDate()).toString().substr(1,2);var sMonth = (100 + this.getMonth()+1).toString().substr(1,2);var sYear = (10000+ this.getFullYear()).toString().substr(1,4);if(inShort)return(sDate + '.' + sMonth + '.');else return(sDate + '.' + sMonth + '.' + sYear);}
Date.prototype.getWeekday = function(inShort)
{var aLongDays = ['nedjelja', 'ponedjeljak', 'utorak', 'srijeda', 'četvrtak', 'petak', 'subota'];var aShortDays  = ['ned', 'pon', 'uto', 'sri', 'čet', 'pet', 'sub'];if(inShort)return(aShortDays[this.getDay()]);else return(aLongDays[this.getDay()]);}
Date.prototype.getHRTime = function(inSeconds)
{var iHours = this.getHours();var iMinutes = this.getMinutes();if(iHours < 10)iHours = '0' + iHours;if(iMinutes < 10)iMinutes = '0' + iMinutes;if(!inSeconds)return(iHours + ':' + iMinutes);var iSeconds = this.getSeconds();if(iSeconds < 10)iSeconds = '0' + iSeconds;return(iHours+':'+iMinutes+':'+iSeconds);}
Date.prototype.calcOffset = function()
{}
Date.prototype.diff = function(inDate)
{var iThisValue, iInValue;iThisValue = this.getFullYear();iInValue = inDate.getFullYear();if(iThisValue > iInValue)return(1);if(iThisValue < iInValue)return(-1);iThisValue = this.getMonth();iInValue = inDate.getMonth();if(iThisValue > iInValue)return(1);if(iThisValue < iInValue)return(-1);iThisValue = this.getDay();iInValue = inDate.getDay();if(iThisValue > iInValue)return(1);if(iThisValue < iInValue)return(-1);iThisValue = this.getHours();iInValue = inDate.getHours();if(iThisValue > iInValue)return(1);if(iThisValue < iInValue)return(-1);iThisValue = this.getMinutes();iInValue = inDate.getMinutes();if(iThisValue > iInValue)return(1);if(iThisValue < iInValue)return(-1);iThisValue = this.getSeconds();iInValue = inDate.getSeconds();if(iThisValue > iInValue)return(1);if(iThisValue < iInValue)return(-1);return(0);}
function cloneChildren(inSourceObj)
{var docFragment = document.createDocumentFragment();var tmpOBJ = null;for(var i in inSourceObj.childNodes){tmpOBJ = inSourceObj.childNodes[i];if(typeof(tmpOBJ.tagName) != 'undefined')docFragment.appendChild(tmpOBJ.cloneNode(true));}return(docFragment);}
String.prototype.right = function(inN)
{return(this.substring(this.length-inN));}
String.prototype.ent2txt = function()
{return(this.replace(/(&#\d+;)/g,
function(instr, inCode)
{switch(inCode){case '&#269;': return('č');case '&#263;': return('ć');case '&#382;': return('ž');case '&#353;': return('š');case '&#273;': return('đ');case '&#268;': return('Č');case '&#262;': return('Ć');case '&#381;': return('Ž');case '&#352;': return('Š');case '&#272;': return('Đ');case '&amp;':  return('&');default: return('########');}}));}
String.prototype.escapeHTML = function()
{return(this.replace(/(<|>|&)/g,
function(instr, inCode)
{switch(inCode){case '&': return('&amp;');case '<': return('&lt;');case '>': return('&gt;');default: return('?');}}));}
String.prototype.trim = function()
{return(this.replace(/^\s+/g,'').replace(/\s+$/g,''));}
function formatKoeff(inNumeric, inDecimalPlaces)
{if(typeof(inDecimalPlaces) == 'undefined')inDecimalPlaces = 1;if(inNumeric < 10)return(inNumeric.toFixed(2).replace('.',','));if(inNumeric < 1000)return(inNumeric.toFixed(inDecimalPlaces).replace('.',','));var sGlue='', sReturn='', i=0;var sWhole = Math.floor(inNumeric);var iDecimal = Math.round(inNumeric*100,0) - sWhole*100;sWhole+='';var iLength = sWhole.length-3;for(i=iLength;i>0;i-=3){sReturn = sWhole.substr(i,3)+sGlue+sReturn;sGlue='.';}sReturn = sWhole.substr(0,i+3)+sGlue+sReturn;if(iDecimal == 0)return(sReturn);if(iDecimal < 10)return(sReturn+',0'+iDecimal);if((iDecimal % 10) == 0)iDecimal/=10;return(sReturn+','+iDecimal);}
function formatCurr(inNumeric, inDecimalPlaces)
{if(typeof(inDecimalPlaces) == 'undefined')inDecimalPlaces = 2;var sGlue='', sReturn='', i=0;var sWhole = Math.floor(inNumeric);sWhole+='';var iLength = sWhole.length-3;for(i=iLength;i>0;i-=3){sReturn = sWhole.substr(i,3)+sGlue+sReturn;sGlue='.';}sReturn = sWhole.substr(0,i+3)+sGlue+sReturn;if(inDecimalPlaces==0)return(sReturn);var iExp = Math.pow(10, inDecimalPlaces);var iDecimal = Math.round(inNumeric*iExp,0) - sWhole*iExp;iDecimal = '000000000000'+iDecimal;return(sReturn+','+iDecimal.right(inDecimalPlaces));}
function IsNumeric(strString)
{var strValidChars = "0123456789";var strChar;var blnResult = true;if (strString.length == 0) return false;for (i = 0; i < strString.length && blnResult == true; i++){strChar = strString.charAt(i);if (strValidChars.indexOf(strChar) == -1){blnResult = false;}}return blnResult;}
function textbox_class(inOwnerObj, inDomElement)
{this.container = null;this.numeric = true;this.text = '';this.numValue = 0;this.ownerObj = inOwnerObj;this.changed = false;if(!inDomElement){this.domObj = document.createElement('input');this.domObj.type = 'text';}else {this.domObj = inDomElement;}this.domObj.parentObj = this;
this.domObj.onfocus = function(inEvent) {this.parentObj.onfocus(inEvent?inEvent:window.event); }
this.domObj.onkeyup = function(inEvent) {return(this.parentObj.onkeyup(inEvent?inEvent:window.event)); }
this.domObj.onkeydown = function(inEvent) { return(this.parentObj.onkeydown(inEvent?inEvent:window.event)); }
this.onClickHandler = null;this.onChangeHandler = null;this.onBlurHandler = null;this.onFocusHandler = null;
this.onclick = function(inEvent)
{if(this.onClickHandler!=null)eval('this.ownerObj.'+this.onClickHandler+'(inEvent)');}
this.onkeyup = function(inEvent)
{if(!this.changed)return;var formatRegExp = /^\d*(,|\.)?\d{0,2}$/;if(!formatRegExp.test(this.domObj.value))this.domObj.value = this.text;else {this.text = this.domObj.value;if(this.numeric)if(this.text == '')this.numValue = 0;else this.numValue = parseFloat(this.text.replace(',','.'));if(this.onChangeHandler!=null)eval('this.ownerObj.'+this.onChangeHandler+'(inEvent)');}this.changed = false;return(true);}
this.onkeydown = function(inEvent)
{return(true);}
this.onkeydown = function(inEvent)
{if(this.numeric){switch(inEvent.keyCode?inEvent.keyCode:e.which){case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: case 96: case 97: case 98: case 99: case 100: case 101: case 102: case 103: case 104: case 105: case 8: case 46: this.changed = true;case 37: case 39: case 116: case 35: case 36: break;case 110: case 188: case 190: var formatRegExp = /^.*(,|\.).*$/;if(formatRegExp.test(this.domObj.value))return(false);this.changed = true;break;default: return (false);}}return(true);}
this.onblur = function(inEvent)
{if(this.onBlurHandler!=null)eval('this.ownerObj.'+this.onBlurHandler+'(inEvent)');}
this.onfocus = function(inEvent)
{if(this.domObj.createTextRange){var oRange = this.domObj.createTextRange();oRange.moveStart("character", 0);oRange.moveEnd("character", this.domObj.value.length);oRange.select();}else if (this.domObj.setSelectionRange){this.domObj.setSelectionRange(0, this.domObj.value.length);}if(this.onFocusHandler!=null)eval('this.ownerObj.'+this.onFocusHandler+'(inEvent)');}
this.show = function(inDomContainer)
{this.container = inDomContainer;this.container.appendChild(this.domObj);}
this.setText = function(inNewText)
{this.text = inNewText;this.domObj.value = inNewText;}
this.terminate = function()
{if(this.container != null){this.container.removeChild(this.domObj);this.container = null;}this.domObj.onclick = null;this.domObj.onblur = null;this.domObj.onfocus = null;this.domObj.onkeyup = null;this.domObj.onkeydown = null;this.domObj.parentObj = null;;this.domObj = null;this.ownerObj = null;}}
function eventCenter_class()
{this.moveHandlers = null;this.downHandlers = null;this.upHandlers   = null;this.blurHandlers = null;this.resizeHandlers = null;this.keyDownHandlers = null;
this.register = function(inEventType, inObject)
{switch(inEventType){case 'mousemove': if(this.moveHandlers == null) this.moveHandlers = new Array();this.moveHandlers.push(inObject);break;case 'mousedown': if(this.downHandlers == null) this.downHandlers = new Array();this.downHandlers.push(inObject);break;case 'mouseup': if(this.upHandlers == null) this.upHandlers = new Array();this.upHandlers.push(inObject);break;case 'blur': if(this.blurHandlers == null) this.blurHandlers = new Array();this.blurHandlers.push(inObject);break;case 'resize': if(this.resizeHandlers == null) this.resizeHandlers = new Array();this.resizeHandlers.push(inObject);break;case 'keydown': if(this.keyDownHandlers == null) this.keyDownHandlers = new Array();this.keyDownHandlers.push(inObject);break;}}
this.unregister = function(inEventType, inObject)
{switch(inEventType){case 'mousedown': for(var i in this.downHandlers){if(this.downHandlers[i] == inObject){this.downHandlers.splice(i,1);break;}}break;case 'mouseup': for(var i in this.upHandlers){if(this.upHandlers[i] == inObject){this.upHandlers.splice(i,1);break;}}break;case 'mousemove': for(var i in this.downHandlers){if(this.downHandlers[i] == inObject){this.downHandlers.splice(i,1);break;}}break;case 'blur': for(var i in this.blurHandlers){if(this.blurHandlers[i] == inObject){this.blurHandlers.splice(i,1);break;}}break;case 'resize': for(var i in this.resizeHandlers){if(this.resizeHandlers[i] == inObject){this.resizeHandlers.splice(i,1);break;}}break;case 'keydown': for(var i in this.keyDownHandlers){if(this.keyDownHandlers[i] == inObject){this.keyDownHandlers.splice(i,1);break;}}break;}}
this.handle_mouseMove = function(inEvent)
{for(var i in this.moveHandlers)this.moveHandlers[i].handle_mouseMove(inEvent);}
this.handle_mouseDown = function(inEvent)
{for(var i in this.downHandlers)this.downHandlers[i].handle_mouseDown(inEvent);}
this.handle_mouseUp = function(inEvent)
{for(var i in this.upHandlers)this.upHandlers[i].handle_mouseUp(inEvent);}
this.handle_blur = function(inEvent)
{for(var i in this.blurHandlers)this.blurHandlers[i].handle_Blur(inEvent);}
this.handle_onresize = function(inEvent)
{for(var i in this.resizeHandlers)this.resizeHandlers[i].handle_onresize(inEvent);}
this.handle_onkeydown = function(inEvent)
{if(window.event)var iKeyCode = window.event.keyCode;else if(inEvent.which)var iKeyCode = inEvent.which;for(var i in this.keyDownHandlers)this.keyDownHandlers[i].handle_onkeydown(inEvent,iKeyCode);}};var eventCenter = new eventCenter_class();
document.onmousemove = function(inEvent)
{eventCenter.handle_mouseMove(inEvent);}
document.onmousedown = function(inEvent)
{eventCenter.handle_mouseDown(inEvent);}
document.onmouseup = function(inEvent)
{eventCenter.handle_mouseUp(inEvent);}
document.onblur = function(inEvent)
{eventCenter.handle_blur(inEvent);}
window.onresize = function(inEvent)
{eventCenter.handle_onresize(inEvent);}
document.onkeydown = function(inEvent)
{eventCenter.handle_onkeydown(inEvent);}
function nextFocus(e, inID)
{if(KeyDownCode(e)==13) document.getElementById(inID).focus();return(true);}
function KeyDownCode(e)
{var iKeyCode;if(window.event) {return(e.keyCode);} else {return(e.which);}}
function profiler_class()
{this.data = new Array();this.nested = false;if(typeof(debugMode) == 'undefined')eventCenter.register('keydown', this);
this.start = function(inBlockID)
{if(!this.data[inBlockID])this.data[inBlockID] = new Array();this.data[inBlockID].push({start:new Date().getTime(), end:null, nested:this.nested});this.nested = true;}
this.stop = function(inBlockID)
{if(!this.data[inBlockID][this.data[inBlockID].length-1].nested)this.nested = false;this.data[inBlockID][this.data[inBlockID].length-1].end = new Date().getTime();}
this.report = function()
{var execCount = 0;var ownTime = 0;var avgTime = 0;var minTime = 0;var maxTime = 0;var totalTime = 0;var currTime = 0;var reportArray= new Array();for(var iID in this.data){currTime = this.data[iID][0].end - this.data[iID][0].start;minTime = currTime;maxTime = currTime;ownTime = 0;nestedTime = 0;execCount = 0;for(var iIndex in this.data[iID]){currTime = this.data[iID][iIndex].end - this.data[iID][iIndex].start;if(currTime > maxTime) maxTime = currTime;if(currTime < minTime) minTime = currTime;if(!this.data[iID][iIndex].nested)ownTime+=currTime;nestedTime+=currTime;execCount++;}avgTime = ownTime / execCount;reportArray[iID] = {execCount:execCount, ownTime:ownTime, nestedTime:nestedTime, avgTime:avgTime, minTime:minTime, maxTime:maxTime};totalTime+=ownTime;}var renderArr = new Array();for(var iID in reportArray){renderArr.push(Array(iID, reportArray[iID].execCount, (reportArray[iID].ownTime/totalTime*100), reportArray[iID].nestedTime, reportArray[iID].ownTime, reportArray[iID].avgTime, reportArray[iID].minTime, reportArray[iID].maxTime).join(';'));}var winObj = window.open();var docObj = winObj.document;docObj.open("text/html", "replace");docObj.write('BlockID;Percent;Exec count;Nested time;Own time;Avg;Min;Max<br>');docObj.write(renderArr.join('<br>'));docObj.close();delete this.data;this.data = new Array();}
this.dump = function()
{var renderArr = new Array();for(var iID in this.data)for(var iIndex in this.data[iID])renderArr.push(Array(iID, iIndex, this.data[iID][iIndex].start, this.data[iID][iIndex].end, this.data[iID][iIndex].nested, this.data[iID][iIndex].end - this.data[iID][iIndex].start).join(';'));var winObj = window.open();var docObj = winObj.document;docObj.open("text/html", "replace");docObj.write('BlockID;Index;Start;End;Nested;Diff<br>');docObj.write(renderArr.join('<br>'));docObj.close();}
this.handle_onkeydown = function(inEvent, iKeyCode)
{if(iKeyCode == 82)this.report();if(iKeyCode == 68)this.dump();}}
function debug(inString, inClear)
{var objDebugDIV;objDebugDIV = document.getElementById('debug_div');if(objDebugDIV == null){objDebugDIV = document.createElement("DIV");document.body.appendChild(objDebugDIV);objDebugDIV.id = 'debug_div';objDebugDIV.style.position = 'absolute';objDebugDIV.style.zIndex	 = '500';objDebugDIV.style.padding = '5px';objDebugDIV.style.top = '20px';objDebugDIV.style.right = '20px';objDebugDIV.style.border = '2px solid #FF0000';objDebugDIV.style.backgroundColor = '#FFFFFF';objDebugDIV.style.color = '#000000';objDebugDIV.style.display = 'none';objDebugDIV.style.overflow = 'auto';objDebugDIV.style.fontSize = '10px';objDebugDIV.innerHTML = '<p style="margin:0px;text-align:right;font-weight:bold;"><a href="javascript:debug(\'\');">x close</a></p>';}if(inString == ''){objDebugDIV.style.display = 'none';objDebugDIV.innerHTML = '<p style="margin:0px;text-align:right;color:red;font-weight:bold;"><a href="javascript:debug(\'\');">x close</a></p>';return;}else objDebugDIV.style.display = 'block';inClear = inClear || false;if(inClear)objDebugDIV.innerHTML = inString;else objDebugDIV.insertAdjacentHTML('beforeEnd', '<br>' + inString);}var lastRandomID = 0;
function getRandomID()
{return('randomid_'+(lastRandomID++));}
function m_ShowPopup(in_file, in_width, in_height, in_settings)
{if(!in_width)in_width = 630;if(!in_height)in_height = 360;var LeftPosition = (screen.width)?(screen.width-in_width)/2:100;var TopPosition = (screen.height)?(screen.height-in_height)/2:100;if(!in_settings)in_settings = 'scrollbars=1,toolbar=0,menubar=0,status=0,location=0,resizable=0,height='+in_height+',width='+in_width+',top='+TopPosition+',left='+LeftPosition;else in_settings+= ',height='+in_height+',width='+in_width+',top='+TopPosition+',left='+LeftPosition;var tmpWindow = window.open(in_file, '', in_settings);return(tmpWindow);}
function openNewWindow(inURL, inWindowTitle)
{return(window.open(inURL,inWindowTitle,'fullscreen=no,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes'));}
function timer_class(inInstanceName)
{this.timerData = new Array();this.timerIDCounter = -1;this.instanceName = inInstanceName;
this.add = function(inObject,
inInterval, inAutoRewind){if(!inAutoRewind) inAutoRewind = false;this.timerData['id'+(++this.timerIDCounter)] = {listener:inObject, interval:inInterval, intervalID:null, autoRewind:inAutoRewind};return(this.timerIDCounter);}
this.remove = function(inTimerID)
{this.stop(inTimerID);this.timerData.splice('id'+inTimerID,1);}
this.start = function(inTimerID)
{if(this.timerData['id'+inTimerID].intervalID==null)this.timerData['id'+inTimerID].intervalID = setTimeout(this.instanceName+'.trigger('+inTimerID+')',this.timerData['id'+inTimerID].interval);}
this.stop = function(inTimerID)
{if(typeof(inTimerID)=='undefined')return;if(this.timerData['id'+inTimerID].intervalID!=null)clearTimeout(this.timerData['id'+inTimerID].intervalID);this.timerData['id'+inTimerID].intervalID = null;}
this.set_Listener = function(inTimerID, inObject)
{this.timerData['id'+inTimerID].listener = inObject;}
this.set_Interval = function(inTimerID, inInterval)
{this.timerData['id'+inTimerID].interval = inInterval;}
this.trigger = function(inTimerID)
{if(typeof(this.timerData['id'+inTimerID])=='undefined')return;if(this.timerData['id'+inTimerID].autoRewind)this.timerData['id'+inTimerID].intervalID = setTimeout(this.instanceName+'.trigger('+inTimerID+')',this.timerData['id'+inTimerID].interval);else this.timerData['id'+inTimerID].intervalID = null;this.timerData['id'+inTimerID].listener.timerTimeout();}}var globalTimer = new timer_class('globalTimer');
function findAbsParent(inNode)
{if(inNode.nodeName == 'HTML'){offsetObj = new Object();offsetObj.offsetTop  = 0;offsetObj.offsetLeft = 0;}else {offsetObj = findAbsParent(inNode.parentNode);if(inNode.className != 'js_skip' && inNode.className != 'submnu'){offsetObj.offsetTop   = offsetObj.offsetTop  + inNode.offsetTop;offsetObj.offsetLeft  = offsetObj.offsetLeft + inNode.offsetLeft;}}return(offsetObj);}if(typeof HTMLElement!="undefined" && ! HTMLElement.prototype.insertAdjacentElement){
HTMLElement.prototype.insertAdjacentElement = function (where,parsedNode)
{switch (where){case 'beforeBegin': this.parentNode.insertBefore(parsedNode,this);break;case 'afterBegin': this.insertBefore(parsedNode,this.firstChild);break;case 'beforeEnd': this.appendChild(parsedNode);break;case 'afterEnd': if (this.nextSibling)this.parentNode.insertBefore(parsedNode,this.nextSibling);else this.parentNode.appendChild(parsedNode);break;}}
HTMLElement.prototype.insertAdjacentHTML = function(where,htmlStr)
{var r = this.ownerDocument.createRange();r.setStartBefore(this);var parsedHTML = r.createContextualFragment(htmlStr);this.insertAdjacentElement(where,parsedHTML);}
HTMLElement.prototype.insertAdjacentText = function(where,txtStr)
{var parsedText = document.createTextNode(txtStr);this.insertAdjacentElement(where,parsedText);}}
function getSilverlightVersion() {
var version = '';var container = null;try {var control = null;if (window.ActiveXObject) {control = new ActiveXObject('AgControl.AgControl');}else {if (navigator.plugins['Silverlight Plug-In']) {container = document.createElement('div');document.body.appendChild(container);container.innerHTML= '<embed type="application/x-silverlight" src="data:," />';control = container.childNodes[0];}}if (control) {if (control.isVersionSupported('2.0')) { version = 'Silverlight/2.0'; }else if (control.isVersionSupported('1.0')) { version = 'Silverlight/1.0'; }else if (control.isVersionSupported('3.0')) { version = 'Silverlight/3.0'; }else { version = 'Silverlight/unknown version' }}else {version = 'NO Silverlight';}}catch (e) { version = "Silverlight Error"; }if (container) {document.body.removeChild(container);}return version;}var enumMeni = {title:0, prvi_id:1, drugi_id:2, submenu:3 };var enumSport = {tip_paketa:0, naziv_sporta:1, id_sporta:2, datum:3 };var enumGrupaDogadjaja = {tip_paketa:0, naziv_grupe:1, id_grupe:2, id_seta:3, napomena:4, polje_dogadjaja:5, polje_seta_tipova:6 };var enumPonDogadjaj = {id:0, broj:1, prvi_tim:2, drugi_tim:3, vrijeme:4, min_br:5, max_br:6, min_uplata:7, max_uplata:8, kod:9 };var enumRezDogadjaj = {id:0, broj:1, prvi_tim:2, drugi_tim:3, vrijeme:4 };var enumSetTipova = {id:0, naziv:1, napomena:2, polje_varijanti:3, polje_tipova:4, polje_dogadjaj_koef:5 };var enumPoljeVarijanti = {id_varijante:0, prikazi_prvi_tim:1, prikazi_drugi_tim:2, prefix_prvog_tima:3, sufix_prvog_tima:4, delimiter:5, prefix_drugog_tima:6, sufix_drugog_tima:7 };var enumTip = {id_tip:0, naziv:1 };var enumPonDogadjajKoef = {id_dogadjaja:0, id_varijante:1, min_br:2, max_br:3, min_uplata:4, max_uplata:5, kod_specijalke:6, polje_koef:7 };var enumRezDogadjajKoef = {id_dogadjaja:0, id_varijante:1, rezultat:2, polje_koef:3 };var enumPonKoef = {id_tip:0, koef:1 };var enumRezKoef = {id_tip:0, koef:1, koeficijent_1:2, dobitni:3 };var enumTickerUzivo = {broj:0, ime:1, vrijeme:2, rezultat:3 };var enumTickerUskoro = {broj:0, ime:1, vrijeme:2 };var enumMenuItem = {title:0, page_title:1, page_type:2, rpc_data:3, submenu:4 };var enumTipPaketa = {sport:0, grupa_dogadjaja:1 };var enumSkripta = {ponuda:0, rezultati:1, loto:2 };var enumStatusBar = {idle:0, loading:1, processing:2 };var enumPageType = {ponuda:0, rezultati:1, poslovnice:2, upute:3, tjednici:4, listici:5, kontakt:6, teletext:7, naslovnica:8, pravila:9, loto_izvlacenje:10, loto_ponuda:11, loto_rezultati:12, trazilica:13, arhiva_open:14, arhiva_close:15, sms:16, statistike:17, sistemi:18, listic_tjedna:19, tjednik:20, vijest:21, proizvoljni_url:22 };var enumLoadStatus = {ready:0, loading:1, loaded:2 };var enumWinType = {overlay:0, fullscreen:1, detached:2, embedded:3 };var enumProvList = {br_list:0, br_poslovnice:1, ime_poslovnice:2, adresa_poslovnice:3, grad_poslovnice:4, datum_uplate:5, varijanta:6, tip_igre_ID:7, tip_sistema:8, koef:9, uplata:10, mt:11, ulog:12, moguci_dobitak:13, stvarni_dobitak:14, ishod_listica:15, popis_dogadjaja:16 };var enumProvListDogadjaj = {br_dogadjaja:0, oznaka_sistema:1, naziv:2, datum_i_vrijeme:3, tip:4, koef:5, ishod:6, k1:7, rezultat:8 };var enumProvList_refresh = {stvarni_dobitak:0, ishod_listica:1, popis_dogadjaja:2 };var enumProvListDogadjaj_refresh = {datum_i_vrijeme:0, ishod:1, k1:2, rezultat:3 };
function msgbox(inMessage)
{alert(inMessage);}
function output_buffer_class(inDOMContainer, inAutoFlush)
{this.buffer = new Array();this.bufferLength = 0;this.bufferLimit = 10240;this.autoFlush = inAutoFlush || false;this.DOMContainer = inDOMContainer;
this.append = function(inString)
{this.buffer.push(inString);if(this.autoFlush){this.bufferLength += inString.length;if(this.bufferLength >= this.bufferLimit)this.flush();}}
this.flush = function()
{this.DOMContainer.insertAdjacentHTML('beforeEnd', this.buffer.join(''));delete this.buffer;this.buffer = new Array();}
this.terminate = function()
{delete this.buffer;delete this.DOMContainer;}
this.clear = function()
{this.DOMContainer.innerHTML = '';delete this.buffer;this.buffer = new Array();}}
function print_center()
{var winObj = window.open();var docObj = winObj.document;var sPageTitle='';var sRegExpTest = /^[A-Za-z0-9ČĆŽŠĐčćžšđ ]+,.*$/;if(sRegExpTest.test(controler.page_title)){var sRegExp = /^([A-Za-z0-9ČĆŽŠĐčćžšđ ]+), ([A-Za-z0-9ČĆŽŠĐčćžšđ. ]+)(.*)$/;sPageTitle = controler.page_title.replace(sRegExp,'<div id="page_title">$1</div><div id="page_subtitle">$2</div>');}else {sPageTitle = '<div id="page_title">'+controler.page_title+'</div><div id="page_subtitle">&nbsp;</div>';}docObj.open("text/html", "replace");docObj.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1250" /><link rel="stylesheet" href="/css_print/main.css" type="text/css" />');docObj.write('<title>'+site_const.sSiteTitle+' - '+controler.page_title+'</title></head>');docObj.write('<div class="logo_left"><img src="/img/print/logo.gif"/></div><div class="logo_right"><img src="/img/print/logo.gif" /></div>');docObj.write(sPageTitle);docObj.write(center_div.domObj.innerHTML);docObj.write('</body></html>');docObj.close();}var ponuda_rezultati = null;var profiler = new profiler_class();var testCount = 0;
function controler_class()
{this.status = 0;this.fwd_history  = new Array();this.back_history = new Array();this.current_page = null;this.fwdButton  = null;this.backButton = null;this.active_page = 8;this.active_obj = null;this.page_title = '';
this.loadPage = function(inPageType, inPageTitle, inParams, inMediaTag)
{if(this.current_page == null){this.current_page = {page_type:8, page_title:'', params:'', media_tag:'', active_page:this.active_page};}this.back_history.push(this.current_page);this.current_page = {page_type:inPageType, page_title:inPageTitle, params:inParams, media_tag:inMediaTag, active_page:this.active_page};this.fwd_history = null;this.fwd_history = new Array();if(this.fwdButton == null)this.initHistory();this.fwdButton.style.display = 'none';this.backButton.style.display = 'block';this.startLoading(inPageType, inPageTitle, inParams, inMediaTag);}
this.onForward_click = function()
{this.back_history.push(this.current_page);this.current_page = this.fwd_history.pop();if(this.fwd_history.length==0)this.fwdButton.style.display = 'none';this.backButton.style.display = 'block';this.active_page = this.current_page.active_page;this.startLoading(this.current_page.page_type, this.current_page.page_title, this.current_page.params, '?utm_source=naslovnica&utm_medium=button&utm_content=forward', true);}
this.onBack_click = function()
{this.fwd_history.push(this.current_page);this.current_page = this.back_history.pop();if(this.back_history.length==0)this.backButton.style.display = 'none';this.fwdButton.style.display = 'block';this.active_page = this.current_page.active_page;this.startLoading(this.current_page.page_type, this.current_page.page_title, this.current_page.params, '?utm_source=naslovnica&utm_medium=button&utm_content=back', true);}
this.startLoading = function(inPageType, inPageTitle, inParams, inMediaTag, inDisableTracker)
{var sGlue = '';var trackerURL = "";var documentTitle = "";if(typeof(inDisableTracker) == 'undefined' || inDisableTracker==null)inDisableTracker = false;if(typeof(inMediaTag) == 'undefined' || inMediaTag==null)inMediaTag = '';if(typeof(inPageTitle) != 'undefined' && inPageTitle!=null)inPageTitle = inPageTitle.substr(0, 90);if(typeof(inParams) == 'undefined' || inParams == null)inParams = '';else sGlue = '&';if(this.status == 2) return;if(this.status == 1) this.abort();this.status = 2;appStatus.setStatus(this.status);if(this.active_obj != null){this.active_obj.terminate;this.active_obj = null;}titlebar.hide_icons();center_div.domObj.className = '';if(inPageType == 15)inPageType = this.active_page;switch(inPageType){case 8: this.page_title = 'NASLOVNICA';trackerURL = '/naslovnica/';documentTitle = 'Naslovnica';this.active_obj = htmlLoader;htmlLoader.open('/html/naslovnica.asp');break;case 2: this.page_title = 'POSLOVNICE';trackerURL = '/poslovnice/';documentTitle = 'Poslovnice';this.active_obj = htmlLoader;htmlLoader.open('/html_local/poslovnice.asp');center_div.domObj.className = 'ponuda_rezultati';break;case 21: this.page_title = inPageTitle;trackerURL = '/vijest_detalji/';documentTitle = 'Vijesti';this.active_obj = htmlLoader;htmlLoader.open('/html/vijest.asp');break;case 20: this.page_title = inPageTitle;trackerURL = '/tjednik_detalji/';documentTitle = 'Tjednik';this.active_obj = htmlLoader;htmlLoader.open('/html/tjednik.asp');break;case 4: this.page_title = 'TJEDNICI';trackerURL = '/tjednici_popis/';documentTitle = 'Tjednici';this.active_obj = htmlLoader;htmlLoader.open('/html/tjednici.asp');titlebar.icons.arhiva_open.show();break;case 19: this.page_title = inPageTitle;trackerURL = '/listic_tjedna/';documentTitle = 'Listić tjedna';this.active_obj = htmlLoader;htmlLoader.open('/html/listic_tjedna.asp');break;case 5: this.page_title = 'LISTIĆ TJEDNA';trackerURL = '/listici_tjedna_popis/';documentTitle = 'Listić tjedna';this.active_obj = htmlLoader;htmlLoader.open('/html/listici.asp');titlebar.icons.arhiva_open.show();break;case 9: this.page_title = 'PRAVILA';trackerURL = '/pravila/';documentTitle = 'Pravila';htmlLoader.open('/html_local/pravila.asp');this.active_obj = htmlLoader;break;case 3: this.page_title = 'UPUTE';trackerURL = '/upute/';documentTitle = 'Upute';htmlLoader.open('/html/upute.asp');this.active_obj = htmlLoader;break;case 6: this.page_title = 'KONTAKT';trackerURL = '/kontakt/';documentTitle = 'Kontakt';htmlLoader.open('/html_local/kontakt.asp');this.active_obj = htmlLoader;break;case 13: this.page_title = 'REZULTATI - TRAŽILICA';trackerURL = '/rezultati_trazilica/';documentTitle = 'Rezultati - tražilica';htmlLoader.open('/html/trazilica.asp');this.active_obj = htmlLoader;titlebar.icons.page_print.show();break;case 7: this.page_title = 'TELETEXT';trackerURL = '/teletext/';documentTitle = 'Teletext';htmlLoader.open('/html_local/teletext.asp');this.active_obj = htmlLoader;break;case 0: this.page_title = inPageTitle;trackerURL = '/ponuda/';documentTitle = inPageTitle;if(ponuda_rezultati != null)ponuda_rezultati = null;ponuda_rezultati = new ponuda_rezultati_class(0);ponuda_rezultati.onload = controler.onLoadHandler;ponuda_rezultati.dataSource = '/rpc/ponuda.asp';this.active_obj = ponuda_rezultati;titlebar.icons.page_print.show();titlebar.icons.hide_old.show();break;case 1: this.page_title = inPageTitle;trackerURL = '/rezultati/';documentTitle = inPageTitle;if(ponuda_rezultati != null)ponuda_rezultati = null;ponuda_rezultati = new ponuda_rezultati_class(1);ponuda_rezultati.onload = controler.onLoadHandler;ponuda_rezultati.dataSource = '/rpc/rezultati.asp';this.active_obj = ponuda_rezultati;titlebar.icons.page_print.show();break;case 10: this.page_title = inPageTitle;trackerURL = '/loto_izvlacenja/';documentTitle = inPageTitle;htmlLoader.open('/html_local/loto_izvlacenja.asp');this.active_obj = htmlLoader;break;case 11: this.page_title = inPageTitle;trackerURL = '/loto_ponuda/';documentTitle = inPageTitle;if(ponuda_rezultati != null)ponuda_rezultati = null;ponuda_rezultati = new ponuda_rezultati_class(0);ponuda_rezultati.onload = controler.onLoadHandler;ponuda_rezultati.dataSource = '/rpc/loto_ponuda.asp';this.active_obj = ponuda_rezultati;titlebar.icons.page_print.show();titlebar.icons.hide_old.show();break;case 12: this.page_title = 'LOTO - REZULTATI';trackerURL = '/loto_rezultati/';documentTitle = 'LOTO - REZULTATI';if(ponuda_rezultati != null)ponuda_rezultati = null;ponuda_rezultati = new ponuda_rezultati_class(1);ponuda_rezultati.onload = controler.onLoadHandler;ponuda_rezultati.dataSource = '/rpc/loto_rezultati.asp';this.active_obj = ponuda_rezultati;titlebar.icons.page_print.show();titlebar.icons.arhiva_open.show();break;case 14: switch(this.active_page){case 4: this.page_title = 'TJEDNICI - ARHIVA';trackerURL = '/tjednici_arhiva/';documentTitle = 'Tjednici - Arhiva';htmlLoader.open('/html/tjednici.asp');this.active_obj = htmlLoader;inParams+=sGlue+'arhiva=true';break;case 5: this.page_title = 'LISTIĆI TJEDNA - ARHIVA';trackerURL = '/listici_tjedna_arhiva/';documentTitle = 'Listići Tjedna - Arhiva';htmlLoader.open('/html/listici.asp');this.active_obj = htmlLoader;inParams+=sGlue+'arhiva=true';break;case 12: this.page_title = 'LOTO REZULTATI - ARHIVA';trackerURL = '/loto_rezultati_arhiva/';documentTitle = 'Loto Rezultati - Arhiva';if(ponuda_rezultati != null)ponuda_rezultati = null;ponuda_rezultati = new ponuda_rezultati_class(1);ponuda_rezultati.onload = controler.onLoadHandler;ponuda_rezultati.dataSource = '/rpc/loto_arhiva.asp';this.active_obj = ponuda_rezultati;titlebar.icons.page_print.show();break;}inPageType = this.active_page;titlebar.icons.arhiva_close.show();break;case 16: this.page_title = 'SMS';trackerURL = '/sms/';documentTitle = 'SMS';this.active_obj = htmlLoader;htmlLoader.open('/html_local/sms.asp');break;case 17: this.page_title = 'STATISTIKE';trackerURL = '/statistike/';documentTitle = 'Statistike';this.active_obj = htmlLoader;htmlLoader.open('/html/statistike.asp');break;case 18: this.page_title = 'SISTEMI';trackerURL = '/sistemi/';documentTitle = 'Sistemi';this.active_obj = htmlLoader;htmlLoader.open('/html_local/sistemi.asp');center_div.domObj.className = 'ponuda_rezultati';break;case 22: this.page_title = inPageTitle;if(inParams.substr(0, 11)=='/html/upute')trackerURL = inParams.substr(5);else trackerURL = inParams;documentTitle = inPageTitle;this.active_obj = htmlLoader;htmlLoader.open(inParams);inParams=''; sGlue='';break;}this.active_page = inPageType;document.title = site_const.sSiteTitle + ' - ' + documentTitle;titlebar.setTitle(this.page_title);if(debugMode)inParams+=sGlue+'debugMode=true';try {if(!inDisableTracker)pageTracker._trackPageview(trackerURL+inMediaTag);}catch(err) {if(debugMode)debug('pageTracker._trackPageview error:'+err.number+' '+err.description);}if(inParams != '')this.active_obj.loadData(inParams);else this.active_obj.loadData();this.status = 1;appStatus.setStatus(this.status);return(false);}
this.abort = function()
{this.active_obj.abort();this.active_obj.terminate();this.status = 0;appStatus.setStatus(this.status);}
this.onLoadHandler = function()
{controler.status = 0;appStatus.setStatus(controler.status);}
this.initHistory = function()
{this.fwdButton = document.getElementById('fwdButton');this.backButton = document.getElementById('backButton');
this.fwdButton.onclick  = function() { controler.onForward_click(); };
this.backButton.onclick = function() { controler.onBack_click(); };
}}
function flashAction(inAction)
{var sMediaTag = '?utm_source=naslovnica&utm_medium=banner&utm_content=flash';switch(inAction){case 'ttx': controler.loadPage(7,null,null, sMediaTag);break;case 'sms': controler.loadPage(16,null,null, sMediaTag);break;case 'isplata': leftMenu.items[0].objA.onclick();leftMenu.items[0].submenu.items[0].makeRPC();break;case 'izrada_listica': controler.loadPage(3,null,null, sMediaTag);break;case 'loto': controler.loadPage(10, 'LOTO - IZVLAČENJA',null, sMediaTag);break;case 'tjednici': controler.loadPage(4,null,null, sMediaTag);break;case 'sistemi': controler.loadPage(18,null,null, sMediaTag);break;case 'poslovnice': controler.loadPage(2,null,null, sMediaTag);break;}}
function resizeContainer()
{var innerHeight = 0;if(window.innerHeight) {innerHeight = window.innerHeight;} else if(document.documentElement && typeof(document.documentElement.clientWidth)!='undefined' && document.documentElement.clientWidth!=0) {innerHeight = document.getElementsByTagName('body')[0].offsetHeight ;innerHeight = document.documentElement.clientHeight;} else {innerHeight = document.body.clientHeight;}var iNewHeight = innerHeight - 109;if(iNewHeight < 300)iNewHeight = 300;center_div.style.height = iNewHeight;center_overlay.style.height = iNewHeight+35;}
function appstatus_class(in_domID)
{this.domObj   = document.getElementById('appstatus');this.domClock = document.getElementById('clock');this.timerID = globalTimer.add(this,1000,true);this.dateObj = new Date();
this.setStatus = function(inStatus)
{globalTimer.stop(this.timerID);switch(inStatus){case 1: sText = 'Učitavam...';this.domObj.style.display = 'block';this.domClock.style.display = 'none';break;case 2: sText = 'Radim...';this.domObj.style.display = 'block';this.domClock.style.display = 'none';break;case 0: default: sText = '';globalTimer.start(this.timerID);this.domObj.style.display = 'none';this.domClock.style.display = 'block';this.timerTimeout();}this.domObj.innerHTML = sText;}
this.timerTimeout = function(inObj)
{var currentTime = new Date(clientTimeDiff + Date.parse(Date()));this.domClock.innerHTML = currentTime.getHRTime(true);}}
function center_div_class()
{this.domObj = document.getElementById('center');this.timerID = globalTimer.add(this,50,true);this.totalHeight = null;
this.resize = function(inListicHeight)
{var innerHeight = 0;if(!inListicHeight)inListicHeight = listic.windowObj.height;inListicHeight-=10;if(window.innerHeight){innerHeight = window.innerHeight;}else if(document.documentElement && typeof(document.documentElement.clientWidth)!='undefined' && document.documentElement.clientWidth!=0){innerHeight = document.getElementsByTagName('body')[0].offsetHeight;innerHeight = document.documentElement.clientHeight;}else {innerHeight = document.body.clientHeight;}this.totalHeight = innerHeight - 109;if(this.totalHeight < 300)this.totalHeight = 300;center_overlay.style.height = (this.totalHeight+35)+'px';this.domObj.style.height = (this.totalHeight - inListicHeight)+'px';this.domObj.style.margin = '25px 0 '+inListicHeight+'px 89px';}
this.handle_onresize = function(inEvent)
{this.resize();}
this.clear = function()
{this.domObj.innerHTML = '';}
this.timerTimeout = function(inObj)
{this.resize();};
this.showOverlay = function()
{center_overlay.style.height = (this.totalHeight+35)+'px';center_overlay.style.display='block';};
this.hideOverlay = function()
{center_overlay.style.display='none';};eventCenter.register('resize', this);}
function titlebar_class()
{this.domObj = document.getElementById('titlebar');this.icons = { arhiva_open:null, arhiva_close:null, page_print:null, hide_old: null};this.icons.hide_old     = new titlebar_icon_class("/img/icons/clock.gif", "Sakrij događaje koji su prošli");this.icons.unhide_old     = new titlebar_icon_class("/img/icons/clock_strike.gif", "Prikaži sve događaje");this.icons.arhiva_open  = new titlebar_icon_class("/img/icons/archive_open.gif", "Pristup arhivskim podacima");this.icons.arhiva_close = new titlebar_icon_class("/img/icons/archive_close.gif","Povratak na aktualne podatke");this.icons.page_print   = new titlebar_icon_class("/img/icons/printer.gif", "Print");
this.icons.hide_old.domObj.onclick = function()
{appStatus.setStatus(2);setTimeout('controler.active_obj.hide_old();',100);}
this.icons.unhide_old.domObj.onclick = function()
{appStatus.setStatus(2);setTimeout('controler.active_obj.unhide();',100);}
this.icons.arhiva_open.domObj.onclick = function() {controler.loadPage(14);}
this.icons.arhiva_close.domObj.onclick = function() {controler.loadPage(15);}
this.icons.page_print.domObj.onclick = function() {print_center();}
this.setTitle = function(inTitle)
{this.domObj.innerHTML = inTitle;}
this.hide_icons = function()
{this.icons.arhiva_open.hide();this.icons.arhiva_close.hide();this.icons.page_print.hide();this.icons.hide_old.hide();this.icons.unhide_old.hide();}}
function titlebar_icon_class(inImageSrc, inTitle)
{var domContainer = document.getElementById('titlebar_icons');this.domObj = document.createElement('img');this.domObj.src = inImageSrc;this.domObj.title = inTitle;this.domObj.alt = inTitle;this.domObj.style.display = 'none';domContainer.appendChild(this.domObj);
this.show = function()
{this.domObj.style.display = 'inline';}
this.hide = function()
{this.domObj.style.display = 'none';}}
function window_class(inDOMParent,
inTitle, inMouseOutClose, inDisableClose, inEnableMaximize, inEnableDetached){if(!inTitle) inTitle='';if(!inMouseOutClose) inMouseOutClose = false;if(!inDisableClose) inDisableClose = false;if(!inEnableMaximize) inEnableMaximize = false;this.timerID = null;this.domParent = inDOMParent;this.domObj = document.getElementById('win_template').cloneNode(true);this.domObj.id = null;this.parentObj = null;this.domContainer = this.domObj.getElementsByTagName('div')[1];this.domTitle = this.domObj.getElementsByTagName('td')[0];this.domTitle.innerHTML = inTitle;this.domDetach = this.domObj.getElementsByTagName('img')[0];this.domMaximize = this.domObj.getElementsByTagName('img')[1];this.domClose = this.domObj.getElementsByTagName('img')[2];if(inDisableClose)this.domClose.style.display = 'none';if(!inEnableMaximize)this.domMaximize.style.display = 'none';if(!inEnableDetached)this.domDetach.style.display = 'none';this.mouseLocation = {domTitle:false,domObj:false,domContainer:false,domClose:false};this.domTitle.parentObj = this;this.domObj.parentObj = this;this.domContainer.parentObj = this;this.domClose.parentObj = this;this.domMaximize.parentObj = this;this.domDetach.parentObj = this;if(inMouseOutClose){this.timerID = globalTimer.add(this,100,false);
this.domTitle.onmouseover = function() { this.parentObj.mouseOver(); }
this.domTitle.onmouseout = function() { this.parentObj.mouseOut(); }
this.domObj.onmouseover = function() { this.parentObj.mouseOver(); }
this.domObj.onmouseout = function() { this.parentObj.mouseOut(); }
this.domContainer.onmouseover = function() { this.parentObj.mouseOver(); }
this.domContainer.onmouseout = function() { this.parentObj.mouseOut(); }
this.domClose.onmouseover = function() { this.parentObj.mouseOver(); }
this.domClose.onmouseout = function() { this.parentObj.mouseOut(); }
this.domMaximize.onmouseover = function() { this.parentObj.mouseOver(); }
this.domMaximize.onmouseout = function() { this.parentObj.mouseOut(); }
this.domDetach.onmouseover = function() { this.parentObj.mouseOver(); }
this.domDetach.onmouseout = function() { this.parentObj.mouseOut(); }
}
this.domClose.onclick = function() { this.parentObj.close(); }
this.domMaximize.onclick = function() { this.parentObj.maximize(); }
this.domDetach.onclick = function() { this.parentObj.detach(); }
this.mouseOut = function(inObj)
{globalTimer.start(this.timerID);}
this.mouseOver = function(inObj)
{globalTimer.stop(this.timerID);}
this.timerTimeout = function(inObj)
{this.close();}
this.setTitle = function(inTitle)
{this.domTitle.innerHTML = inTitle;}
this.hideScrollbar = function()
{this.domContainer.style.overflow = 'hidden';}
this.showScrollbar = function()
{this.domContainer.setAttribute('style','overflow-y:scroll');}
this.addContent = function(inContent)
{if(typeof(inContent)=='string')this.domContainer.insertAdjacentHTML('beforeEnd', inContent);else this.domContainer.insertAdjacentElement('beforeEnd', inContent);}
this.open = function(inTop, inLeft, inWidth, inHeight)
{this.domParent.insertAdjacentElement('afterBegin', this.domObj);this.domObj.style.top = inTop+'px';this.domObj.style.left = inLeft+'px';this.domContainer.style.width = inWidth+'px';this.domContainer.style.height = inHeight+'px';this.domObj.style.display='block';}
this.close = function()
{if(this.parentObj != null)if(!this.parentObj.queryUnload())return;this.domObj.style.display='none';this.domParent.removeChild(this.domObj);this.terminate();}
this.maximize = function()
{if(this.parentObj != null)if(!this.parentObj.maximize())return;}
this.detach = function()
{if(this.parentObj != null)if(!this.parentObj.detach())return;}
this.enable_close = function()
{this.domClose.style.display = 'inline';}
this.enable_maximize = function()
{this.domMaximize.style.display = 'inline';}
this.enable_detach = function()
{this.domDetach.style.display = 'inline';}
this.terminate = function()
{if(this.timerID!=null){globalTimer.remove(this.timerID);this.domTitle.onmouseover = null;this.domTitle.onmouseout = null;this.domObj.onmouseover = null;this.domObj.onmouseout = null;this.domContainer.onmouseover = null;this.domContainer.onmouseout = null;this.domClose.onmouseover = null;this.domClose.onmouseout = null;this.domMaximize.onmouseover = null;this.domMaximize.onmouseout = null;this.domDetach.onmouseover = null;this.domDetach.onmouseout = null;}this.domMaximize.onclick = null;this.domMaximize.parentObj = null;this.domDetach.onclick = null;this.domDetach.parentObj = null;this.domClose.onclick = null;this.domClose.parentObj = null;this.queryUnload = null;this.domClose = null;this.domParent = null;this.domContainer = null;this.domTitle = null;this.domObj = null;}}var clientTimeDiff = 0;
function getServerTime()
{return(new Date(clientTimeDiff + Date.parse(Date())));}
function setServerTime(inServerTime)
{var tmpDate = new Date;tmpDate.parseHRDate(inServerTime);clientTimeDiff = Date.parse(tmpDate) - Date.parse(Date());}
function listic_class()
{this.aDogadjaji = new Array();this.aDogadjajiOrder = null;this.superprognoza = false;this.brojSistemskih = 0;this.aSistemskiKoeff = null;this.windowObj = new listic_window_class(this);this.sistemObj = new sistem_class(this);this.izracunObj = new izracun_class(this);this.broj_listica = null;this.serverRequest = null;if(debugMode)this.dataSource = '/rpc/listic.asp?debugMode=true';else this.dataSource = '/rpc/listic.asp';this.statusWindow = null;this.listic_row_template = document.getElementById('listic_row_template');
this.addDogadjaj = function(inSetTipova, inID_ovi)
{var iDataIndex=-1;var iID_dogadjaja = inID_ovi[4];do { ++iDataIndex;} while(inSetTipova.aData[iDataIndex].id_dogadjaja != iID_dogadjaja);var tmpTime = getServerTime();if(inSetTipova.aData[iDataIndex].vrijeme < tmpTime){msgbox('Događaj je započeo – nije ga moguće dodati na listić!');return;}if(this.aDogadjaji.length > 0){if(this.aDogadjaji.length == site_const.max_br_dogadjaja){msgbox('Listić već sadrži '+site_const.max_br_dogadjaja+' događaja.\nViše od toga nije dozvoljeno!');return;}if(this.superprognoza){if(inSetTipova.grupa_dogadjaja.sport.id_sporta != site_const.superprognoza_sportID){msgbox('Odabrani događaj nije moguće dodati na listić jer ne pripada '+site_const.superprognoza_naziv_dativ+'.'+ '\n\nAko listić sadrži događaje sa '+site_const.superprognoza_naziv_genitiv+', moguće je'+ '\ndodavati samo događaje koji su također sa '+site_const.superprognoza_naziv_genitiv+'!');return;}}else if(inSetTipova.grupa_dogadjaja.sport.id_sporta == site_const.superprognoza_sportID){msgbox('Odabrani događaj nije moguće dodati na listić jer pripada '+site_const.superprognoza_naziv_dativ+'.'+ '\n\nAko listić sadrži događaje koji nisu sa '+site_const.superprognoza_naziv_genitiv+','+ '\nnije moguće dodavati samo događaje koji jesu sa '+site_const.superprognoza_naziv_genitiv+'!');return;}var aKod = inSetTipova.grupa_dogadjaja.dogadjaji[iID_dogadjaja][9];if(aKod == '')aKod = null;else aKod = aKod.split(' ');var iIndex = this.aDogadjaji.length-1;var tmpIDVarijante = inSetTipova.aData[iDataIndex].aDogadjaj_koef[1];var sKodSpecijalke1 = inSetTipova.aData[iDataIndex].aDogadjaj_koef[6];do {if(this.aDogadjaji[iIndex].id_ovi[4]==inID_ovi[4]){var sTextPoruke = 'Odabrana varijanta događaja\n'+inSetTipova.aData[iDataIndex].broj+' '+inSetTipova.aData[iDataIndex].naziv+'\nse već nalazi na listiću!';if(this.aDogadjaji[iIndex].aDogadjaj_koef[1] == tmpIDVarijante){msgbox(sTextPoruke);return;}var sKodSpecijalke2 = this.aDogadjaji[iIndex].aDogadjaj_koef[6];if(sKodSpecijalke1=='' || sKodSpecijalke2==''){msgbox(sTextPoruke);return;}aKodSpec_1 = sKodSpecijalke1.split(' ');aKodSpec_2 = sKodSpecijalke2.split(' ');var tmpKod_1, tmpKod_2;for(tmpKod_1 in aKodSpec_1){for(tmpKod_2 in aKodSpec_2)if(aKodSpec_1[tmpKod_1] == aKodSpec_2[tmpKod_2])break;if(aKodSpec_1[tmpKod_1] == aKodSpec_2[tmpKod_2])break;}if(aKodSpec_1[tmpKod_1] != aKodSpec_2[tmpKod_2]){msgbox(sTextPoruke);return;}}else if(aKod != null){if(!this.aDogadjaji[iIndex].provjeriKod(aKod)){msgbox('Odabrani događaj nije moguće kombinirati sa\n'+this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv);return;}}} while(--iIndex > -1);}else {if(this.windowObj.hidden)this.windowObj.show();else globalTimer.stop(this.windowObj.timerID);if(this.windowObj.autohide)this.windowObj.toggleAutohide(false);if(inSetTipova.grupa_dogadjaja.sport.id_sporta == site_const.superprognoza_sportID)this.superprognoza=true;else this.superprognoza=false;}var tmpRow = new listic_row_class(this);tmpRow.init(inSetTipova, inID_ovi, iDataIndex);this.aDogadjaji.push(tmpRow);this.windowObj.refresh();this.izracunObj.refresh();this.windowObj.titlebar.domTitlebar.innerHTML = 'IZRADA LISTIĆA - ' + tmpRow.naziv;return(true);}
this.deleteDogadjaj = function(inRowObj)
{var i = -1;while(this.aDogadjaji[++i]!=inRowObj) {};this.aDogadjaji[i].terminate();this.aDogadjaji.splice(i,1);this.windowObj.refresh();this.sistemObj.refresh();this.izracunObj.refresh();this.windowObj.resize();}
this.checkDogadjaj = function(inID)
{this.windowObj.refresh();this.izracunObj.recalcKoef();this.sistemObj.refresh();this.izracunObj.refresh();this.windowObj.resize();return(true);}
this.clearAll = function()
{var i=this.aDogadjaji.length;while(i-->0){this.aDogadjaji[i].terminate();this.aDogadjaji[i]=null;}this.brojSistemskih = 0;this.aSistemskiKoeff = null;this.aDogadjaji = new Array();this.windowObj.refresh();this.sistemObj.refresh();this.izracunObj.refresh();this.windowObj.resize();if(!this.windowObj.autohide){this.windowObj.toggleAutohide(true);globalTimer.start(this.windowObj.timerID);}}
this.showPrint = function()
{appStatus.setStatus(2);this.openStatusWindow();this.statusWindow.addContent('Priprema listića za ispis ...');if(this.aDogadjaji.length == 0){msgbox("Ispis nije moguć - listić je prazan!");this.closeStatusWindow();return;}if(site_const.min_uplata > this.izracunObj.uplata){msgbox('Ispis nije moguć - premali iznos uplate!' +'\n\nPravila nalažu minimalni ulog od '+formatCurr(site_const.min_uplata)+' '+site_const.valuta);this.closeStatusWindow();return;}var iBrojDogadjaja = this.aDogadjaji.length;var iIndex = iBrojDogadjaja-1;var dogExtremes = {br_dog:{iMin:0, min_naziv:'', iMax:site_const.max_br_dogadjaja, max_naziv:''}, uplata:{iMin:0, min_naziv:'', iMax:99999999, max_naziv:''}};var varExtremes = {br_dog:{iMin:0, min_naziv:'', iMax:site_const.max_br_dogadjaja, max_naziv:''}, uplata:{iMin:0, min_naziv:'', iMax:99999999, max_naziv:''}};do {if(this.brojSistemskih==0 || this.aDogadjaji[iIndex].sistemski){if(dogExtremes.uplata.iMin < this.aDogadjaji[iIndex].min_uplata){dogExtremes.uplata.iMin = this.aDogadjaji[iIndex].min_uplata;dogExtremes.uplata.min_naziv = this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv;}if(dogExtremes.uplata.iMax > this.aDogadjaji[iIndex].max_uplata){dogExtremes.uplata.iMax = this.aDogadjaji[iIndex].max_uplata;dogExtremes.uplata.max_naziv = this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv;}if(dogExtremes.br_dog.iMin < this.aDogadjaji[iIndex].min_br){dogExtremes.br_dog.iMin = this.aDogadjaji[iIndex].min_br;dogExtremes.br_dog.min_naziv = this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv;}if(dogExtremes.br_dog.iMax > this.aDogadjaji[iIndex].max_br){dogExtremes.br_dog.iMax = this.aDogadjaji[iIndex].max_br;dogExtremes.br_dog.max_naziv = this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv;}if(varExtremes.uplata.iMin < this.aDogadjaji[iIndex].aDogadjaj_koef[4]){varExtremes.uplata.iMin = this.aDogadjaji[iIndex].aDogadjaj_koef[4];varExtremes.uplata.min_naziv = this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv;}if(varExtremes.uplata.iMax > this.aDogadjaji[iIndex].aDogadjaj_koef[5]){varExtremes.uplata.iMax = this.aDogadjaji[iIndex].aDogadjaj_koef[5];varExtremes.uplata.max_naziv = this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv;}if(varExtremes.br_dog.iMin < this.aDogadjaji[iIndex].aDogadjaj_koef[2]){varExtremes.br_dog.iMin = this.aDogadjaji[iIndex].aDogadjaj_koef[2];varExtremes.br_dog.min_naziv = this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv;}if(varExtremes.br_dog.iMax > this.aDogadjaji[iIndex].aDogadjaj_koef[3]){varExtremes.br_dog.iMax = this.aDogadjaji[iIndex].aDogadjaj_koef[3];varExtremes.br_dog.max_naziv = this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv;}}} while(--iIndex > -1);if(this.brojSistemskih == 0){if(dogExtremes.uplata.iMin > this.izracunObj.uplata){msgbox('Ispis nije moguć - premali iznos uplate!' +'\n\nDogađaj '+dogExtremes.uplata.min_naziv +'\ndopušta uplatu od najmanje '+formatCurr(dogExtremes.uplata.iMin)+' '+site_const.valuta);this.closeStatusWindow();return;}else if(dogExtremes.uplata.iMax < this.izracunObj.uplata){msgbox('Ispis nije moguć - prevelik iznos uplate!' +'\n\nDogađaj '+dogExtremes.uplata.max_naziv +'\ndopušta uplatu od najviše '+formatCurr(dogExtremes.uplata.iMax)+' '+site_const.valuta);this.closeStatusWindow();return;}if(dogExtremes.br_dog.iMin > iBrojDogadjaja){msgbox('Ispis nije moguć - listić sadrži premalo događaja!' +'\n\nDogađaj '+dogExtremes.br_dog.min_naziv +'\nnalaže najmanje '+dogExtremes.br_dog.iMin+' događaja');this.closeStatusWindow();return;}else if(dogExtremes.br_dog.iMax < iBrojDogadjaja){msgbox('Ispis nije moguć - listić sadrži previše događaja!' +'\n\nDogađaj '+dogExtremes.br_dog.max_naziv +'\ndopušta najviše '+dogExtremes.br_dog.iMax+' događaja');this.closeStatusWindow();return;}if(varExtremes.uplata.iMin > this.izracunObj.uplata){msgbox('Ispis nije moguć - premali iznos uplate!' +'\n\nDogađaj '+varExtremes.uplata.min_naziv +'\ndopušta uplatu od najmanje '+formatCurr(varExtremes.uplata.iMin)+' '+site_const.valuta);this.closeStatusWindow();return;}else if(varExtremes.uplata.iMax < this.izracunObj.uplata){msgbox('Ispis nije moguć - prevelik iznos uplate!' +'\n\nDogađaj '+varExtremes.uplata.max_naziv +'\ndopušta uplatu od najviše '+formatCurr(varExtremes.uplata.iMax)+' '+site_const.valuta);this.closeStatusWindow();return;}if(varExtremes.br_dog.iMin > iBrojDogadjaja){msgbox('Ispis nije moguć - listić sadrži premalo događaja!' +'\n\nDogađaj '+varExtremes.br_dog.min_naziv +'\nnalaže najmanje '+varExtremes.br_dog.iMin+' događaja');this.closeStatusWindow();return;}else if(varExtremes.br_dog.iMax < iBrojDogadjaja){msgbox('Ispis nije moguć - listić sadrži previše događaja!' +'\n\nDogađaj '+varExtremes.br_dog.max_naziv +'\ndopušta najviše '+varExtremes.br_dog.iMax+' događaja');this.closeStatusWindow();return;}}else {if(this.sistemObj.odabranihIzvl == 0){msgbox('Ispis nije moguć - u sistemu nije odabrana niti jedna kombinacija!');this.closeStatusWindow();return;}var objIzvlacenje = null;var brFikseva = this.aDogadjaji.length - this.brojSistemskih;iIndex = this.sistemObj.aGrupeKombinacija.length-1;do {objIzvlacenje = this.sistemObj.aGrupeKombinacija[iIndex];if(objIzvlacenje.selected){if(objIzvlacenje.uplata_po_komb < site_const.min_uplata_sistem){msgbox('Ispis nije moguć - premala uplata po kombinaciji!' +'\n\nPravila nalažu minimalnu uplatu od '+formatCurr(site_const.min_uplata_sistem)+' '+site_const.valuta +'\npo kombinaciji.');this.closeStatusWindow();return;}if(dogExtremes.br_dog.iMax < (objIzvlacenje.broj_izvlacenja+brFikseva)){msgbox('Ispis nije moguć - grupa kombinacija ('+brFikseva+'+'+objIzvlacenje.broj_izvlacenja+'/'+objIzvlacenje.broj_dogadjaja+') zajedno sa fiksevima' +'\nsadrži previše događaja ('+brFikseva+'+'+objIzvlacenje.broj_izvlacenja+'='+(brFikseva+objIzvlacenje.broj_izvlacenja)+')!' +'\n\nDogađaj '+dogExtremes.br_dog.max_naziv+' nalaže najviše '+dogExtremes.br_dog.iMax+' događaja, uključujući fikseve.');this.closeStatusWindow();return;}else if(dogExtremes.br_dog.iMin > (objIzvlacenje.broj_izvlacenja+brFikseva)){msgbox('Ispis nije moguć - odabrana grupa kombinacija ('+brFikseva+'+'+objIzvlacenje.broj_izvlacenja+'/'+objIzvlacenje.broj_dogadjaja+') zajedno sa fiksevima' +'\nsadrži premalo događaja ('+brFikseva+'+'+objIzvlacenje.broj_izvlacenja+'='+(brFikseva+objIzvlacenje.broj_izvlacenja)+')!' +'\n\nDogađaj '+dogExtremes.br_dog.min_naziv+' nalaže najmanje '+dogExtremes.br_dog.iMin+' događaja, uključujući fikseve.');this.closeStatusWindow();return;}if(varExtremes.br_dog.iMax < (objIzvlacenje.broj_izvlacenja+brFikseva)){msgbox('Ispis nije moguć - grupa kombinacija ('+brFikseva+'+'+objIzvlacenje.broj_izvlacenja+'/'+objIzvlacenje.broj_dogadjaja+') zajedno sa fiksevima' +'\nsadrži previše događaja ('+brFikseva+'+'+objIzvlacenje.broj_izvlacenja+'='+(brFikseva+objIzvlacenje.broj_izvlacenja)+')!' +'\n\nDogađaj '+varExtremes.br_dog.max_naziv+' nalaže najviše '+varExtremes.br_dog.iMax+' događaja, uključujući fikseve.');this.closeStatusWindow();return;}else if(varExtremes.br_dog.iMin > (objIzvlacenje.broj_izvlacenja+brFikseva)){msgbox('Ispis nije moguć - odabrana grupa kombinacija ('+brFikseva+'+'+objIzvlacenje.broj_izvlacenja+'/'+objIzvlacenje.broj_dogadjaja+') zajedno sa fiksevima' +'\nsadrži premalo događaja ('+brFikseva+'+'+objIzvlacenje.broj_izvlacenja+'='+(brFikseva+objIzvlacenje.broj_izvlacenja)+')!' +'\n\nDogađaj '+varExtremes.br_dog.min_naziv+' nalaže najmanje '+varExtremes.br_dog.iMin+' događaja, uključujući fikseve.');this.closeStatusWindow();return;}}} while(--iIndex > -1);}appStatus.setStatus(1);this.sendData();}
this.sendData = function()
{if(this.serverRequest == null)this.serverRequest = createHTTPRequest();this.serverRequest.open("GET", this.dataSource, true);this.prepareSend();try { this.serverRequest.onload = this.receiveData; }catch(error){
this.serverRequest.onreadystatechange = function()
{if(listic.serverRequest.readyState == 4)listic.receiveData();}}this.serverRequest.send(null);}
this.prepareSend = function()
{var aString1 = this.izracunObj.prepareSend();var aString2 = this.sistemObj.prepareSend();var aString3 = new Array();var iRedniBroj = 0;var iTo = this.aDogadjaji.length;aString3.push(iTo);do {aString3.push(this.aDogadjaji[  this.aDogadjajiOrder[iRedniBroj]  ].prepareSend(iRedniBroj));} while(++iRedniBroj < iTo)aString3.push('');aString3 = aString3.join('|');this.serverRequest.setRequestHeader("String1", aString1);this.serverRequest.setRequestHeader("String2", aString2);this.serverRequest.setRequestHeader("String3", aString3);return;}
this.receiveData = function()
{appStatus.setStatus(2);listic.statusWindow.enable_close();if(listic.serverRequest.status != 404)listic.broj_listica = listic.serverRequest.getResponseHeader("broj_listica");else listic.broj_listica = null;listic.statusWindow.addContent('<br><br>...ispis pripremljen - za ispis kliknite na ikonu printera');listic.statusWindow.addContent('<br><br><a href="#" onclick="listic_print();listic.closeStatusWindow();return(false);"><img src="/img/print/printer_icon.gif" title="Ispiši listić" /></a>');appStatus.setStatus(0);}
this.openStatusWindow = function()
{if(this.statusWindow == null)this.statusWindow = new window_class(wrapper_div, 'Priprema listića za ispis', false, true);this.statusWindow.parentObj = this;this.statusWindow.domContainer.id = 'listic_status';center_div.showOverlay();this.statusWindow.open(200,250,320,130);}
this.queryUnload = function()
{center_div.hideOverlay();this.statusWindow = null;return(true);}
this.closeStatusWindow = function()
{if(this.statusWindow != null)this.statusWindow.close();this.statusWindow = null;center_div.hideOverlay();}
this.terminate = function()
{this.clearAll();this.aDogadjaji = null;this.windowObj.terminate();this.windowObj = null;this.titlebar.terminate();this.titlebar = null;this.sistemObj.terminate();this.sistemObj = null;this.aSistemskiKoeff = null;}}
function listic_icon_class(inImageSrc, inTitle)
{this.domObj = document.createElement('img');this.domObj.src = inImageSrc;this.domObj.title = inTitle;this.domObj.alt = inTitle;this.domObj.style.display = 'none';document.getElementById('listic_icons').appendChild(this.domObj);
this.show = function()
{this.domObj.style.display = 'inline';}
this.hide = function()
{this.domObj.style.display = 'none';}
this.terminate = function()
{document.getElementById('listic_icons').removeChild(this.domObj);this.domObj.onclick = null;this.domObj = null;}}
function listic_row_class(inParent)
{this.parent = inParent;
this.init = function(inSetTipova, inID_ovi, inDataIndex)
{this.parentDOM = null;this.domObj = this.parent.listic_row_template.cloneNode(true);this.domObj.id = '';this.id_ovi = inID_ovi;this.sistemski = false;this.naziv = inSetTipova.aData[inDataIndex].naziv;this.broj  = inSetTipova.aData[inDataIndex].broj;this.koeff = inSetTipova.aData[inDataIndex].koeff[inID_ovi[5]];this.vrijeme = inSetTipova.aData[inDataIndex].vrijeme;this.aDogadjaj_koef = inSetTipova.aData[inDataIndex].aDogadjaj_koef;var objDogadjaj = inSetTipova.grupa_dogadjaja.dogadjaji[inID_ovi[4]];this.kod = objDogadjaj[9].trim().split(' ');this.min_br = objDogadjaj[5];this.max_br = objDogadjaj[6];this.min_uplata = objDogadjaj[7];this.max_uplata = objDogadjaj[8];var j=-1;do { ++j;} while(inSetTipova.aTipovi[j+0] != inID_ovi[5])this.tipNaziv = inSetTipova.aTipovi[j+1];this.domObj.getElementsByTagName('input')[0].id = 'check'+inID_ovi[0];var aLabel = this.domObj.getElementsByTagName('label')[0];aLabel.htmlFor = 'check'+inID_ovi[0];aLabel.innerHTML = this.broj+' '+this.naziv;aLabel.title = this.broj+' '+this.naziv;var aTD = this.domObj.getElementsByTagName('td');aTD[1].innerHTML = this.tipNaziv;aTD[2].innerHTML = formatKoeff(this.koeff);var domImg = this.domObj.getElementsByTagName('img')[0];domImg.parentObj = this;
domImg.onclick = function() { this.parentObj.remove(); }
this.domCheckbox = this.domObj.getElementsByTagName('input')[0];this.domCheckbox.parentObj = this;
this.domCheckbox.onclick = function() { return(this.parentObj.checkbox_onClick()); }
}
this.checkbox_onClick = function()
{if(this.parent.superprognoza){alert('Za događaje '+site_const.superprognoza_naziv_genitiv+'\nizrada sistemskog listića nije moguća!');return(false);}if(this.domCheckbox.checked){if(this.parent.brojSistemskih == site_const.max_br_sistemskih_dog){alert('Već je odabran maksimalan broj sistemskih događaja ('+site_const.max_br_sistemskih_dog+').\nDodavanje novih nije moguće!');return(false);}this.domCheckbox.title = 'Označi događaj kao fiks';this.sistemski = true;}else {this.domCheckbox.title = 'Označi događaj kao sistemski';this.sistemski = false;}this.parent.checkDogadjaj();return(true);}
this.provjeriKod = function(inKod)
{if(this.kod.length == 0)return(true);for(var i in inKod)for(var j in this.kod)if(this.kod[j] == inKod[i])return(false);return(true);}
this.hide = function()
{if(this.parentDOM!=null)this.parentDOM.removeChild(this.domObj);this.parentDOM==null;}
this.show = function(inDomParent, inNazivPrefix)
{var aLabel = this.domObj.getElementsByTagName('label')[0];this.nazivPrefix = inNazivPrefix;aLabel.innerHTML = inNazivPrefix+this.broj+' '+this.naziv;aLabel.title = this.broj+' '+this.naziv;this.parentDOM = inDomParent;inDomParent.appendChild(this.domObj);}
this.remove = function()
{this.parent.deleteDogadjaj(this);}
this.getHTML = function(inPrefix)
{return( '<tr><th>'+this.broj+'</th>' +'<td>'+inPrefix+this.naziv+'</td>' +'<td>'+this.vrijeme.getWeekday(true)+', '+this.vrijeme.getHRTime(false)+'</td>' +'<th class="koeff">'+this.tipNaziv+'</th>' +'<th>'+formatKoeff(this.koeff)+'</th></tr>');}
this.prepareSend = function(inRedniBroj)
{var aReturn = new Array();aReturn.push(inRedniBroj);aReturn.push(this.id_ovi[4]);aReturn.push(this.id_ovi[3]);aReturn.push(this.aDogadjaj_koef[1]);aReturn.push(this.id_ovi[5]);aReturn.push(this.broj);aReturn.push(this.nazivPrefix.charAt(0));aReturn.push(this.tipNaziv);aReturn.push(this.koeff);return(aReturn.join('|'));}
this.terminate = function()
{var tmpDom = this.domObj.getElementsByTagName('img')[0];tmpDom.onclick = null;tmpDom.parentObj = null;this.domCheckbox.onclick = null;this.domCheckbox.parentObj = null;this.domCheckbox = null;this.hide();this.parentDOM = null;this.domObj = null;this.parent = null;}}
function listic_titlebar_class()
{this.domTitlebar = document.getElementById('listic_title');this.icons = { tick_up:null, tick_down:null, printer:null, recycle:null, minimize:null};this.icons.printer    = new listic_icon_class("/img/listic/printer.gif", "Ispis listića");this.icons.recycle    = new listic_icon_class("/img/listic/recycle.gif","Brisanje listića");this.icons.tick_up    = new listic_icon_class("/img/listic/tick_up.gif", "Isključi automatsko skrivanje");this.icons.tick_down  = new listic_icon_class("/img/listic/tick_down.gif", "Uključi automatsko skrivanje");this.icons.minimize   = new listic_icon_class("/img/listic/minimize.gif", "Sakrij listić");this.icons.tick_up.show();this.icons.tick_down.hide();this.icons.printer.show();this.icons.recycle.show();this.icons.minimize.show();
this.icons.recycle.domObj.onclick = function()
{var r = confirm('Odabrali ste brisanje svih događaja na listiću. Jeste li sigurni?');if(r == true) listic.clearAll();}
this.icons.minimize.domObj.onclick = function() { listic.windowObj.hide(); }
this.icons.printer.domObj.onclick = function() { listic.showPrint(); }
this.icons.tick_up.domObj.onclick = function() { listic.windowObj.toggleAutohide(false); }
this.icons.tick_down.domObj.onclick = function() { listic.windowObj.toggleAutohide(true); }
this.terminate = function()
{this.icons.tick_up.terminate();this.icons.tick_down.terminate();this.icons.printer.terminate();this.icons.recycle.terminate();this.icons.minimize.terminate();this.icons.tick_up    = null;this.icons.tick_down  = null;this.icons.printer    = null;this.icons.recycle    = null;this.icons.minimize   = null;}}
function listic_window_class(inParent)
{this.titlebar = new listic_titlebar_class();this.domTitlebar = document.getElementById('listic_title');this.domContainer = document.getElementById('listic_container');this.domIcons = document.getElementById('listic_icons');this.domListic_sistem = document.getElementById('listic_sistem');this.parent = inParent;this.timerID = null;this.timerID = globalTimer.add(this,1000,false);this.autohide = true;this.hidden = true;this.openHeight = 118;this.closedHeight = 25;this.height = this.closedHeight;
this.domTitlebar.onmouseover = function() { listic.windowObj.mouseOver(); }
this.domTitlebar.onmouseout = function() { listic.windowObj.mouseOut(); }
this.domContainer.onmouseover = function() { listic.windowObj.mouseOver(); }
this.domContainer.onmouseout = function() { listic.windowObj.mouseOut(); }
this.domIcons.onmouseover = function() { listic.windowObj.mouseOver(); }
this.domIcons.onmouseout = function() { listic.windowObj.mouseOut(); }
this.domLeftColumn = document.getElementById('listic_dogadjaji_l').getElementsByTagName('TBODY')[0];this.domRightColumn = document.getElementById('listic_dogadjaji_r').getElementsByTagName('TBODY')[0];
this.hide = function()
{this.domContainer.style.display = 'none';this.domTitlebar.style.bottom = '11px';this.domTitlebar.style.height = '22px';this.domIcons.style.bottom = '12px';this.height = this.closedHeight;globalTimer.start(center_div.timerID);this.hidden = true;}
this.show = function()
{this.domContainer.style.display = 'block';this.domContainer.style.height = (this.openHeight-16)+'px';this.domListic_sistem.style.height = (this.openHeight-50)+'px';this.domTitlebar.style.bottom = (this.openHeight-16)+'px';this.domTitlebar.style.height = '26px';this.domIcons.style.bottom = (this.openHeight-11)+'px';this.height = this.openHeight;globalTimer.start(center_div.timerID);this.hidden = false;}
this.mouseOver = function()
{globalTimer.stop(this.timerID);this.titlebar.domTitlebar.innerHTML = 'IZRADA LISTIĆA';this.show();}
this.resize = function()
{var sistemHeight = 0;for(var i in this.parent.sistemObj.aGrupeKombinacija)sistemHeight+=this.parent.sistemObj.aGrupeKombinacija[i].height;var brojRedaka = Math.ceil(this.parent.aDogadjaji.length / 2);if(brojRedaka < 4) brojRedaka = 4;var innerHeight =  brojRedaka * 17;while(sistemHeight > innerHeight && brojRedaka++ < 12)innerHeight =  brojRedaka * 17;if(this.openHeight == innerHeight + 50) return;this.openHeight = innerHeight + 50;if(!this.hidden) this.show();}
this.mouseOut = function()
{if(this.autohide)globalTimer.start(this.timerID);}
this.timerTimeout = function(inObj)
{this.hide();}
this.refresh = function()
{var i;var aSlova = new Array('A=','B=','C=','D=','E=','F=','G=','H=','I=','J=', 'K=','L=','M=','N=','O=','P=','R=','S=','T=','U=');var iSlovaIndex = 0;for(i in this.parent.aDogadjaji)this.parent.aDogadjaji[i].hide();var iTo = this.parent.aDogadjaji.length;var iHalve = Math.ceil(iTo/2);this.parent.aSistemskiKoeff = new Array();this.parent.brojSistemskih = 0;if(iTo==0){this.resize();return;}i = 0;var iRedak = 0;this.parent.aDogadjajiOrder = new Array();do {if(!this.parent.aDogadjaji[i].sistemski){this.parent.aDogadjajiOrder[iRedak] = i;if(iRedak++<iHalve)this.parent.aDogadjaji[i].show(this.domLeftColumn, '');else this.parent.aDogadjaji[i].show(this.domRightColumn, '');}} while(++i<iTo);i = 0;do {if(this.parent.aDogadjaji[i].sistemski){this.parent.aDogadjajiOrder[iRedak] = i;if(iRedak++<iHalve)this.parent.aDogadjaji[i].show(this.domLeftColumn, aSlova[iSlovaIndex++]);else this.parent.aDogadjaji[i].show(this.domRightColumn, aSlova[iSlovaIndex++]);this.parent.aDogadjaji[i].domCheckbox.checked = true;this.parent.aSistemskiKoeff.push(this.parent.aDogadjaji[i].koeff);this.parent.brojSistemskih++;}} while(++i<iTo);this.resize();}
this.toggleAutohide = function(inAutohideON)
{this.autohide = inAutohideON;if(inAutohideON){this.titlebar.icons.tick_down.hide();this.titlebar.icons.tick_up.show();}else {this.titlebar.icons.tick_down.show();this.titlebar.icons.tick_up.hide();}}
this.terminate = function()
{globalTimer.remove(this.timerID);this.domTitlebar.onmouseover = null;this.domTitlebar.onmouseout = null;this.domContainer.onmouseover = null;this.domContainer.onmouseout = null;this.domIcons.onmouseover = null;this.domIcons.onmouseout = null;this.domTitlebar = null;this.domTitlebar = null;this.domContainer = null;this.domContainer = null;this.domIcons = null;this.domIcons = null;this.parent = null;}}
function sistem_class(inParent)
{this.parent = inParent;this.ukupniUlog = 0;this.moguciDobitak = 0;this.aGrupeKombinacija = new Array();this.odabranihGrupa = null;this.ukupno_kombinacija = 0;this.domObj = document.getElementById('listic_sistem').getElementsByTagName('tbody')[0];this.sistem_check_template = document.getElementById('sistem_check_template');this.sistem_input_template = document.getElementById('sistem_input_template');this.aBrojKomb = new Array();this.aBrojKomb[ 0] = new Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18);this.aBrojKomb[ 1] = new Array(0,1,3,6,10,15,21,28,36,45,55,66,78,91,105,120,136,153);this.aBrojKomb[ 2] = new Array(0,0,1,4,10,20,35,56,84,120,165,220,286,364,455,560,680,816);this.aBrojKomb[ 3] = new Array(0,0,0,1,5,15,35,70,126,210,330,495,715,1001,1365,1820,2380,3060);this.aBrojKomb[ 4] = new Array(0,0,0,0,1,6,21,56,126,252,462,792,1287,2002,3003,4368,6188,8568);this.aBrojKomb[ 5] = new Array(0,0,0,0,0,1,7,28,84,210,462,924,1716,3003,5005,8008,12376,18564);this.aBrojKomb[ 6] = new Array(0,0,0,0,0,0,1,8,36,120,330,792,1716,3432,6435,11440,19448,31824);this.aBrojKomb[ 7] = new Array(0,0,0,0,0,0,0,1,9,45,165,495,1287,3003,6435,12870,24310,43758);this.aBrojKomb[ 8] = new Array(0,0,0,0,0,0,0,0,1,10,55,220,715,2002,5005,11440,24310,48620);this.aBrojKomb[ 9] = new Array(0,0,0,0,0,0,0,0,0,1,11,66,286,1001,3003,8008,19448,43758);this.aBrojKomb[10] = new Array(0,0,0,0,0,0,0,0,0,0,1,12,78,364,1365,4368,12376,31824);this.aBrojKomb[11] = new Array(0,0,0,0,0,0,0,0,0,0,0,1,13,91,455,1820,6188,18564);this.aBrojKomb[12] = new Array(0,0,0,0,0,0,0,0,0,0,0,0,1,14,105,560,2380,8568);this.aBrojKomb[13] = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,1,15,120,680,3060);this.aBrojKomb[14] = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,16,136,816);this.aBrojKomb[15] = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,17,153);this.aBrojKomb[16] = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,18);this.aBrojKomb[17] = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
this.refresh = function()
{var iIndex = this.aGrupeKombinacija.length;var iBrSistemskih = this.parent.brojSistemskih;if(iIndex > iBrSistemskih){while(--iIndex >= iBrSistemskih){this.aGrupeKombinacija[iIndex].terminate();this.aGrupeKombinacija[iIndex] = null;this.aGrupeKombinacija.pop(iIndex);}}else if(iIndex < iBrSistemskih){while(iIndex++ < iBrSistemskih)this.aGrupeKombinacija.push(new grupa_kombinacija_class(this));}iIndex = this.aGrupeKombinacija.length;while(--iIndex>=0)this.aGrupeKombinacija[iIndex].update(iBrSistemskih, iIndex+1, this.aBrojKomb[iIndex][iBrSistemskih-1]);}
this.resync = function()
{this.parent.izracunObj.refresh();}
this.setUplata = function(inUkupnaUplata)
{if(this.odabranihGrupa==0) return;if(this.ukupno_kombinacija == null){iIndex = this.aGrupeKombinacija.length-1;this.ukupno_kombinacija = 0;do {if(this.aGrupeKombinacija[iIndex].selected)this.ukupno_kombinacija+=this.aGrupeKombinacija[iIndex].broj_kombinacija;} while(--iIndex>-1)}var iBrojOdabranih = this.odabranihGrupa;var uplataPoKomb = inUkupnaUplata / this.ukupno_kombinacija;var preostaliIznos = inUkupnaUplata;var tmpUplata = 0;iIndex = this.aGrupeKombinacija.length-1;do {if(this.aGrupeKombinacija[iIndex].selected){if(--iBrojOdabranih==0)tmpUplata = Math.round(preostaliIznos*10000)/10000;else tmpUplata = Math.round(uplataPoKomb * this.aGrupeKombinacija[iIndex].broj_kombinacija*10000)/10000;this.aGrupeKombinacija[iIndex].setUplata(tmpUplata);preostaliIznos -= tmpUplata;}} while (--iIndex>-1);}
this.getHTML = function()
{var sReturn = '<table id="grupe_komb"><caption>Kombinacijske grupe:</caption><tr><th class="td_center">Tip</th><th>Komb.</th><th>Uplata</th><th>Uplata/k.</th></tr>';for(var iIndex in this.aGrupeKombinacija)sReturn+=this.aGrupeKombinacija[iIndex].getHTML();sReturn+='</table>';return(sReturn);}
this.prepareSend = function()
{var aReturn = new Array();var iTo = this.aGrupeKombinacija.length;var iRedniBroj=0;aReturn.push(this.odabranihGrupa);for(var iIndex=0;iIndex<iTo;iIndex++)if(this.aGrupeKombinacija[iIndex].selected)aReturn.push(this.aGrupeKombinacija[iIndex].prepareSend(++iRedniBroj));aReturn.push('');return(aReturn.join('|'));}}var site_const = {mt:0.952381, max_dobitak:300000, max_sist_dobitak:500000, max_koeff:1000000, valuta:'Kn', min_uplata:5, min_uplata_sistem:0.01, default_uplata:10, grupa_komb_default_uplata:5, max_br_dogadjaja:30, max_br_sistemskih_dog:18, loto_sportID:20, superprognoza_sportID:18, superprognoza_naziv_dativ:'super prognozi', superprognoza_naziv_genitiv:'super prognoze', ispisRezultata:0, sSiteTitle:'Germania Sport', sSiteURL:'www.germaniasport.hr', ttxRefreshRate:10000, ttxDefaultPage:731, ttxDefaultSubPage:1, ttxStartPage:730, ttxEndPage:736, provListRefreshRate:30000, menuRefreshRate:180000, sGoogleAnalyticsCode:'UA-305909-6' };
Date.prototype.parseHRDate = function(inString)
{try {this.setFullYear(inString.substr(0,4)-0);this.setMonth(inString.substr(4,2)-1, inString.substr(6,2)-0);} catch(E) {};try {this.setHours(inString.substr(9,2));this.setMinutes(inString.substr(12,2));} catch(E) {};try {this.setSeconds(inString.substr(15,2));} catch(E) {};}
Date.prototype.parseTime = function(inTime)
{try {this.setHours(Math.floor(inTime/100));this.setMinutes(Math.floor(inTime%100));} catch(E) {};}
Date.prototype.getHRString = function(inShort)
{var sDate = (100 + this.getDate()).toString().substr(1,2);var sMonth = (100 + this.getMonth()+1).toString().substr(1,2);var sYear = (10000+ this.getFullYear()).toString().substr(1,4);if(inShort)return(sDate + '.' + sMonth + '.');else return(sDate + '.' + sMonth + '.' + sYear);}
Date.prototype.getWeekday = function(inShort)
{var aLongDays = ['nedjelja', 'ponedjeljak', 'utorak', 'srijeda', 'četvrtak', 'petak', 'subota'];var aShortDays  = ['ned', 'pon', 'uto', 'sri', 'čet', 'pet', 'sub'];if(inShort)return(aShortDays[this.getDay()]);else return(aLongDays[this.getDay()]);}
Date.prototype.getHRTime = function(inSeconds)
{var iHours = this.getHours();var iMinutes = this.getMinutes();if(iHours < 10)iHours = '0' + iHours;if(iMinutes < 10)iMinutes = '0' + iMinutes;if(!inSeconds)return(iHours + ':' + iMinutes);var iSeconds = this.getSeconds();if(iSeconds < 10)iSeconds = '0' + iSeconds;return(iHours+':'+iMinutes+':'+iSeconds);}
Date.prototype.calcOffset = function()
{}
Date.prototype.diff = function(inDate)
{var iThisValue, iInValue;iThisValue = this.getFullYear();iInValue = inDate.getFullYear();if(iThisValue > iInValue)return(1);if(iThisValue < iInValue)return(-1);iThisValue = this.getMonth();iInValue = inDate.getMonth();if(iThisValue > iInValue)return(1);if(iThisValue < iInValue)return(-1);iThisValue = this.getDay();iInValue = inDate.getDay();if(iThisValue > iInValue)return(1);if(iThisValue < iInValue)return(-1);iThisValue = this.getHours();iInValue = inDate.getHours();if(iThisValue > iInValue)return(1);if(iThisValue < iInValue)return(-1);iThisValue = this.getMinutes();iInValue = inDate.getMinutes();if(iThisValue > iInValue)return(1);if(iThisValue < iInValue)return(-1);iThisValue = this.getSeconds();iInValue = inDate.getSeconds();if(iThisValue > iInValue)return(1);if(iThisValue < iInValue)return(-1);return(0);}
function cloneChildren(inSourceObj)
{var docFragment = document.createDocumentFragment();var tmpOBJ = null;for(var i in inSourceObj.childNodes){tmpOBJ = inSourceObj.childNodes[i];if(typeof(tmpOBJ.tagName) != 'undefined')docFragment.appendChild(tmpOBJ.cloneNode(true));}return(docFragment);}
String.prototype.right = function(inN)
{return(this.substring(this.length-inN));}
String.prototype.ent2txt = function()
{return(this.replace(/(&#\d+;)/g,
function(instr, inCode)
{switch(inCode){case '&#269;': return('č');case '&#263;': return('ć');case '&#382;': return('ž');case '&#353;': return('š');case '&#273;': return('đ');case '&#268;': return('Č');case '&#262;': return('Ć');case '&#381;': return('Ž');case '&#352;': return('Š');case '&#272;': return('Đ');case '&amp;':  return('&');default: return('########');}}));}
String.prototype.escapeHTML = function()
{return(this.replace(/(<|>|&)/g,
function(instr, inCode)
{switch(inCode){case '&': return('&amp;');case '<': return('&lt;');case '>': return('&gt;');default: return('?');}}));}
String.prototype.trim = function()
{return(this.replace(/^\s+/g,'').replace(/\s+$/g,''));}
function formatKoeff(inNumeric, inDecimalPlaces)
{if(typeof(inDecimalPlaces) == 'undefined')inDecimalPlaces = 1;if(inNumeric < 10)return(inNumeric.toFixed(2).replace('.',','));if(inNumeric < 1000)return(inNumeric.toFixed(inDecimalPlaces).replace('.',','));var sGlue='', sReturn='', i=0;var sWhole = Math.floor(inNumeric);var iDecimal = Math.round(inNumeric*100,0) - sWhole*100;sWhole+='';var iLength = sWhole.length-3;for(i=iLength;i>0;i-=3){sReturn = sWhole.substr(i,3)+sGlue+sReturn;sGlue='.';}sReturn = sWhole.substr(0,i+3)+sGlue+sReturn;if(iDecimal == 0)return(sReturn);if(iDecimal < 10)return(sReturn+',0'+iDecimal);if((iDecimal % 10) == 0)iDecimal/=10;return(sReturn+','+iDecimal);}
function formatCurr(inNumeric, inDecimalPlaces)
{if(typeof(inDecimalPlaces) == 'undefined')inDecimalPlaces = 2;var sGlue='', sReturn='', i=0;var sWhole = Math.floor(inNumeric);sWhole+='';var iLength = sWhole.length-3;for(i=iLength;i>0;i-=3){sReturn = sWhole.substr(i,3)+sGlue+sReturn;sGlue='.';}sReturn = sWhole.substr(0,i+3)+sGlue+sReturn;if(inDecimalPlaces==0)return(sReturn);var iExp = Math.pow(10, inDecimalPlaces);var iDecimal = Math.round(inNumeric*iExp,0) - sWhole*iExp;iDecimal = '000000000000'+iDecimal;return(sReturn+','+iDecimal.right(inDecimalPlaces));}
function IsNumeric(strString)
{var strValidChars = "0123456789";var strChar;var blnResult = true;if (strString.length == 0) return false;for (i = 0; i < strString.length && blnResult == true; i++){strChar = strString.charAt(i);if (strValidChars.indexOf(strChar) == -1){blnResult = false;}}return blnResult;}
function textbox_class(inOwnerObj, inDomElement)
{this.container = null;this.numeric = true;this.text = '';this.numValue = 0;this.ownerObj = inOwnerObj;this.changed = false;if(!inDomElement){this.domObj = document.createElement('input');this.domObj.type = 'text';}else {this.domObj = inDomElement;}this.domObj.parentObj = this;
this.domObj.onfocus = function(inEvent) {this.parentObj.onfocus(inEvent?inEvent:window.event); }
this.domObj.onkeyup = function(inEvent) {return(this.parentObj.onkeyup(inEvent?inEvent:window.event)); }
this.domObj.onkeydown = function(inEvent) { return(this.parentObj.onkeydown(inEvent?inEvent:window.event)); }
this.onClickHandler = null;this.onChangeHandler = null;this.onBlurHandler = null;this.onFocusHandler = null;
this.onclick = function(inEvent)
{if(this.onClickHandler!=null)eval('this.ownerObj.'+this.onClickHandler+'(inEvent)');}
this.onkeyup = function(inEvent)
{if(!this.changed)return;var formatRegExp = /^\d*(,|\.)?\d{0,2}$/;if(!formatRegExp.test(this.domObj.value))this.domObj.value = this.text;else {this.text = this.domObj.value;if(this.numeric)if(this.text == '')this.numValue = 0;else this.numValue = parseFloat(this.text.replace(',','.'));if(this.onChangeHandler!=null)eval('this.ownerObj.'+this.onChangeHandler+'(inEvent)');}this.changed = false;return(true);}
this.onkeydown = function(inEvent)
{return(true);}
this.onkeydown = function(inEvent)
{if(this.numeric){switch(inEvent.keyCode?inEvent.keyCode:e.which){case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: case 96: case 97: case 98: case 99: case 100: case 101: case 102: case 103: case 104: case 105: case 8: case 46: this.changed = true;case 37: case 39: case 116: case 35: case 36: break;case 110: case 188: case 190: var formatRegExp = /^.*(,|\.).*$/;if(formatRegExp.test(this.domObj.value))return(false);this.changed = true;break;default: return (false);}}return(true);}
this.onblur = function(inEvent)
{if(this.onBlurHandler!=null)eval('this.ownerObj.'+this.onBlurHandler+'(inEvent)');}
this.onfocus = function(inEvent)
{if(this.domObj.createTextRange){var oRange = this.domObj.createTextRange();oRange.moveStart("character", 0);oRange.moveEnd("character", this.domObj.value.length);oRange.select();}else if (this.domObj.setSelectionRange){this.domObj.setSelectionRange(0, this.domObj.value.length);}if(this.onFocusHandler!=null)eval('this.ownerObj.'+this.onFocusHandler+'(inEvent)');}
this.show = function(inDomContainer)
{this.container = inDomContainer;this.container.appendChild(this.domObj);}
this.setText = function(inNewText)
{this.text = inNewText;this.domObj.value = inNewText;}
this.terminate = function()
{if(this.container != null){this.container.removeChild(this.domObj);this.container = null;}this.domObj.onclick = null;this.domObj.onblur = null;this.domObj.onfocus = null;this.domObj.onkeyup = null;this.domObj.onkeydown = null;this.domObj.parentObj = null;;this.domObj = null;this.ownerObj = null;}}
function eventCenter_class()
{this.moveHandlers = null;this.downHandlers = null;this.upHandlers   = null;this.blurHandlers = null;this.resizeHandlers = null;this.keyDownHandlers = null;
this.register = function(inEventType, inObject)
{switch(inEventType){case 'mousemove': if(this.moveHandlers == null) this.moveHandlers = new Array();this.moveHandlers.push(inObject);break;case 'mousedown': if(this.downHandlers == null) this.downHandlers = new Array();this.downHandlers.push(inObject);break;case 'mouseup': if(this.upHandlers == null) this.upHandlers = new Array();this.upHandlers.push(inObject);break;case 'blur': if(this.blurHandlers == null) this.blurHandlers = new Array();this.blurHandlers.push(inObject);break;case 'resize': if(this.resizeHandlers == null) this.resizeHandlers = new Array();this.resizeHandlers.push(inObject);break;case 'keydown': if(this.keyDownHandlers == null) this.keyDownHandlers = new Array();this.keyDownHandlers.push(inObject);break;}}
this.unregister = function(inEventType, inObject)
{switch(inEventType){case 'mousedown': for(var i in this.downHandlers){if(this.downHandlers[i] == inObject){this.downHandlers.splice(i,1);break;}}break;case 'mouseup': for(var i in this.upHandlers){if(this.upHandlers[i] == inObject){this.upHandlers.splice(i,1);break;}}break;case 'mousemove': for(var i in this.downHandlers){if(this.downHandlers[i] == inObject){this.downHandlers.splice(i,1);break;}}break;case 'blur': for(var i in this.blurHandlers){if(this.blurHandlers[i] == inObject){this.blurHandlers.splice(i,1);break;}}break;case 'resize': for(var i in this.resizeHandlers){if(this.resizeHandlers[i] == inObject){this.resizeHandlers.splice(i,1);break;}}break;case 'keydown': for(var i in this.keyDownHandlers){if(this.keyDownHandlers[i] == inObject){this.keyDownHandlers.splice(i,1);break;}}break;}}
this.handle_mouseMove = function(inEvent)
{for(var i in this.moveHandlers)this.moveHandlers[i].handle_mouseMove(inEvent);}
this.handle_mouseDown = function(inEvent)
{for(var i in this.downHandlers)this.downHandlers[i].handle_mouseDown(inEvent);}
this.handle_mouseUp = function(inEvent)
{for(var i in this.upHandlers)this.upHandlers[i].handle_mouseUp(inEvent);}
this.handle_blur = function(inEvent)
{for(var i in this.blurHandlers)this.blurHandlers[i].handle_Blur(inEvent);}
this.handle_onresize = function(inEvent)
{for(var i in this.resizeHandlers)this.resizeHandlers[i].handle_onresize(inEvent);}
this.handle_onkeydown = function(inEvent)
{if(window.event)var iKeyCode = window.event.keyCode;else if(inEvent.which)var iKeyCode = inEvent.which;for(var i in this.keyDownHandlers)this.keyDownHandlers[i].handle_onkeydown(inEvent,iKeyCode);}};var eventCenter = new eventCenter_class();
document.onmousemove = function(inEvent)
{eventCenter.handle_mouseMove(inEvent);}
document.onmousedown = function(inEvent)
{eventCenter.handle_mouseDown(inEvent);}
document.onmouseup = function(inEvent)
{eventCenter.handle_mouseUp(inEvent);}
document.onblur = function(inEvent)
{eventCenter.handle_blur(inEvent);}
window.onresize = function(inEvent)
{eventCenter.handle_onresize(inEvent);}
document.onkeydown = function(inEvent)
{eventCenter.handle_onkeydown(inEvent);}
function nextFocus(e, inID)
{if(KeyDownCode(e)==13) document.getElementById(inID).focus();return(true);}
function KeyDownCode(e)
{var iKeyCode;if(window.event) {return(e.keyCode);} else {return(e.which);}}
function profiler_class()
{this.data = new Array();this.nested = false;if(typeof(debugMode) == 'undefined')eventCenter.register('keydown', this);
this.start = function(inBlockID)
{if(!this.data[inBlockID])this.data[inBlockID] = new Array();this.data[inBlockID].push({start:new Date().getTime(), end:null, nested:this.nested});this.nested = true;}
this.stop = function(inBlockID)
{if(!this.data[inBlockID][this.data[inBlockID].length-1].nested)this.nested = false;this.data[inBlockID][this.data[inBlockID].length-1].end = new Date().getTime();}
this.report = function()
{var execCount = 0;var ownTime = 0;var avgTime = 0;var minTime = 0;var maxTime = 0;var totalTime = 0;var currTime = 0;var reportArray= new Array();for(var iID in this.data){currTime = this.data[iID][0].end - this.data[iID][0].start;minTime = currTime;maxTime = currTime;ownTime = 0;nestedTime = 0;execCount = 0;for(var iIndex in this.data[iID]){currTime = this.data[iID][iIndex].end - this.data[iID][iIndex].start;if(currTime > maxTime) maxTime = currTime;if(currTime < minTime) minTime = currTime;if(!this.data[iID][iIndex].nested)ownTime+=currTime;nestedTime+=currTime;execCount++;}avgTime = ownTime / execCount;reportArray[iID] = {execCount:execCount, ownTime:ownTime, nestedTime:nestedTime, avgTime:avgTime, minTime:minTime, maxTime:maxTime};totalTime+=ownTime;}var renderArr = new Array();for(var iID in reportArray){renderArr.push(Array(iID, reportArray[iID].execCount, (reportArray[iID].ownTime/totalTime*100), reportArray[iID].nestedTime, reportArray[iID].ownTime, reportArray[iID].avgTime, reportArray[iID].minTime, reportArray[iID].maxTime).join(';'));}var winObj = window.open();var docObj = winObj.document;docObj.open("text/html", "replace");docObj.write('BlockID;Percent;Exec count;Nested time;Own time;Avg;Min;Max<br>');docObj.write(renderArr.join('<br>'));docObj.close();delete this.data;this.data = new Array();}
this.dump = function()
{var renderArr = new Array();for(var iID in this.data)for(var iIndex in this.data[iID])renderArr.push(Array(iID, iIndex, this.data[iID][iIndex].start, this.data[iID][iIndex].end, this.data[iID][iIndex].nested, this.data[iID][iIndex].end - this.data[iID][iIndex].start).join(';'));var winObj = window.open();var docObj = winObj.document;docObj.open("text/html", "replace");docObj.write('BlockID;Index;Start;End;Nested;Diff<br>');docObj.write(renderArr.join('<br>'));docObj.close();}
this.handle_onkeydown = function(inEvent, iKeyCode)
{if(iKeyCode == 82)this.report();if(iKeyCode == 68)this.dump();}}
function debug(inString, inClear)
{var objDebugDIV;objDebugDIV = document.getElementById('debug_div');if(objDebugDIV == null){objDebugDIV = document.createElement("DIV");document.body.appendChild(objDebugDIV);objDebugDIV.id = 'debug_div';objDebugDIV.style.position = 'absolute';objDebugDIV.style.zIndex	 = '500';objDebugDIV.style.padding = '5px';objDebugDIV.style.top = '20px';objDebugDIV.style.right = '20px';objDebugDIV.style.border = '2px solid #FF0000';objDebugDIV.style.backgroundColor = '#FFFFFF';objDebugDIV.style.color = '#000000';objDebugDIV.style.display = 'none';objDebugDIV.style.overflow = 'auto';objDebugDIV.style.fontSize = '10px';objDebugDIV.innerHTML = '<p style="margin:0px;text-align:right;font-weight:bold;"><a href="javascript:debug(\'\');">x close</a></p>';}if(inString == ''){objDebugDIV.style.display = 'none';objDebugDIV.innerHTML = '<p style="margin:0px;text-align:right;color:red;font-weight:bold;"><a href="javascript:debug(\'\');">x close</a></p>';return;}else objDebugDIV.style.display = 'block';inClear = inClear || false;if(inClear)objDebugDIV.innerHTML = inString;else objDebugDIV.insertAdjacentHTML('beforeEnd', '<br>' + inString);}var lastRandomID = 0;
function getRandomID()
{return('randomid_'+(lastRandomID++));}
function m_ShowPopup(in_file, in_width, in_height, in_settings)
{if(!in_width)in_width = 630;if(!in_height)in_height = 360;var LeftPosition = (screen.width)?(screen.width-in_width)/2:100;var TopPosition = (screen.height)?(screen.height-in_height)/2:100;if(!in_settings)in_settings = 'scrollbars=1,toolbar=0,menubar=0,status=0,location=0,resizable=0,height='+in_height+',width='+in_width+',top='+TopPosition+',left='+LeftPosition;else in_settings+= ',height='+in_height+',width='+in_width+',top='+TopPosition+',left='+LeftPosition;var tmpWindow = window.open(in_file, '', in_settings);return(tmpWindow);}
function openNewWindow(inURL, inWindowTitle)
{return(window.open(inURL,inWindowTitle,'fullscreen=no,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes'));}
function timer_class(inInstanceName)
{this.timerData = new Array();this.timerIDCounter = -1;this.instanceName = inInstanceName;
this.add = function(inObject,
inInterval, inAutoRewind){if(!inAutoRewind) inAutoRewind = false;this.timerData['id'+(++this.timerIDCounter)] = {listener:inObject, interval:inInterval, intervalID:null, autoRewind:inAutoRewind};return(this.timerIDCounter);}
this.remove = function(inTimerID)
{this.stop(inTimerID);this.timerData.splice('id'+inTimerID,1);}
this.start = function(inTimerID)
{if(this.timerData['id'+inTimerID].intervalID==null)this.timerData['id'+inTimerID].intervalID = setTimeout(this.instanceName+'.trigger('+inTimerID+')',this.timerData['id'+inTimerID].interval);}
this.stop = function(inTimerID)
{if(typeof(inTimerID)=='undefined')return;if(this.timerData['id'+inTimerID].intervalID!=null)clearTimeout(this.timerData['id'+inTimerID].intervalID);this.timerData['id'+inTimerID].intervalID = null;}
this.set_Listener = function(inTimerID, inObject)
{this.timerData['id'+inTimerID].listener = inObject;}
this.set_Interval = function(inTimerID, inInterval)
{this.timerData['id'+inTimerID].interval = inInterval;}
this.trigger = function(inTimerID)
{if(typeof(this.timerData['id'+inTimerID])=='undefined')return;if(this.timerData['id'+inTimerID].autoRewind)this.timerData['id'+inTimerID].intervalID = setTimeout(this.instanceName+'.trigger('+inTimerID+')',this.timerData['id'+inTimerID].interval);else this.timerData['id'+inTimerID].intervalID = null;this.timerData['id'+inTimerID].listener.timerTimeout();}}var globalTimer = new timer_class('globalTimer');
function findAbsParent(inNode)
{if(inNode.nodeName == 'HTML'){offsetObj = new Object();offsetObj.offsetTop  = 0;offsetObj.offsetLeft = 0;}else {offsetObj = findAbsParent(inNode.parentNode);if(inNode.className != 'js_skip' && inNode.className != 'submnu'){offsetObj.offsetTop   = offsetObj.offsetTop  + inNode.offsetTop;offsetObj.offsetLeft  = offsetObj.offsetLeft + inNode.offsetLeft;}}return(offsetObj);}if(typeof HTMLElement!="undefined" && ! HTMLElement.prototype.insertAdjacentElement){
HTMLElement.prototype.insertAdjacentElement = function (where,parsedNode)
{switch (where){case 'beforeBegin': this.parentNode.insertBefore(parsedNode,this);break;case 'afterBegin': this.insertBefore(parsedNode,this.firstChild);break;case 'beforeEnd': this.appendChild(parsedNode);break;case 'afterEnd': if (this.nextSibling)this.parentNode.insertBefore(parsedNode,this.nextSibling);else this.parentNode.appendChild(parsedNode);break;}}
HTMLElement.prototype.insertAdjacentHTML = function(where,htmlStr)
{var r = this.ownerDocument.createRange();r.setStartBefore(this);var parsedHTML = r.createContextualFragment(htmlStr);this.insertAdjacentElement(where,parsedHTML);}
HTMLElement.prototype.insertAdjacentText = function(where,txtStr)
{var parsedText = document.createTextNode(txtStr);this.insertAdjacentElement(where,parsedText);}}
function getSilverlightVersion() {
var version = '';var container = null;try {var control = null;if (window.ActiveXObject) {control = new ActiveXObject('AgControl.AgControl');}else {if (navigator.plugins['Silverlight Plug-In']) {container = document.createElement('div');document.body.appendChild(container);container.innerHTML= '<embed type="application/x-silverlight" src="data:," />';control = container.childNodes[0];}}if (control) {if (control.isVersionSupported('2.0')) { version = 'Silverlight/2.0'; }else if (control.isVersionSupported('1.0')) { version = 'Silverlight/1.0'; }else if (control.isVersionSupported('3.0')) { version = 'Silverlight/3.0'; }else { version = 'Silverlight/unknown version' }}else {version = 'NO Silverlight';}}catch (e) { version = "Silverlight Error"; }if (container) {document.body.removeChild(container);}return version;}var enumMeni = {title:0, prvi_id:1, drugi_id:2, submenu:3 };var enumSport = {tip_paketa:0, naziv_sporta:1, id_sporta:2, datum:3 };var enumGrupaDogadjaja = {tip_paketa:0, naziv_grupe:1, id_grupe:2, id_seta:3, napomena:4, polje_dogadjaja:5, polje_seta_tipova:6 };var enumPonDogadjaj = {id:0, broj:1, prvi_tim:2, drugi_tim:3, vrijeme:4, min_br:5, max_br:6, min_uplata:7, max_uplata:8, kod:9 };var enumRezDogadjaj = {id:0, broj:1, prvi_tim:2, drugi_tim:3, vrijeme:4 };var enumSetTipova = {id:0, naziv:1, napomena:2, polje_varijanti:3, polje_tipova:4, polje_dogadjaj_koef:5 };var enumPoljeVarijanti = {id_varijante:0, prikazi_prvi_tim:1, prikazi_drugi_tim:2, prefix_prvog_tima:3, sufix_prvog_tima:4, delimiter:5, prefix_drugog_tima:6, sufix_drugog_tima:7 };var enumTip = {id_tip:0, naziv:1 };var enumPonDogadjajKoef = {id_dogadjaja:0, id_varijante:1, min_br:2, max_br:3, min_uplata:4, max_uplata:5, kod_specijalke:6, polje_koef:7 };var enumRezDogadjajKoef = {id_dogadjaja:0, id_varijante:1, rezultat:2, polje_koef:3 };var enumPonKoef = {id_tip:0, koef:1 };var enumRezKoef = {id_tip:0, koef:1, koeficijent_1:2, dobitni:3 };var enumTickerUzivo = {broj:0, ime:1, vrijeme:2, rezultat:3 };var enumTickerUskoro = {broj:0, ime:1, vrijeme:2 };var enumMenuItem = {title:0, page_title:1, page_type:2, rpc_data:3, submenu:4 };var enumTipPaketa = {sport:0, grupa_dogadjaja:1 };var enumSkripta = {ponuda:0, rezultati:1, loto:2 };var enumStatusBar = {idle:0, loading:1, processing:2 };var enumPageType = {ponuda:0, rezultati:1, poslovnice:2, upute:3, tjednici:4, listici:5, kontakt:6, teletext:7, naslovnica:8, pravila:9, loto_izvlacenje:10, loto_ponuda:11, loto_rezultati:12, trazilica:13, arhiva_open:14, arhiva_close:15, sms:16, statistike:17, sistemi:18, listic_tjedna:19, tjednik:20, vijest:21, proizvoljni_url:22 };var enumLoadStatus = {ready:0, loading:1, loaded:2 };var enumWinType = {overlay:0, fullscreen:1, detached:2, embedded:3 };var enumProvList = {br_list:0, br_poslovnice:1, ime_poslovnice:2, adresa_poslovnice:3, grad_poslovnice:4, datum_uplate:5, varijanta:6, tip_igre_ID:7, tip_sistema:8, koef:9, uplata:10, mt:11, ulog:12, moguci_dobitak:13, stvarni_dobitak:14, ishod_listica:15, popis_dogadjaja:16 };var enumProvListDogadjaj = {br_dogadjaja:0, oznaka_sistema:1, naziv:2, datum_i_vrijeme:3, tip:4, koef:5, ishod:6, k1:7, rezultat:8 };var enumProvList_refresh = {stvarni_dobitak:0, ishod_listica:1, popis_dogadjaja:2 };var enumProvListDogadjaj_refresh = {datum_i_vrijeme:0, ishod:1, k1:2, rezultat:3 };
function msgbox(inMessage)
{alert(inMessage);}
function output_buffer_class(inDOMContainer, inAutoFlush)
{this.buffer = new Array();this.bufferLength = 0;this.bufferLimit = 10240;this.autoFlush = inAutoFlush || false;this.DOMContainer = inDOMContainer;
this.append = function(inString)
{this.buffer.push(inString);if(this.autoFlush){this.bufferLength += inString.length;if(this.bufferLength >= this.bufferLimit)this.flush();}}
this.flush = function()
{this.DOMContainer.insertAdjacentHTML('beforeEnd', this.buffer.join(''));delete this.buffer;this.buffer = new Array();}
this.terminate = function()
{delete this.buffer;delete this.DOMContainer;}
this.clear = function()
{this.DOMContainer.innerHTML = '';delete this.buffer;this.buffer = new Array();}}
function print_center()
{var winObj = window.open();var docObj = winObj.document;var sPageTitle='';var sRegExpTest = /^[A-Za-z0-9ČĆŽŠĐčćžšđ ]+,.*$/;if(sRegExpTest.test(controler.page_title)){var sRegExp = /^([A-Za-z0-9ČĆŽŠĐčćžšđ ]+), ([A-Za-z0-9ČĆŽŠĐčćžšđ. ]+)(.*)$/;sPageTitle = controler.page_title.replace(sRegExp,'<div id="page_title">$1</div><div id="page_subtitle">$2</div>');}else {sPageTitle = '<div id="page_title">'+controler.page_title+'</div><div id="page_subtitle">&nbsp;</div>';}docObj.open("text/html", "replace");docObj.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1250" /><link rel="stylesheet" href="/css_print/main.css" type="text/css" />');docObj.write('<title>'+site_const.sSiteTitle+' - '+controler.page_title+'</title></head>');docObj.write('<div class="logo_left"><img src="/img/print/logo.gif"/></div><div class="logo_right"><img src="/img/print/logo.gif" /></div>');docObj.write(sPageTitle);docObj.write(center_div.domObj.innerHTML);docObj.write('</body></html>');docObj.close();}var ponuda_rezultati = null;var profiler = new profiler_class();var testCount = 0;
function controler_class()
{this.status = 0;this.fwd_history  = new Array();this.back_history = new Array();this.current_page = null;this.fwdButton  = null;this.backButton = null;this.active_page = 8;this.active_obj = null;this.page_title = '';
this.loadPage = function(inPageType, inPageTitle, inParams, inMediaTag)
{if(this.current_page == null){this.current_page = {page_type:8, page_title:'', params:'', media_tag:'', active_page:this.active_page};}this.back_history.push(this.current_page);this.current_page = {page_type:inPageType, page_title:inPageTitle, params:inParams, media_tag:inMediaTag, active_page:this.active_page};this.fwd_history = null;this.fwd_history = new Array();if(this.fwdButton == null)this.initHistory();this.fwdButton.style.display = 'none';this.backButton.style.display = 'block';this.startLoading(inPageType, inPageTitle, inParams, inMediaTag);}
this.onForward_click = function()
{this.back_history.push(this.current_page);this.current_page = this.fwd_history.pop();if(this.fwd_history.length==0)this.fwdButton.style.display = 'none';this.backButton.style.display = 'block';this.active_page = this.current_page.active_page;this.startLoading(this.current_page.page_type, this.current_page.page_title, this.current_page.params, '?utm_source=naslovnica&utm_medium=button&utm_content=forward', true);}
this.onBack_click = function()
{this.fwd_history.push(this.current_page);this.current_page = this.back_history.pop();if(this.back_history.length==0)this.backButton.style.display = 'none';this.fwdButton.style.display = 'block';this.active_page = this.current_page.active_page;this.startLoading(this.current_page.page_type, this.current_page.page_title, this.current_page.params, '?utm_source=naslovnica&utm_medium=button&utm_content=back', true);}
this.startLoading = function(inPageType, inPageTitle, inParams, inMediaTag, inDisableTracker)
{var sGlue = '';var trackerURL = "";var documentTitle = "";if(typeof(inDisableTracker) == 'undefined' || inDisableTracker==null)inDisableTracker = false;if(typeof(inMediaTag) == 'undefined' || inMediaTag==null)inMediaTag = '';if(typeof(inPageTitle) != 'undefined' && inPageTitle!=null)inPageTitle = inPageTitle.substr(0, 90);if(typeof(inParams) == 'undefined' || inParams == null)inParams = '';else sGlue = '&';if(this.status == 2) return;if(this.status == 1) this.abort();this.status = 2;appStatus.setStatus(this.status);if(this.active_obj != null){this.active_obj.terminate;this.active_obj = null;}titlebar.hide_icons();center_div.domObj.className = '';if(inPageType == 15)inPageType = this.active_page;switch(inPageType){case 8: this.page_title = 'NASLOVNICA';trackerURL = '/naslovnica/';documentTitle = 'Naslovnica';this.active_obj = htmlLoader;htmlLoader.open('/html/naslovnica.asp');break;case 2: this.page_title = 'POSLOVNICE';trackerURL = '/poslovnice/';documentTitle = 'Poslovnice';this.active_obj = htmlLoader;htmlLoader.open('/html_local/poslovnice.asp');center_div.domObj.className = 'ponuda_rezultati';break;case 21: this.page_title = inPageTitle;trackerURL = '/vijest_detalji/';documentTitle = 'Vijesti';this.active_obj = htmlLoader;htmlLoader.open('/html/vijest.asp');break;case 20: this.page_title = inPageTitle;trackerURL = '/tjednik_detalji/';documentTitle = 'Tjednik';this.active_obj = htmlLoader;htmlLoader.open('/html/tjednik.asp');break;case 4: this.page_title = 'TJEDNICI';trackerURL = '/tjednici_popis/';documentTitle = 'Tjednici';this.active_obj = htmlLoader;htmlLoader.open('/html/tjednici.asp');titlebar.icons.arhiva_open.show();break;case 19: this.page_title = inPageTitle;trackerURL = '/listic_tjedna/';documentTitle = 'Listić tjedna';this.active_obj = htmlLoader;htmlLoader.open('/html/listic_tjedna.asp');break;case 5: this.page_title = 'LISTIĆ TJEDNA';trackerURL = '/listici_tjedna_popis/';documentTitle = 'Listić tjedna';this.active_obj = htmlLoader;htmlLoader.open('/html/listici.asp');titlebar.icons.arhiva_open.show();break;case 9: this.page_title = 'PRAVILA';trackerURL = '/pravila/';documentTitle = 'Pravila';htmlLoader.open('/html_local/pravila.asp');this.active_obj = htmlLoader;break;case 3: this.page_title = 'UPUTE';trackerURL = '/upute/';documentTitle = 'Upute';htmlLoader.open('/html/upute.asp');this.active_obj = htmlLoader;break;case 6: this.page_title = 'KONTAKT';trackerURL = '/kontakt/';documentTitle = 'Kontakt';htmlLoader.open('/html_local/kontakt.asp');this.active_obj = htmlLoader;break;case 13: this.page_title = 'REZULTATI - TRAŽILICA';trackerURL = '/rezultati_trazilica/';documentTitle = 'Rezultati - tražilica';htmlLoader.open('/html/trazilica.asp');this.active_obj = htmlLoader;titlebar.icons.page_print.show();break;case 7: this.page_title = 'TELETEXT';trackerURL = '/teletext/';documentTitle = 'Teletext';htmlLoader.open('/html_local/teletext.asp');this.active_obj = htmlLoader;break;case 0: this.page_title = inPageTitle;trackerURL = '/ponuda/';documentTitle = inPageTitle;if(ponuda_rezultati != null)ponuda_rezultati = null;ponuda_rezultati = new ponuda_rezultati_class(0);ponuda_rezultati.onload = controler.onLoadHandler;ponuda_rezultati.dataSource = '/rpc/ponuda.asp';this.active_obj = ponuda_rezultati;titlebar.icons.page_print.show();titlebar.icons.hide_old.show();break;case 1: this.page_title = inPageTitle;trackerURL = '/rezultati/';documentTitle = inPageTitle;if(ponuda_rezultati != null)ponuda_rezultati = null;ponuda_rezultati = new ponuda_rezultati_class(1);ponuda_rezultati.onload = controler.onLoadHandler;ponuda_rezultati.dataSource = '/rpc/rezultati.asp';this.active_obj = ponuda_rezultati;titlebar.icons.page_print.show();break;case 10: this.page_title = inPageTitle;trackerURL = '/loto_izvlacenja/';documentTitle = inPageTitle;htmlLoader.open('/html_local/loto_izvlacenja.asp');this.active_obj = htmlLoader;break;case 11: this.page_title = inPageTitle;trackerURL = '/loto_ponuda/';documentTitle = inPageTitle;if(ponuda_rezultati != null)ponuda_rezultati = null;ponuda_rezultati = new ponuda_rezultati_class(0);ponuda_rezultati.onload = controler.onLoadHandler;ponuda_rezultati.dataSource = '/rpc/loto_ponuda.asp';this.active_obj = ponuda_rezultati;titlebar.icons.page_print.show();titlebar.icons.hide_old.show();break;case 12: this.page_title = 'LOTO - REZULTATI';trackerURL = '/loto_rezultati/';documentTitle = 'LOTO - REZULTATI';if(ponuda_rezultati != null)ponuda_rezultati = null;ponuda_rezultati = new ponuda_rezultati_class(1);ponuda_rezultati.onload = controler.onLoadHandler;ponuda_rezultati.dataSource = '/rpc/loto_rezultati.asp';this.active_obj = ponuda_rezultati;titlebar.icons.page_print.show();titlebar.icons.arhiva_open.show();break;case 14: switch(this.active_page){case 4: this.page_title = 'TJEDNICI - ARHIVA';trackerURL = '/tjednici_arhiva/';documentTitle = 'Tjednici - Arhiva';htmlLoader.open('/html/tjednici.asp');this.active_obj = htmlLoader;inParams+=sGlue+'arhiva=true';break;case 5: this.page_title = 'LISTIĆI TJEDNA - ARHIVA';trackerURL = '/listici_tjedna_arhiva/';documentTitle = 'Listići Tjedna - Arhiva';htmlLoader.open('/html/listici.asp');this.active_obj = htmlLoader;inParams+=sGlue+'arhiva=true';break;case 12: this.page_title = 'LOTO REZULTATI - ARHIVA';trackerURL = '/loto_rezultati_arhiva/';documentTitle = 'Loto Rezultati - Arhiva';if(ponuda_rezultati != null)ponuda_rezultati = null;ponuda_rezultati = new ponuda_rezultati_class(1);ponuda_rezultati.onload = controler.onLoadHandler;ponuda_rezultati.dataSource = '/rpc/loto_arhiva.asp';this.active_obj = ponuda_rezultati;titlebar.icons.page_print.show();break;}inPageType = this.active_page;titlebar.icons.arhiva_close.show();break;case 16: this.page_title = 'SMS';trackerURL = '/sms/';documentTitle = 'SMS';this.active_obj = htmlLoader;htmlLoader.open('/html_local/sms.asp');break;case 17: this.page_title = 'STATISTIKE';trackerURL = '/statistike/';documentTitle = 'Statistike';this.active_obj = htmlLoader;htmlLoader.open('/html/statistike.asp');break;case 18: this.page_title = 'SISTEMI';trackerURL = '/sistemi/';documentTitle = 'Sistemi';this.active_obj = htmlLoader;htmlLoader.open('/html_local/sistemi.asp');center_div.domObj.className = 'ponuda_rezultati';break;case 22: this.page_title = inPageTitle;if(inParams.substr(0, 11)=='/html/upute')trackerURL = inParams.substr(5);else trackerURL = inParams;documentTitle = inPageTitle;this.active_obj = htmlLoader;htmlLoader.open(inParams);inParams=''; sGlue='';break;}this.active_page = inPageType;document.title = site_const.sSiteTitle + ' - ' + documentTitle;titlebar.setTitle(this.page_title);if(debugMode)inParams+=sGlue+'debugMode=true';try {if(!inDisableTracker)pageTracker._trackPageview(trackerURL+inMediaTag);}catch(err) {if(debugMode)debug('pageTracker._trackPageview error:'+err.number+' '+err.description);}if(inParams != '')this.active_obj.loadData(inParams);else this.active_obj.loadData();this.status = 1;appStatus.setStatus(this.status);return(false);}
this.abort = function()
{this.active_obj.abort();this.active_obj.terminate();this.status = 0;appStatus.setStatus(this.status);}
this.onLoadHandler = function()
{controler.status = 0;appStatus.setStatus(controler.status);}
this.initHistory = function()
{this.fwdButton = document.getElementById('fwdButton');this.backButton = document.getElementById('backButton');
this.fwdButton.onclick  = function() { controler.onForward_click(); };
this.backButton.onclick = function() { controler.onBack_click(); };
}}
function flashAction(inAction)
{var sMediaTag = '?utm_source=naslovnica&utm_medium=banner&utm_content=flash';switch(inAction){case 'ttx': controler.loadPage(7,null,null, sMediaTag);break;case 'sms': controler.loadPage(16,null,null, sMediaTag);break;case 'isplata': leftMenu.items[0].objA.onclick();leftMenu.items[0].submenu.items[0].makeRPC();break;case 'izrada_listica': controler.loadPage(3,null,null, sMediaTag);break;case 'loto': controler.loadPage(10, 'LOTO - IZVLAČENJA',null, sMediaTag);break;case 'tjednici': controler.loadPage(4,null,null, sMediaTag);break;case 'sistemi': controler.loadPage(18,null,null, sMediaTag);break;case 'poslovnice': controler.loadPage(2,null,null, sMediaTag);break;}}
function resizeContainer()
{var innerHeight = 0;if(window.innerHeight) {innerHeight = window.innerHeight;} else if(document.documentElement && typeof(document.documentElement.clientWidth)!='undefined' && document.documentElement.clientWidth!=0) {innerHeight = document.getElementsByTagName('body')[0].offsetHeight ;innerHeight = document.documentElement.clientHeight;} else {innerHeight = document.body.clientHeight;}var iNewHeight = innerHeight - 109;if(iNewHeight < 300)iNewHeight = 300;center_div.style.height = iNewHeight;center_overlay.style.height = iNewHeight+35;}
function appstatus_class(in_domID)
{this.domObj   = document.getElementById('appstatus');this.domClock = document.getElementById('clock');this.timerID = globalTimer.add(this,1000,true);this.dateObj = new Date();
this.setStatus = function(inStatus)
{globalTimer.stop(this.timerID);switch(inStatus){case 1: sText = 'Učitavam...';this.domObj.style.display = 'block';this.domClock.style.display = 'none';break;case 2: sText = 'Radim...';this.domObj.style.display = 'block';this.domClock.style.display = 'none';break;case 0: default: sText = '';globalTimer.start(this.timerID);this.domObj.style.display = 'none';this.domClock.style.display = 'block';this.timerTimeout();}this.domObj.innerHTML = sText;}
this.timerTimeout = function(inObj)
{var currentTime = new Date(clientTimeDiff + Date.parse(Date()));this.domClock.innerHTML = currentTime.getHRTime(true);}}
function center_div_class()
{this.domObj = document.getElementById('center');this.timerID = globalTimer.add(this,50,true);this.totalHeight = null;
this.resize = function(inListicHeight)
{var innerHeight = 0;if(!inListicHeight)inListicHeight = listic.windowObj.height;inListicHeight-=10;if(window.innerHeight){innerHeight = window.innerHeight;}else if(document.documentElement && typeof(document.documentElement.clientWidth)!='undefined' && document.documentElement.clientWidth!=0){innerHeight = document.getElementsByTagName('body')[0].offsetHeight;innerHeight = document.documentElement.clientHeight;}else {innerHeight = document.body.clientHeight;}this.totalHeight = innerHeight - 109;if(this.totalHeight < 300)this.totalHeight = 300;center_overlay.style.height = (this.totalHeight+35)+'px';this.domObj.style.height = (this.totalHeight - inListicHeight)+'px';this.domObj.style.margin = '25px 0 '+inListicHeight+'px 89px';}
this.handle_onresize = function(inEvent)
{this.resize();}
this.clear = function()
{this.domObj.innerHTML = '';}
this.timerTimeout = function(inObj)
{this.resize();};
this.showOverlay = function()
{center_overlay.style.height = (this.totalHeight+35)+'px';center_overlay.style.display='block';};
this.hideOverlay = function()
{center_overlay.style.display='none';};eventCenter.register('resize', this);}
function titlebar_class()
{this.domObj = document.getElementById('titlebar');this.icons = { arhiva_open:null, arhiva_close:null, page_print:null, hide_old: null};this.icons.hide_old     = new titlebar_icon_class("/img/icons/clock.gif", "Sakrij događaje koji su prošli");this.icons.unhide_old     = new titlebar_icon_class("/img/icons/clock_strike.gif", "Prikaži sve događaje");this.icons.arhiva_open  = new titlebar_icon_class("/img/icons/archive_open.gif", "Pristup arhivskim podacima");this.icons.arhiva_close = new titlebar_icon_class("/img/icons/archive_close.gif","Povratak na aktualne podatke");this.icons.page_print   = new titlebar_icon_class("/img/icons/printer.gif", "Print");
this.icons.hide_old.domObj.onclick = function()
{appStatus.setStatus(2);setTimeout('controler.active_obj.hide_old();',100);}
this.icons.unhide_old.domObj.onclick = function()
{appStatus.setStatus(2);setTimeout('controler.active_obj.unhide();',100);}
this.icons.arhiva_open.domObj.onclick = function() {controler.loadPage(14);}
this.icons.arhiva_close.domObj.onclick = function() {controler.loadPage(15);}
this.icons.page_print.domObj.onclick = function() {print_center();}
this.setTitle = function(inTitle)
{this.domObj.innerHTML = inTitle;}
this.hide_icons = function()
{this.icons.arhiva_open.hide();this.icons.arhiva_close.hide();this.icons.page_print.hide();this.icons.hide_old.hide();this.icons.unhide_old.hide();}}
function titlebar_icon_class(inImageSrc, inTitle)
{var domContainer = document.getElementById('titlebar_icons');this.domObj = document.createElement('img');this.domObj.src = inImageSrc;this.domObj.title = inTitle;this.domObj.alt = inTitle;this.domObj.style.display = 'none';domContainer.appendChild(this.domObj);
this.show = function()
{this.domObj.style.display = 'inline';}
this.hide = function()
{this.domObj.style.display = 'none';}}
function window_class(inDOMParent,
inTitle, inMouseOutClose, inDisableClose, inEnableMaximize, inEnableDetached){if(!inTitle) inTitle='';if(!inMouseOutClose) inMouseOutClose = false;if(!inDisableClose) inDisableClose = false;if(!inEnableMaximize) inEnableMaximize = false;this.timerID = null;this.domParent = inDOMParent;this.domObj = document.getElementById('win_template').cloneNode(true);this.domObj.id = null;this.parentObj = null;this.domContainer = this.domObj.getElementsByTagName('div')[1];this.domTitle = this.domObj.getElementsByTagName('td')[0];this.domTitle.innerHTML = inTitle;this.domDetach = this.domObj.getElementsByTagName('img')[0];this.domMaximize = this.domObj.getElementsByTagName('img')[1];this.domClose = this.domObj.getElementsByTagName('img')[2];if(inDisableClose)this.domClose.style.display = 'none';if(!inEnableMaximize)this.domMaximize.style.display = 'none';if(!inEnableDetached)this.domDetach.style.display = 'none';this.mouseLocation = {domTitle:false,domObj:false,domContainer:false,domClose:false};this.domTitle.parentObj = this;this.domObj.parentObj = this;this.domContainer.parentObj = this;this.domClose.parentObj = this;this.domMaximize.parentObj = this;this.domDetach.parentObj = this;if(inMouseOutClose){this.timerID = globalTimer.add(this,100,false);
this.domTitle.onmouseover = function() { this.parentObj.mouseOver(); }
this.domTitle.onmouseout = function() { this.parentObj.mouseOut(); }
this.domObj.onmouseover = function() { this.parentObj.mouseOver(); }
this.domObj.onmouseout = function() { this.parentObj.mouseOut(); }
this.domContainer.onmouseover = function() { this.parentObj.mouseOver(); }
this.domContainer.onmouseout = function() { this.parentObj.mouseOut(); }
this.domClose.onmouseover = function() { this.parentObj.mouseOver(); }
this.domClose.onmouseout = function() { this.parentObj.mouseOut(); }
this.domMaximize.onmouseover = function() { this.parentObj.mouseOver(); }
this.domMaximize.onmouseout = function() { this.parentObj.mouseOut(); }
this.domDetach.onmouseover = function() { this.parentObj.mouseOver(); }
this.domDetach.onmouseout = function() { this.parentObj.mouseOut(); }
}
this.domClose.onclick = function() { this.parentObj.close(); }
this.domMaximize.onclick = function() { this.parentObj.maximize(); }
this.domDetach.onclick = function() { this.parentObj.detach(); }
this.mouseOut = function(inObj)
{globalTimer.start(this.timerID);}
this.mouseOver = function(inObj)
{globalTimer.stop(this.timerID);}
this.timerTimeout = function(inObj)
{this.close();}
this.setTitle = function(inTitle)
{this.domTitle.innerHTML = inTitle;}
this.hideScrollbar = function()
{this.domContainer.style.overflow = 'hidden';}
this.showScrollbar = function()
{this.domContainer.setAttribute('style','overflow-y:scroll');}
this.addContent = function(inContent)
{if(typeof(inContent)=='string')this.domContainer.insertAdjacentHTML('beforeEnd', inContent);else this.domContainer.insertAdjacentElement('beforeEnd', inContent);}
this.open = function(inTop, inLeft, inWidth, inHeight)
{this.domParent.insertAdjacentElement('afterBegin', this.domObj);this.domObj.style.top = inTop+'px';this.domObj.style.left = inLeft+'px';this.domContainer.style.width = inWidth+'px';this.domContainer.style.height = inHeight+'px';this.domObj.style.display='block';}
this.close = function()
{if(this.parentObj != null)if(!this.parentObj.queryUnload())return;this.domObj.style.display='none';this.domParent.removeChild(this.domObj);this.terminate();}
this.maximize = function()
{if(this.parentObj != null)if(!this.parentObj.maximize())return;}
this.detach = function()
{if(this.parentObj != null)if(!this.parentObj.detach())return;}
this.enable_close = function()
{this.domClose.style.display = 'inline';}
this.enable_maximize = function()
{this.domMaximize.style.display = 'inline';}
this.enable_detach = function()
{this.domDetach.style.display = 'inline';}
this.terminate = function()
{if(this.timerID!=null){globalTimer.remove(this.timerID);this.domTitle.onmouseover = null;this.domTitle.onmouseout = null;this.domObj.onmouseover = null;this.domObj.onmouseout = null;this.domContainer.onmouseover = null;this.domContainer.onmouseout = null;this.domClose.onmouseover = null;this.domClose.onmouseout = null;this.domMaximize.onmouseover = null;this.domMaximize.onmouseout = null;this.domDetach.onmouseover = null;this.domDetach.onmouseout = null;}this.domMaximize.onclick = null;this.domMaximize.parentObj = null;this.domDetach.onclick = null;this.domDetach.parentObj = null;this.domClose.onclick = null;this.domClose.parentObj = null;this.queryUnload = null;this.domClose = null;this.domParent = null;this.domContainer = null;this.domTitle = null;this.domObj = null;}}var clientTimeDiff = 0;
function getServerTime()
{return(new Date(clientTimeDiff + Date.parse(Date())));}
function setServerTime(inServerTime)
{var tmpDate = new Date;tmpDate.parseHRDate(inServerTime);clientTimeDiff = Date.parse(tmpDate) - Date.parse(Date());}
function listic_class()
{this.aDogadjaji = new Array();this.aDogadjajiOrder = null;this.superprognoza = false;this.brojSistemskih = 0;this.aSistemskiKoeff = null;this.windowObj = new listic_window_class(this);this.sistemObj = new sistem_class(this);this.izracunObj = new izracun_class(this);this.broj_listica = null;this.serverRequest = null;if(debugMode)this.dataSource = '/rpc/listic.asp?debugMode=true';else this.dataSource = '/rpc/listic.asp';this.statusWindow = null;this.listic_row_template = document.getElementById('listic_row_template');
this.addDogadjaj = function(inSetTipova, inID_ovi)
{var iDataIndex=-1;var iID_dogadjaja = inID_ovi[4];do { ++iDataIndex;} while(inSetTipova.aData[iDataIndex].id_dogadjaja != iID_dogadjaja);var tmpTime = getServerTime();if(inSetTipova.aData[iDataIndex].vrijeme < tmpTime){msgbox('Događaj je započeo – nije ga moguće dodati na listić!');return;}if(this.aDogadjaji.length > 0){if(this.aDogadjaji.length == site_const.max_br_dogadjaja){msgbox('Listić već sadrži '+site_const.max_br_dogadjaja+' događaja.\nViše od toga nije dozvoljeno!');return;}if(this.superprognoza){if(inSetTipova.grupa_dogadjaja.sport.id_sporta != site_const.superprognoza_sportID){msgbox('Odabrani događaj nije moguće dodati na listić jer ne pripada '+site_const.superprognoza_naziv_dativ+'.'+ '\n\nAko listić sadrži događaje sa '+site_const.superprognoza_naziv_genitiv+', moguće je'+ '\ndodavati samo događaje koji su također sa '+site_const.superprognoza_naziv_genitiv+'!');return;}}else if(inSetTipova.grupa_dogadjaja.sport.id_sporta == site_const.superprognoza_sportID){msgbox('Odabrani događaj nije moguće dodati na listić jer pripada '+site_const.superprognoza_naziv_dativ+'.'+ '\n\nAko listić sadrži događaje koji nisu sa '+site_const.superprognoza_naziv_genitiv+','+ '\nnije moguće dodavati samo događaje koji jesu sa '+site_const.superprognoza_naziv_genitiv+'!');return;}var aKod = inSetTipova.grupa_dogadjaja.dogadjaji[iID_dogadjaja][9];if(aKod == '')aKod = null;else aKod = aKod.split(' ');var iIndex = this.aDogadjaji.length-1;var tmpIDVarijante = inSetTipova.aData[iDataIndex].aDogadjaj_koef[1];var sKodSpecijalke1 = inSetTipova.aData[iDataIndex].aDogadjaj_koef[6];do {if(this.aDogadjaji[iIndex].id_ovi[4]==inID_ovi[4]){var sTextPoruke = 'Odabrana varijanta događaja\n'+inSetTipova.aData[iDataIndex].broj+' '+inSetTipova.aData[iDataIndex].naziv+'\nse već nalazi na listiću!';if(this.aDogadjaji[iIndex].aDogadjaj_koef[1] == tmpIDVarijante){msgbox(sTextPoruke);return;}var sKodSpecijalke2 = this.aDogadjaji[iIndex].aDogadjaj_koef[6];if(sKodSpecijalke1=='' || sKodSpecijalke2==''){msgbox(sTextPoruke);return;}aKodSpec_1 = sKodSpecijalke1.split(' ');aKodSpec_2 = sKodSpecijalke2.split(' ');var tmpKod_1, tmpKod_2;for(tmpKod_1 in aKodSpec_1){for(tmpKod_2 in aKodSpec_2)if(aKodSpec_1[tmpKod_1] == aKodSpec_2[tmpKod_2])break;if(aKodSpec_1[tmpKod_1] == aKodSpec_2[tmpKod_2])break;}if(aKodSpec_1[tmpKod_1] != aKodSpec_2[tmpKod_2]){msgbox(sTextPoruke);return;}}else if(aKod != null){if(!this.aDogadjaji[iIndex].provjeriKod(aKod)){msgbox('Odabrani događaj nije moguće kombinirati sa\n'+this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv);return;}}} while(--iIndex > -1);}else {if(this.windowObj.hidden)this.windowObj.show();else globalTimer.stop(this.windowObj.timerID);if(this.windowObj.autohide)this.windowObj.toggleAutohide(false);if(inSetTipova.grupa_dogadjaja.sport.id_sporta == site_const.superprognoza_sportID)this.superprognoza=true;else this.superprognoza=false;}var tmpRow = new listic_row_class(this);tmpRow.init(inSetTipova, inID_ovi, iDataIndex);this.aDogadjaji.push(tmpRow);this.windowObj.refresh();this.izracunObj.refresh();this.windowObj.titlebar.domTitlebar.innerHTML = 'IZRADA LISTIĆA - ' + tmpRow.naziv;return(true);}
this.deleteDogadjaj = function(inRowObj)
{var i = -1;while(this.aDogadjaji[++i]!=inRowObj) {};this.aDogadjaji[i].terminate();this.aDogadjaji.splice(i,1);this.windowObj.refresh();this.sistemObj.refresh();this.izracunObj.refresh();this.windowObj.resize();}
this.checkDogadjaj = function(inID)
{this.windowObj.refresh();this.izracunObj.recalcKoef();this.sistemObj.refresh();this.izracunObj.refresh();this.windowObj.resize();return(true);}
this.clearAll = function()
{var i=this.aDogadjaji.length;while(i-->0){this.aDogadjaji[i].terminate();this.aDogadjaji[i]=null;}this.brojSistemskih = 0;this.aSistemskiKoeff = null;this.aDogadjaji = new Array();this.windowObj.refresh();this.sistemObj.refresh();this.izracunObj.refresh();this.windowObj.resize();if(!this.windowObj.autohide){this.windowObj.toggleAutohide(true);globalTimer.start(this.windowObj.timerID);}}
this.showPrint = function()
{appStatus.setStatus(2);this.openStatusWindow();this.statusWindow.addContent('Priprema listića za ispis ...');if(this.aDogadjaji.length == 0){msgbox("Ispis nije moguć - listić je prazan!");this.closeStatusWindow();return;}if(site_const.min_uplata > this.izracunObj.uplata){msgbox('Ispis nije moguć - premali iznos uplate!' +'\n\nPravila nalažu minimalni ulog od '+formatCurr(site_const.min_uplata)+' '+site_const.valuta);this.closeStatusWindow();return;}var iBrojDogadjaja = this.aDogadjaji.length;var iIndex = iBrojDogadjaja-1;var dogExtremes = {br_dog:{iMin:0, min_naziv:'', iMax:site_const.max_br_dogadjaja, max_naziv:''}, uplata:{iMin:0, min_naziv:'', iMax:99999999, max_naziv:''}};var varExtremes = {br_dog:{iMin:0, min_naziv:'', iMax:site_const.max_br_dogadjaja, max_naziv:''}, uplata:{iMin:0, min_naziv:'', iMax:99999999, max_naziv:''}};do {if(this.brojSistemskih==0 || this.aDogadjaji[iIndex].sistemski){if(dogExtremes.uplata.iMin < this.aDogadjaji[iIndex].min_uplata){dogExtremes.uplata.iMin = this.aDogadjaji[iIndex].min_uplata;dogExtremes.uplata.min_naziv = this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv;}if(dogExtremes.uplata.iMax > this.aDogadjaji[iIndex].max_uplata){dogExtremes.uplata.iMax = this.aDogadjaji[iIndex].max_uplata;dogExtremes.uplata.max_naziv = this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv;}if(dogExtremes.br_dog.iMin < this.aDogadjaji[iIndex].min_br){dogExtremes.br_dog.iMin = this.aDogadjaji[iIndex].min_br;dogExtremes.br_dog.min_naziv = this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv;}if(dogExtremes.br_dog.iMax > this.aDogadjaji[iIndex].max_br){dogExtremes.br_dog.iMax = this.aDogadjaji[iIndex].max_br;dogExtremes.br_dog.max_naziv = this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv;}if(varExtremes.uplata.iMin < this.aDogadjaji[iIndex].aDogadjaj_koef[4]){varExtremes.uplata.iMin = this.aDogadjaji[iIndex].aDogadjaj_koef[4];varExtremes.uplata.min_naziv = this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv;}if(varExtremes.uplata.iMax > this.aDogadjaji[iIndex].aDogadjaj_koef[5]){varExtremes.uplata.iMax = this.aDogadjaji[iIndex].aDogadjaj_koef[5];varExtremes.uplata.max_naziv = this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv;}if(varExtremes.br_dog.iMin < this.aDogadjaji[iIndex].aDogadjaj_koef[2]){varExtremes.br_dog.iMin = this.aDogadjaji[iIndex].aDogadjaj_koef[2];varExtremes.br_dog.min_naziv = this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv;}if(varExtremes.br_dog.iMax > this.aDogadjaji[iIndex].aDogadjaj_koef[3]){varExtremes.br_dog.iMax = this.aDogadjaji[iIndex].aDogadjaj_koef[3];varExtremes.br_dog.max_naziv = this.aDogadjaji[iIndex].broj+' '+this.aDogadjaji[iIndex].naziv;}}} while(--iIndex > -1);if(this.brojSistemskih == 0){if(dogExtremes.uplata.iMin > this.izracunObj.uplata){msgbox('Ispis nije moguć - premali iznos uplate!' +'\n\nDogađaj '+dogExtremes.uplata.min_naziv +'\ndopušta uplatu od najmanje '+formatCurr(dogExtremes.uplata.iMin)+' '+site_const.valuta);this.closeStatusWindow();return;}else if(dogExtremes.uplata.iMax < this.izracunObj.uplata){msgbox('Ispis nije moguć - prevelik iznos uplate!' +'\n\nDogađaj '+dogExtremes.uplata.max_naziv +'\ndopušta uplatu od najviše '+formatCurr(dogExtremes.uplata.iMax)+' '+site_const.valuta);this.closeStatusWindow();return;}if(dogExtremes.br_dog.iMin > iBrojDogadjaja){msgbox('Ispis nije moguć - listić sadrži premalo događaja!' +'\n\nDogađaj '+dogExtremes.br_dog.min_naziv +'\nnalaže najmanje '+dogExtremes.br_dog.iMin+' događaja');this.closeStatusWindow();return;}else if(dogExtremes.br_dog.iMax < iBrojDogadjaja){msgbox('Ispis nije moguć - listić sadrži previše događaja!' +'\n\nDogađaj '+dogExtremes.br_dog.max_naziv +'\ndopušta najviše '+dogExtremes.br_dog.iMax+' događaja');this.closeStatusWindow();return;}if(varExtremes.uplata.iMin > this.izracunObj.uplata){msgbox('Ispis nije moguć - premali iznos uplate!' +'\n\nDogađaj '+varExtremes.uplata.min_naziv +'\ndopušta uplatu od najmanje '+formatCurr(varExtremes.uplata.iMin)+' '+site_const.valuta);this.closeStatusWindow();return;}else if(varExtremes.uplata.iMax < this.izracunObj.uplata){msgbox('Ispis nije moguć - prevelik iznos uplate!' +'\n\nDogađaj '+varExtremes.uplata.max_naziv +'\ndopušta uplatu od najviše '+formatCurr(varExtremes.uplata.iMax)+' '+site_const.valuta);this.closeStatusWindow();return;}if(varExtremes.br_dog.iMin > iBrojDogadjaja){msgbox('Ispis nije moguć - listić sadrži premalo događaja!' +'\n\nDogađaj '+varExtremes.br_dog.min_naziv +'\nnalaže najmanje '+varExtremes.br_dog.iMin+' događaja');this.closeStatusWindow();return;}else if(varExtremes.br_dog.iMax < iBrojDogadjaja){msgbox('Ispis nije moguć - listić sadrži previše događaja!' +'\n\nDogađaj '+varExtremes.br_dog.max_naziv +'\ndopušta najviše '+varExtremes.br_dog.iMax+' događaja');this.closeStatusWindow();return;}}else {if(this.sistemObj.odabranihIzvl == 0){msgbox('Ispis nije moguć - u sistemu nije odabrana niti jedna kombinacija!');this.closeStatusWindow();return;}var objIzvlacenje = null;var brFikseva = this.aDogadjaji.length - this.brojSistemskih;iIndex = this.sistemObj.aGrupeKombinacija.length-1;do {objIzvlacenje = this.sistemObj.aGrupeKombinacija[iIndex];if(objIzvlacenje.selected){if(objIzvlacenje.uplata_po_komb < site_const.min_uplata_sistem){msgbox('Ispis nije moguć - premala uplata po kombinaciji!' +'\n\nPravila nalažu minimalnu uplatu od '+formatCurr(site_const.min_uplata_sistem)+' '+site_const.valuta +'\npo kombinaciji.');this.closeStatusWindow();return;}if(dogExtremes.br_dog.iMax < (objIzvlacenje.broj_izvlacenja+brFikseva)){msgbox('Ispis nije moguć - grupa kombinacija ('+brFikseva+'+'+objIzvlacenje.broj_izvlacenja+'/'+objIzvlacenje.broj_dogadjaja+') zajedno sa fiksevima' +'\nsadrži previše događaja ('+brFikseva+'+'+objIzvlacenje.broj_izvlacenja+'='+(brFikseva+objIzvlacenje.broj_izvlacenja)+')!' +'\n\nDogađaj '+dogExtremes.br_dog.max_naziv+' nalaže najviše '+dogExtremes.br_dog.iMax+' događaja, uključujući fikseve.');this.closeStatusWindow();return;}else if(dogExtremes.br_dog.iMin > (objIzvlacenje.broj_izvlacenja+brFikseva)){msgbox('Ispis nije moguć - odabrana grupa kombinacija ('+brFikseva+'+'+objIzvlacenje.broj_izvlacenja+'/'+objIzvlacenje.broj_dogadjaja+') zajedno sa fiksevima' +'\nsadrži premalo događaja ('+brFikseva+'+'+objIzvlacenje.broj_izvlacenja+'='+(brFikseva+objIzvlacenje.broj_izvlacenja)+')!' +'\n\nDogađaj '+dogExtremes.br_dog.min_naziv+' nalaže najmanje '+dogExtremes.br_dog.iMin+' događaja, uključujući fikseve.');this.closeStatusWindow();return;}if(varExtremes.br_dog.iMax < (objIzvlacenje.broj_izvlacenja+brFikseva)){msgbox('Ispis nije moguć - grupa kombinacija ('+brFikseva+'+'+objIzvlacenje.broj_izvlacenja+'/'+objIzvlacenje.broj_dogadjaja+') zajedno sa fiksevima' +'\nsadrži previše događaja ('+brFikseva+'+'+objIzvlacenje.broj_izvlacenja+'='+(brFikseva+objIzvlacenje.broj_izvlacenja)+')!' +'\n\nDogađaj '+varExtremes.br_dog.max_naziv+' nalaže najviše '+varExtremes.br_dog.iMax+' događaja, uključujući fikseve.');this.closeStatusWindow();return;}else if(varExtremes.br_dog.iMin > (objIzvlacenje.broj_izvlacenja+brFikseva)){msgbox('Ispis nije moguć - odabrana grupa kombinacija ('+brFikseva+'+'+objIzvlacenje.broj_izvlacenja+'/'+objIzvlacenje.broj_dogadjaja+') zajedno sa fiksevima' +'\nsadrži premalo događaja ('+brFikseva+'+'+objIzvlacenje.broj_izvlacenja+'='+(brFikseva+objIzvlacenje.broj_izvlacenja)+')!' +'\n\nDogađaj '+varExtremes.br_dog.min_naziv+' nalaže najmanje '+varExtremes.br_dog.iMin+' događaja, uključujući fikseve.');this.closeStatusWindow();return;}}} while(--iIndex > -1);}appStatus.setStatus(1);this.sendData();}
this.sendData = function()
{if(this.serverRequest == null)this.serverRequest = createHTTPRequest();this.serverRequest.open("GET", this.dataSource, true);this.prepareSend();try { this.serverRequest.onload = this.receiveData; }catch(error){
this.serverRequest.onreadystatechange = function()
{if(listic.serverRequest.readyState == 4)listic.receiveData();}}this.serverRequest.send(null);}
this.prepareSend = function()
{var aString1 = this.izracunObj.prepareSend();var aString2 = this.sistemObj.prepareSend();var aString3 = new Array();var iRedniBroj = 0;var iTo = this.aDogadjaji.length;aString3.push(iTo);do {aString3.push(this.aDogadjaji[  this.aDogadjajiOrder[iRedniBroj]  ].prepareSend(iRedniBroj));} while(++iRedniBroj < iTo)aString3.push('');aString3 = aString3.join('|');this.serverRequest.setRequestHeader("String1", aString1);this.serverRequest.setRequestHeader("String2", aString2);this.serverRequest.setRequestHeader("String3", aString3);return;}
this.receiveData = function()
{appStatus.setStatus(2);listic.statusWindow.enable_close();if(listic.serverRequest.status != 404)listic.broj_listica = listic.serverRequest.getResponseHeader("broj_listica");else listic.broj_listica = null;listic.statusWindow.addContent('<br><br>...ispis pripremljen - za ispis kliknite na ikonu printera');listic.statusWindow.addContent('<br><br><a href="#" onclick="listic_print();listic.closeStatusWindow();return(false);"><img src="/img/print/printer_icon.gif" title="Ispiši listić" /></a>');appStatus.setStatus(0);}
this.openStatusWindow = function()
{if(this.statusWindow == null)this.statusWindow = new window_class(wrapper_div, 'Priprema listića za ispis', false, true);this.statusWindow.parentObj = this;this.statusWindow.domContainer.id = 'listic_status';center_div.showOverlay();this.statusWindow.open(200,250,320,130);}
this.queryUnload = function()
{center_div.hideOverlay();this.statusWindow = null;return(true);}
this.closeStatusWindow = function()
{if(this.statusWindow != null)this.statusWindow.close();this.statusWindow = null;center_div.hideOverlay();}
this.terminate = function()
{this.clearAll();this.aDogadjaji = null;this.windowObj.terminate();this.windowObj = null;this.titlebar.terminate();this.titlebar = null;this.sistemObj.terminate();this.sistemObj = null;this.aSistemskiKoeff = null;}}
function listic_icon_class(inImageSrc, inTitle)
{this.domObj = document.createElement('img');this.domObj.src = inImageSrc;this.domObj.title = inTitle;this.domObj.alt = inTitle;this.domObj.style.display = 'none';document.getElementById('listic_icons').appendChild(this.domObj);
this.show = function()
{this.domObj.style.display = 'inline';}
this.hide = function()
{this.domObj.style.display = 'none';}
this.terminate = function()
{document.getElementById('listic_icons').removeChild(this.domObj);this.domObj.onclick = null;this.domObj = null;}}
function listic_row_class(inParent)
{this.parent = inParent;
this.init = function(inSetTipova, inID_ovi, inDataIndex)
{this.parentDOM = null;this.domObj = this.parent.listic_row_template.cloneNode(true);this.domObj.id = '';this.id_ovi = inID_ovi;this.sistemski = false;this.naziv = inSetTipova.aData[inDataIndex].naziv;this.broj  = inSetTipova.aData[inDataIndex].broj;this.koeff = inSetTipova.aData[inDataIndex].koeff[inID_ovi[5]];this.vrijeme = inSetTipova.aData[inDataIndex].vrijeme;this.aDogadjaj_koef = inSetTipova.aData[inDataIndex].aDogadjaj_koef;var objDogadjaj = inSetTipova.grupa_dogadjaja.dogadjaji[inID_ovi[4]];this.kod = objDogadjaj[9].trim().split(' ');this.min_br = objDogadjaj[5];this.max_br = objDogadjaj[6];this.min_uplata = objDogadjaj[7];this.max_uplata = objDogadjaj[8];var j=-1;do { ++j;} while(inSetTipova.aTipovi[j+0] != inID_ovi[5])this.tipNaziv = inSetTipova.aTipovi[j+1];this.domObj.getElementsByTagName('input')[0].id = 'check'+inID_ovi[0];var aLabel = this.domObj.getElementsByTagName('label')[0];aLabel.htmlFor = 'check'+inID_ovi[0];aLabel.innerHTML = this.broj+' '+this.naziv;aLabel.title = this.broj+' '+this.naziv;var aTD = this.domObj.getElementsByTagName('td');aTD[1].innerHTML = this.tipNaziv;aTD[2].innerHTML = formatKoeff(this.koeff);var domImg = this.domObj.getElementsByTagName('img')[0];domImg.parentObj = this;
domImg.onclick = function() { this.parentObj.remove(); }
this.domCheckbox = this.domObj.getElementsByTagName('input')[0];this.domCheckbox.parentObj = this;
this.domCheckbox.onclick = function() { return(this.parentObj.checkbox_onClick()); }
}
this.checkbox_onClick = function()
{if(this.parent.superprognoza){alert('Za događaje '+site_const.superprognoza_naziv_genitiv+'\nizrada sistemskog listića nije moguća!');return(false);}if(this.domCheckbox.checked){if(this.parent.brojSistemskih == site_const.max_br_sistemskih_dog){alert('Već je odabran maksimalan broj sistemskih događaja ('+site_const.max_br_sistemskih_dog+').\nDodavanje novih nije moguće!');return(false);}this.domCheckbox.title = 'Označi događaj kao fiks';this.sistemski = true;}else {this.domCheckbox.title = 'Označi događaj kao sistemski';this.sistemski = false;}this.parent.checkDogadjaj();return(true);}
this.provjeriKod = function(inKod)
{if(this.kod.length == 0)return(true);for(var i in inKod)for(var j in this.kod)if(this.kod[j] == inKod[i])return(false);return(true);}
this.hide = function()
{if(this.parentDOM!=null)this.parentDOM.removeChild(this.domObj);this.parentDOM==null;}
this.show = function(inDomParent, inNazivPrefix)
{var aLabel = this.domObj.getElementsByTagName('label')[0];this.nazivPrefix = inNazivPrefix;aLabel.innerHTML = inNazivPrefix+this.broj+' '+this.naziv;aLabel.title = this.broj+' '+this.naziv;this.parentDOM = inDomParent;inDomParent.appendChild(this.domObj);}
this.remove = function()
{this.parent.deleteDogadjaj(this);}
this.getHTML = function(inPrefix)
{return( '<tr><th>'+this.broj+'</th>' +'<td>'+inPrefix+this.naziv+'</td>' +'<td>'+this.vrijeme.getWeekday(true)+', '+this.vrijeme.getHRTime(false)+'</td>' +'<th class="koeff">'+this.tipNaziv+'</th>' +'<th>'+formatKoeff(this.koeff)+'</th></tr>');}
this.prepareSend = function(inRedniBroj)
{var aReturn = new Array();aReturn.push(inRedniBroj);aReturn.push(this.id_ovi[4]);aReturn.push(this.id_ovi[3]);aReturn.push(this.aDogadjaj_koef[1]);aReturn.push(this.id_ovi[5]);aReturn.push(this.broj);aReturn.push(this.nazivPrefix.charAt(0));aReturn.push(this.tipNaziv);aReturn.push(this.koeff);return(aReturn.join('|'));}
this.terminate = function()
{var tmpDom = this.domObj.getElementsByTagName('img')[0];tmpDom.onclick = null;tmpDom.parentObj = null;this.domCheckbox.onclick = null;this.domCheckbox.parentObj = null;this.domCheckbox = null;this.hide();this.parentDOM = null;this.domObj = null;this.parent = null;}}
function listic_titlebar_class()
{this.domTitlebar = document.getElementById('listic_title');this.icons = { tick_up:null, tick_down:null, printer:null, recycle:null, minimize:null};this.icons.printer    = new listic_icon_class("/img/listic/printer.gif", "Ispis listića");this.icons.recycle    = new listic_icon_class("/img/listic/recycle.gif","Brisanje listića");this.icons.tick_up    = new listic_icon_class("/img/listic/tick_up.gif", "Isključi automatsko skrivanje");this.icons.tick_down  = new listic_icon_class("/img/listic/tick_down.gif", "Uključi automatsko skrivanje");this.icons.minimize   = new listic_icon_class("/img/listic/minimize.gif", "Sakrij listić");this.icons.tick_up.show();this.icons.tick_down.hide();this.icons.printer.show();this.icons.recycle.show();this.icons.minimize.show();
this.icons.recycle.domObj.onclick = function()
{var r = confirm('Odabrali ste brisanje svih događaja na listiću. Jeste li sigurni?');if(r == true) listic.clearAll();}
this.icons.minimize.domObj.onclick = function() { listic.windowObj.hide(); }
this.icons.printer.domObj.onclick = function() { listic.showPrint(); }
this.icons.tick_up.domObj.onclick = function() { listic.windowObj.toggleAutohide(false); }
this.icons.tick_down.domObj.onclick = function() { listic.windowObj.toggleAutohide(true); }
this.terminate = function()
{this.icons.tick_up.terminate();this.icons.tick_down.terminate();this.icons.printer.terminate();this.icons.recycle.terminate();this.icons.minimize.terminate();this.icons.tick_up    = null;this.icons.tick_down  = null;this.icons.printer    = null;this.icons.recycle    = null;this.icons.minimize   = null;}}
function listic_window_class(inParent)
{this.titlebar = new listic_titlebar_class();this.domTitlebar = document.getElementById('listic_title');this.domContainer = document.getElementById('listic_container');this.domIcons = document.getElementById('listic_icons');this.domListic_sistem = document.getElementById('listic_sistem');this.parent = inParent;this.timerID = null;this.timerID = globalTimer.add(this,1000,false);this.autohide = true;this.hidden = true;this.openHeight = 118;this.closedHeight = 25;this.height = this.closedHeight;
this.domTitlebar.onmouseover = function() { listic.windowObj.mouseOver(); }
this.domTitlebar.onmouseout = function() { listic.windowObj.mouseOut(); }
this.domContainer.onmouseover = function() { listic.windowObj.mouseOver(); }
this.domContainer.onmouseout = function() { listic.windowObj.mouseOut(); }
this.domIcons.onmouseover = function() { listic.windowObj.mouseOver(); }
this.domIcons.onmouseout = function() { listic.windowObj.mouseOut(); }
this.domLeftColumn = document.getElementById('listic_dogadjaji_l').getElementsByTagName('TBODY')[0];this.domRightColumn = document.getElementById('listic_dogadjaji_r').getElementsByTagName('TBODY')[0];
this.hide = function()
{this.domContainer.style.display = 'none';this.domTitlebar.style.bottom = '11px';this.domTitlebar.style.height = '22px';this.domIcons.style.bottom = '12px';this.height = this.closedHeight;globalTimer.start(center_div.timerID);this.hidden = true;}
this.show = function()
{this.domContainer.style.display = 'block';this.domContainer.style.height = (this.openHeight-16)+'px';this.domListic_sistem.style.height = (this.openHeight-50)+'px';this.domTitlebar.style.bottom = (this.openHeight-16)+'px';this.domTitlebar.style.height = '26px';this.domIcons.style.bottom = (this.openHeight-11)+'px';this.height = this.openHeight;globalTimer.start(center_div.timerID);this.hidden = false;}
this.mouseOver = function()
{globalTimer.stop(this.timerID);this.titlebar.domTitlebar.innerHTML = 'IZRADA LISTIĆA';this.show();}
this.resize = function()
{var sistemHeight = 0;for(var i in this.parent.sistemObj.aGrupeKombinacija)sistemHeight+=this.parent.sistemObj.aGrupeKombinacija[i].height;var brojRedaka = Math.ceil(this.parent.aDogadjaji.length / 2);if(brojRedaka < 4) brojRedaka = 4;var innerHeight =  brojRedaka * 17;while(sistemHeight > innerHeight && brojRedaka++ < 12)innerHeight =  brojRedaka * 17;if(this.openHeight == innerHeight + 50) return;this.openHeight = innerHeight + 50;if(!this.hidden) this.show();}
this.mouseOut = function()
{if(this.autohide)globalTimer.start(this.timerID);}
this.timerTimeout = function(inObj)
{this.hide();}
this.refresh = function()
{var i;var aSlova = new Array('A=','B=','C=','D=','E=','F=','G=','H=','I=','J=', 'K=','L=','M=','N=','O=','P=','R=','S=','T=','U=');var iSlovaIndex = 0;for(i in this.parent.aDogadjaji)this.parent.aDogadjaji[i].hide();var iTo = this.parent.aDogadjaji.length;var iHalve = Math.ceil(iTo/2);this.parent.aSistemskiKoeff = new Array();this.parent.brojSistemskih = 0;if(iTo==0){this.resize();return;}i = 0;var iRedak = 0;this.parent.aDogadjajiOrder = new Array();do {if(!this.parent.aDogadjaji[i].sistemski){this.parent.aDogadjajiOrder[iRedak] = i;if(iRedak++<iHalve)this.parent.aDogadjaji[i].show(this.domLeftColumn, '');else this.parent.aDogadjaji[i].show(this.domRightColumn, '');}} while(++i<iTo);i = 0;do {if(this.parent.aDogadjaji[i].sistemski){this.parent.aDogadjajiOrder[iRedak] = i;if(iRedak++<iHalve)this.parent.aDogadjaji[i].show(this.domLeftColumn, aSlova[iSlovaIndex++]);else this.parent.aDogadjaji[i].show(this.domRightColumn, aSlova[iSlovaIndex++]);this.parent.aDogadjaji[i].domCheckbox.checked = true;this.parent.aSistemskiKoeff.push(this.parent.aDogadjaji[i].koeff);this.parent.brojSistemskih++;}} while(++i<iTo);this.resize();}
this.toggleAutohide = function(inAutohideON)
{this.autohide = inAutohideON;if(inAutohideON){this.titlebar.icons.tick_down.hide();this.titlebar.icons.tick_up.show();}else {this.titlebar.icons.tick_down.show();this.titlebar.icons.tick_up.hide();}}
this.terminate = function()
{globalTimer.remove(this.timerID);this.domTitlebar.onmouseover = null;this.domTitlebar.onmouseout = null;this.domContainer.onmouseover = null;this.domContainer.onmouseout = null;this.domIcons.onmouseover = null;this.domIcons.onmouseout = null;this.domTitlebar = null;this.domTitlebar = null;this.domContainer = null;this.domContainer = null;this.domIcons = null;this.domIcons = null;this.parent = null;}}
function sistem_class(inParent)
{this.parent = inParent;this.ukupniUlog = 0;this.moguciDobitak = 0;this.aGrupeKombinacija = new Array();this.odabranihGrupa = null;this.ukupno_kombinacija = 0;this.domObj = document.getElementById('listic_sistem').getElementsByTagName('tbody')[0];this.sistem_check_template = document.getElementById('sistem_check_template');this.sistem_input_template = document.getElementById('sistem_input_template');this.aBrojKomb = new Array();this.aBrojKomb[ 0] = new Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18);this.aBrojKomb[ 1] = new Array(0,1,3,6,10,15,21,28,36,45,55,66,78,91,105,120,136,153);this.aBrojKomb[ 2] = new Array(0,0,1,4,10,20,35,56,84,120,165,220,286,364,455,560,680,816);this.aBrojKomb[ 3] = new Array(0,0,0,1,5,15,35,70,126,210,330,495,715,1001,1365,1820,2380,3060);this.aBrojKomb[ 4] = new Array(0,0,0,0,1,6,21,56,126,252,462,792,1287,2002,3003,4368,6188,8568);this.aBrojKomb[ 5] = new Array(0,0,0,0,0,1,7,28,84,210,462,924,1716,3003,5005,8008,12376,18564);this.aBrojKomb[ 6] = new Array(0,0,0,0,0,0,1,8,36,120,330,792,1716,3432,6435,11440,19448,31824);this.aBrojKomb[ 7] = new Array(0,0,0,0,0,0,0,1,9,45,165,495,1287,3003,6435,12870,24310,43758);this.aBrojKomb[ 8] = new Array(0,0,0,0,0,0,0,0,1,10,55,220,715,2002,5005,11440,24310,48620);this.aBrojKomb[ 9] = new Array(0,0,0,0,0,0,0,0,0,1,11,66,286,1001,3003,8008,19448,43758);this.aBrojKomb[10] = new Array(0,0,0,0,0,0,0,0,0,0,1,12,78,364,1365,4368,12376,31824);this.aBrojKomb[11] = new Array(0,0,0,0,0,0,0,0,0,0,0,1,13,91,455,1820,6188,18564);this.aBrojKomb[12] = new Array(0,0,0,0,0,0,0,0,0,0,0,0,1,14,105,560,2380,8568);this.aBrojKomb[13] = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,1,15,120,680,3060);this.aBrojKomb[14] = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,16,136,816);this.aBrojKomb[15] = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,17,153);this.aBrojKomb[16] = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,18);this.aBrojKomb[17] = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
this.refresh = function()
{var iIndex = this.aGrupeKombinacija.length;var iBrSistemskih = this.parent.brojSistemskih;if(iIndex > iBrSistemskih){while(--iIndex >= iBrSistemskih){this.aGrupeKombinacija[iIndex].terminate();this.aGrupeKombinacija[iIndex] = null;this.aGrupeKombinacija.pop(iIndex);}}else if(iIndex < iBrSistemskih){while(iIndex++ < iBrSistemskih)this.aGrupeKombinacija.push(new grupa_kombinacija_class(this));}iIndex = this.aGrupeKombinacija.length;while(--iIndex>=0)this.aGrupeKombinacija[iIndex].update(iBrSistemskih, iIndex+1, this.aBrojKomb[iIndex][iBrSistemskih-1]);}
this.resync = function()
{this.parent.izracunObj.refresh();}
this.setUplata = function(inUkupnaUplata)
{if(this.odabranihGrupa==0) return;if(this.ukupno_kombinacija == null){iIndex = this.aGrupeKombinacija.length-1;this.ukupno_kombinacija = 0;do {if(this.aGrupeKombinacija[iIndex].selected)this.ukupno_kombinacija+=this.aGrupeKombinacija[iIndex].broj_kombinacija;} while(--iIndex>-1)}var iBrojOdabranih = this.odabranihGrupa;var uplataPoKomb = inUkupnaUplata / this.ukupno_kombinacija;var preostaliIznos = inUkupnaUplata;var tmpUplata = 0;iIndex = this.aGrupeKombinacija.length-1;do {if(this.aGrupeKombinacija[iIndex].selected){if(--iBrojOdabranih==0)tmpUplata = Math.round(preostaliIznos*10000)/10000;else tmpUplata = Math.round(uplataPoKomb * this.aGrupeKombinacija[iIndex].broj_kombinacija*10000)/10000;this.aGrupeKombinacija[iIndex].setUplata(tmpUplata);preostaliIznos -= tmpUplata;}} while (--iIndex>-1);}
this.getHTML = function()
{var sReturn = '<table id="grupe_komb"><caption>Kombinacijske grupe:</caption><tr><th class="td_center">Tip</th><th>Komb.</th><th>Uplata</th><th>Uplata/k.</th></tr>';for(var iIndex in this.aGrupeKombinacija)sReturn+=this.aGrupeKombinacija[iIndex].getHTML();sReturn+='</table>';return(sReturn);}
this.prepareSend = function()
{var aReturn = new Array();var iTo = this.aGrupeKombinacija.length;var iRedniBroj=0;aReturn.push(this.odabranihGrupa);for(var iIndex=0;iIndex<iTo;iIndex++)if(this.aGrupeKombinacija[iIndex].selected)aReturn.push(this.aGrupeKombinacija[iIndex].prepareSend(++iRedniBroj));aReturn.push('');return(aReturn.join('|'));}}
function grupa_kombinacija_class(inParent)
{this.uplata = site_const.grupa_komb_default_uplata;this.ulog = this.uplata*site_const.mt;this.dobitak = 0;this.parent = inParent;this.broj_dogadjaja = 0;this.broj_izvlacenja = 0;this.broj_kombinacija = 0;this.selected = false;this.needRecalc = true;this.height = 20;this.domCheck = this.parent.sistem_check_template.cloneNode(true);this.domCheck.id = '';this.domInput = this.parent.sistem_input_template.cloneNode(true);this.domInput.id = '';this.domInput.style.display = 'none';this.domSpan = this.domInput.getElementsByTagName('span')[0];this.tbxUplata = new textbox_class(this, this.domInput.getElementsByTagName('input')[0]);this.tbxUplata.numeric = true;this.tbxUplata.setText(formatCurr(this.uplata));this.parent.domObj.appendChild(this.domCheck);this.parent.domObj.appendChild(this.domInput);this.domCheckbox = this.domCheck.getElementsByTagName('input')[0];this.domCheckbox.id = getRandomID();this.domCheckbox.parentObj = this;this.domCheckbox.checked = false;
this.domCheckbox.onclick = function() { this.parentObj.checkbox_onClick(); }
this.domLabel    = this.domCheck.getElementsByTagName('label')[0];this.domLabel.htmlFor = this.domCheckbox.id;
this.update = function(inBrojDogadjaja, inBrojIzvlacenja, inBrojKombinacija)
{this.broj_dogadjaja = inBrojDogadjaja;this.broj_izvlacenja = inBrojIzvlacenja;this.broj_kombinacija = inBrojKombinacija;this.parent.ukupno_kombinacija = null;if(this.selected){this.needRecalc = true;this.reCalcAll();}this.domLabel.innerHTML = this.broj_izvlacenja+'/'+this.broj_dogadjaja+' ('+this.broj_kombinacija+')';}
this.reCalcAll = function()
{if(!this.needRecalc) return;this.uplata_po_komb = Math.round(this.uplata/this.broj_kombinacija*10000)/10000;this.ulog_po_komb = Math.round(this.uplata_po_komb*site_const.mt*10000)/10000;this.ulog = Math.round(this.uplata*site_const.mt*10000)/10000;this.dobitak = calcDobitak(this.broj_izvlacenja, this.broj_dogadjaja, this.parent.parent.izracunObj.ukupni_koeff, this.ulog_po_komb, 0);this.domSpan.innerHTML = '('+formatCurr(this.uplata_po_komb, 4)+')';this.needRecalc = false;}
this.checkbox_onClick = function()
{this.selected = this.domCheckbox.checked;this.parent.ukupno_kombinacija = null;if(this.selected){this.domInput.style.display = '';this.reCalcAll();this.parent.odabranihGrupa++;this.height = 47;}else {this.domInput.style.display = 'none';this.parent.odabranihGrupa--;this.height = 20;};this.parent.resync();this.parent.parent.windowObj.resize();};this.tbxUplata.onChangeHandler = 'tbxUplata_onChange';
this.tbxUplata_onChange = function()
{this.uplata = this.tbxUplata.numValue;this.needRecalc = true;this.reCalcAll();this.parent.resync();}
this.setUplata = function(inUplata)
{if(this.uplata == inUplata) return;this.uplata = inUplata;this.tbxUplata.setText(formatCurr(this.uplata));this.needRecalc = true;this.reCalcAll();}
this.getHTML = function()
{if(!this.selected) return('');return( '<tr><td class="td_center">'+this.broj_izvlacenja+' od '+this.broj_dogadjaja+'</td>' +'<td>'+formatCurr(this.broj_kombinacija,0)+'</td>' +'<td>'+formatCurr(this.uplata, 2)+'</td>' +'<td>'+formatCurr(this.uplata_po_komb, 4)+'</td></tr>');}
this.prepareSend = function(inRedniBroj)
{var aReturn = new Array();this.ulog_po_komb = Math.round(this.uplata_po_komb*site_const.mt*10000)/10000;var mt_po_kombinaciji =  Math.round((this.uplata_po_komb - this.ulog_po_komb)*10000)/10000;aReturn.push(inRedniBroj);aReturn.push(this.broj_izvlacenja);aReturn.push(this.uplata_po_komb);aReturn.push(this.ulog_po_komb);aReturn.push(mt_po_kombinaciji);return(aReturn.join('|'));}
this.terminate = function()
{if(this.selected)this.parent.odabranihGrupa--;this.domCheckbox.onclick = null;this.domCheckbox.parentObj = null;this.parent.ukupno_kombinacija = null;this.parent.domObj.removeChild(this.domCheck);this.parent.domObj.removeChild(this.domInput);this.domInput = null;this.domCheckbox = null;this.domLabel = null;this.parent = null;this.tbxUplata.terminate();this.tbxUplata = null;}}
function calcDobitak(inN, inOd_M, inKoeff, inUlog, inDobitak)
{var newOd_M = inOd_M-1;if(inN>1)inDobitak = calcDobitak(inN-1, newOd_M, Math.round(inKoeff*listic.aSistemskiKoeff[newOd_M]*10000)/10000, inUlog, inDobitak);else {var tmpKoeff = Math.round(inKoeff*listic.aSistemskiKoeff[newOd_M]*10000)/10000;inDobitak += Math.round(inUlog*tmpKoeff*100)/100;}if(inDobitak > site_const.max_dobitak)return(site_const.max_dobitak);if(inOd_M > inN)inDobitak = calcDobitak(inN, newOd_M, inKoeff, inUlog, inDobitak);return(inDobitak);}
function izracun_class(inParent)
{this.parent = inParent;this.ukupni_koeff = 1;this.uplata = site_const.default_uplata;this.ulog = 0;this.mt = 0;this.dobitak = 0;this.odabrani_sistemi = null;this.tbxUplata_changing = false;this.domUplata_th  = document.getElementById('uplata_th' );this.domUplata_td  = document.getElementById('uplata_td' );this.domMt_th      = document.getElementById('mt_th'     );this.domMt_td      = document.getElementById('mt_td'     );this.domUlog_th    = document.getElementById('ulog_th'   );this.domUlog_td    = document.getElementById('ulog_td'   );this.domSistem_th  = document.getElementById('sistem_th' );this.domSistem_td  = document.getElementById('sistem_td' );this.domKoeff_th   = document.getElementById('koeff_th'  );this.domKoeff_td   = document.getElementById('koeff_td'  );this.domDobitak_th = document.getElementById('dobitak_th');this.domDobitak_td = document.getElementById('dobitak_td');this.domSistem_th.style.display = 'none';this.domSistem_td.style.display = 'none';if(site_const.mt == 1){this.domMt_th.style.display = 'none';this.domMt_td.style.display = 'none';this.domUlog_th.style.display = 'none';this.domUlog_td.style.display = 'none';}else {document.getElementById('mt_dummy').style.display = 'none';document.getElementById('ulog_dummy').style.display = 'none';}this.tbxUplata = new textbox_class(this, document.getElementById('uplata_tbx'));this.tbxUplata.numeric = true;this.tbxUplata.setText(this.uplata);this.tbxUplata.onChangeHandler = 'tbxUplata_onChange';
this.tbxUplata_onChange = function()
{this.uplata = this.tbxUplata.numValue;if(this.parent.brojSistemskih > 0)this.parent.sistemObj.setUplata(this.uplata);this.tbxUplata_changing = true;this.refresh();this.tbxUplata_changing = false;}
this.recalcKoef = function()
{var i = this.parent.aDogadjaji.length;this.ukupni_koeff = 0;if(i>0){this.ukupni_koeff = 1;while(--i>-1){if(!this.parent.aDogadjaji[  this.parent.aDogadjajiOrder[i]  ].sistemski)this.ukupni_koeff=Math.round(this.ukupni_koeff * this.parent.aDogadjaji[  this.parent.aDogadjajiOrder[i]  ].koeff*10000)/10000;if(this.ukupni_koeff > site_const.max_koeff){this.ukupni_koeff = site_const.max_koeff;break;}}this.ukupni_koeff = Math.round(this.ukupni_koeff*100)/100;}}
this.refresh = function()
{this.ulog = 0;this.mt = 0;this.dobitak = 0;this.odabrani_sistemi = null;this.recalcKoef();if(this.parent.brojSistemskih == 0){if(!this.tbxUplata_changing){this.domSistem_th.style.display = 'none';this.domSistem_td.style.display = 'none';this.domKoeff_th.style.display = '';this.domKoeff_td.style.display = '';this.domDobitak_th.innerHTML = 'Dobitak:';}this.mt = Math.round(this.uplata*(1-site_const.mt)*100)/100;this.ulog = this.uplata - this.mt;this.dobitak = Math.round(this.ukupni_koeff * this.ulog*100)/100;if(this.dobitak > site_const.max_dobitak)this.dobitak = site_const.max_dobitak;this.domKoeff_td.innerHTML = formatCurr(this.ukupni_koeff);}else {if(!this.tbxUplata_changing){this.domSistem_th.style.display = '';this.domSistem_td.style.display = '';this.domKoeff_th.style.display = 'none';this.domKoeff_td.style.display = 'none';this.domDobitak_th.innerHTML = 'Max.dobitak:';}this.odabrani_sistemi = new Array();this.uplata = 0;this.ulog = 0;this.dobitak = 0;var i = -1;var iTo = this.parent.sistemObj.aGrupeKombinacija.length;var tmpKombinacija = null;while(++i<iTo){tmpKombinacija = this.parent.sistemObj.aGrupeKombinacija[i];if(tmpKombinacija.selected){this.odabrani_sistemi.push(tmpKombinacija.broj_izvlacenja);this.uplata+=tmpKombinacija.uplata;this.ulog+=tmpKombinacija.ulog;this.dobitak+=tmpKombinacija.dobitak;}if(this.dobitak > site_const.max_sist_dobitak)this.dobitak = site_const.max_sist_dobitak;}this.mt=(this.uplata-this.ulog);tmpKombinacija = null;if(!this.tbxUplata_changing){this.tbxUplata.setText(this.uplata);var iBrojFikseva = this.parent.aDogadjaji.length - this.parent.brojSistemskih;if(this.odabrani_sistemi.length == 0)this.domSistem_td.innerHTML = 'ništa odabrano';else {var tmpLen = this.odabrani_sistemi.length;if(tmpLen < 10)this.domSistem_td.innerHTML = iBrojFikseva+'+('+this.odabrani_sistemi.join(',')+' od '+this.parent.brojSistemskih+')';else this.domSistem_td.innerHTML = iBrojFikseva+'+('+this.odabrani_sistemi.slice(0,5).join(',')+'...'+this.odabrani_sistemi.slice(tmpLen-3).join(',')+' od '+this.parent.brojSistemskih+')';}}}this.domMt_td.innerHTML = formatCurr(this.mt);this.domUlog_td.innerHTML = formatCurr(this.ulog);this.domDobitak_td.innerHTML = formatCurr(this.dobitak);}
this.getHTML = function()
{var sReturn ='<table id="izracun">';if(this.parent.brojSistemskih == 0)sReturn+=' <tr><th colspan="7">Koeficijent:</th><td id="koeficijent">'+this.domKoeff_td.innerHTML+'</td></tr>';sReturn+=' <tr><th>Uplata:</th><td id="uplata">'+formatCurr(this.uplata)+'</td>';if(site_const.mt != 1){sReturn+='<th>M.T.:</th><td id="mt">'+this.domMt_td.innerHTML+'</td>' +'<th>Ulog:</th><td id="ulog">'+this.domUlog_td.innerHTML+'</td>';}else {sReturn+='<th>&nbsp;</th><td id="mt">&nbsp;</td>' +'<th>&nbsp;</th><td id="ulog">&nbsp;</td>';}sReturn+='<th>'+this.domDobitak_th.innerHTML+'</th>' +'<td id="dobitak">'+this.domDobitak_td.innerHTML+'</td></tr>';if(this.parent.brojSistemskih > 0)sReturn+=' <tr><th>Sistem:</th><td id="sistem" colspan="7">'+this.domSistem_td.innerHTML+'</td></tr>';sReturn+='</table>';return(sReturn);}
this.prepareSend = function()
{var aReturn = new Array();if(this.parent.superprognoza)aReturn.push(2);else aReturn.push(1);aReturn.push('');aReturn.push(this.parent.aDogadjaji.length - this.parent.brojSistemskih);aReturn.push(this.parent.brojSistemskih);if(this.odabrani_sistemi == null)aReturn.push('');else aReturn.push(this.odabrani_sistemi.join(','));if(this.parent.brojSistemskih==0)aReturn.push(1);else aReturn.push(this.parent.sistemObj.ukupno_kombinacija);aReturn.push(this.uplata);aReturn.push(this.mt);aReturn.push(this.ulog);aReturn.push(this.mt);if(this.parent.brojSistemskih>0)aReturn.push('NULL');else aReturn.push(this.ukupni_koeff);aReturn.push(this.dobitak);aReturn.push('');return(aReturn.join('|'));}
this.terminate = function()
{this.domUplata_th  = null;this.domUplata_td  = null;this.domMt_th      = null;this.domMt_td      = null;this.domUlog_th    = null;this.domUlog_td    = null;this.domSistem_th  = null;this.domSistem_td  = null;this.domKoeff_th   = null;this.domKoeff_td   = null;this.domDobitak_th = null;this.domDobitak_td = null;this.tbxUplata.terminate();this.tbxUplata = null;}}
function listic_print()
{var popupWindow = window.open();var popupDoc = popupWindow.document;var sBrojListica = 'nije zadan';if(listic.broj_listica != null)sBrojListica = 'www-'+formatCurr(listic.broj_listica,0);popupDoc.write('<html>');popupDoc.write('<head>');popupDoc.write('  <meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />');popupDoc.write('  <title>'+site_const.sSiteTitle+' - Ispis listića</title>');popupDoc.write('  <link rel="stylesheet" href="/css_print/listic_screen.css" type="text/css" />');popupDoc.write('  <link rel="stylesheet" media="printer" href="/css_print/listic_printer.css" type="text/css" />');popupDoc.write('</head>');popupDoc.write('<body>');popupDoc.write('<div id="printer_icon" onclick="window.print();" title="Ispiši">&nbsp;</div>');popupDoc.write('<img src="/img/print/logo_lijevo.gif" />');popupDoc.write('<p id="header"><b>Broj listića:</b> '+sBrojListica+'</p>');popupDoc.write('<table id="dogadjaji">');var iTo = listic.aDogadjaji.length;var i = 0;var aSlova = new Array('A=', 'B=', 'C=', 'D=', 'E=', 'F=', 'G=', 'H=', 'I=', 'J=', 'K=', 'L=', 'M=', 'N=', 'O=');var iSlovaIndex = 0;do {if(!listic.aDogadjaji[  listic.aDogadjajiOrder[i]  ].sistemski)popupDoc.write(listic.aDogadjaji[  listic.aDogadjajiOrder[i]  ].getHTML(''));else popupDoc.write(listic.aDogadjaji[  listic.aDogadjajiOrder[i]  ].getHTML(aSlova[iSlovaIndex++]));} while(++i<iTo);popupDoc.write('</table>');popupDoc.write(listic.izracunObj.getHTML());if(listic.brojSistemskih>0)popupDoc.write(listic.sistemObj.getHTML());popupDoc.write('<p>Listić pod ovim brojem možete uplatit u svakoj poslovnici kladionice '+site_const.sSiteTitle+'.</p>');popupDoc.write('<p>Koeficijenti su promjenjivi.</p>');popupDoc.write('<p class="footer">'+site_const.sSiteTitle+' – Kladimo se da smo najbolji !!</p>');popupDoc.write('</body>');popupDoc.write('</html>');popupDoc.close();if(!debugMode) {try {pageTracker._trackPageview('/listic_ispis/');} catch(err) {}}}
function setTipova_class(inTopParent, inParentObj, inData)
{var outBuff = output_buffer.buffer;this.grupa_dogadjaja = inParentObj;this.id = inData[0];this.aData = new Array();this.topParent = inTopParent;var tmpTip_ispisa = this.topParent.tip_ispisa;var aPoljeVarijanti = inData[3];var iPoljeVarijantiLength = aPoljeVarijanti.length;var aPoljeVarijantiIndex = new Array();var i=0;do {aPoljeVarijantiIndex[aPoljeVarijanti[i + 0]] = i;i+=8;} while (i < iPoljeVarijantiLength);switch(this.grupa_dogadjaja.sport.id_sporta){case site_const.loto_sportID: var sportLoto = true;break;default: var sportLoto = false;var sportSuperPrognoza = false;}var setTipova_naziv = inData[1].trim();if(setTipova_naziv == '')setTipova_naziv='&nbsp';var tmpDataItem = null, tmpDogadjaj = null;var aPolje_koef_index, aPolje_koef;var tmpDate = this.grupa_dogadjaja.sport.datum;var aDogadjaj_koef = inData[5], aDogadjaj_koef_index = 0;aDogadjaj_koef_index_to = aDogadjaj_koef.length;var iID_dogadjaja = null;var iID_variante = null;var iID_tipa = null;this.domTABLE_ID = 'gd'+this.grupa_dogadjaja.id_grupe+'sd'+this.grupa_dogadjaja.id_seta+'st'+this.id;this.domNapomena_ID = null;outBuff.push('<table id="');outBuff.push(this.domTABLE_ID);outBuff.push('" onclick="ponuda_rezultati.onclick(event);"><colgroup span="2"><col class="coln"><col class="colv"></colgroup><tbody><tr><th class="thn">');outBuff.push(setTipova_naziv);outBuff.push('</th><th>Vrijeme</th>');inTopParent.setovi_tipova[this.domTABLE_ID] = this;this.aTipovi = inData[4];var aTipovi_index = 0;var aTipovi_index_to = this.aTipovi.length;var sBrojDogadjaja;var sClassVrijeme;if(tmpTip_ispisa == 1 && sportLoto){var iColspan = aDogadjaj_koef[0+3].length/2;outBuff.push('<th colspan="');outBuff.push(iColspan);outBuff.push('">Izvučene loptice</th>');}else {do {outBuff.push('<th>');outBuff.push(this.aTipovi[aTipovi_index+1]);outBuff.push('</th>');} while((aTipovi_index+=2)<aTipovi_index_to);}if(tmpTip_ispisa == 1 && !sportLoto)outBuff.push('<th class="threz">Rezultat</th>');aDogadjaj_koef_index = 0;do {iID_dogadjaja = aDogadjaj_koef[aDogadjaj_koef_index+0];iID_variante = aDogadjaj_koef[aDogadjaj_koef_index+1];iPripadnaVarijanta = aPoljeVarijantiIndex[iID_variante];if(iID_dogadjaja < 0){sClassName='tdn_dis';sClassVrijeme = ' class="td_dis"';iID_dogadjaja = Math.abs(iID_dogadjaja);}else {sClassName='tdn';sClassVrijeme = '';}tmpDogadjaj = this.grupa_dogadjaja.dogadjaji[iID_dogadjaja];tmpDate.parseTime(tmpDogadjaj[4]);sGlue = '';sNaziv = '';if(aPoljeVarijanti[iPripadnaVarijanta+1]==1){sNaziv = aPoljeVarijanti[iPripadnaVarijanta+3] + tmpDogadjaj[2] + aPoljeVarijanti[iPripadnaVarijanta+4];sGlue = aPoljeVarijanti[iPripadnaVarijanta+5];}if(aPoljeVarijanti[iPripadnaVarijanta+2]==1)sNaziv += sGlue + aPoljeVarijanti[iPripadnaVarijanta+6] + tmpDogadjaj[3] + aPoljeVarijanti[iPripadnaVarijanta+7];tmpDataItem = {id_dogadjaja:iID_dogadjaja, aDogadjaj_koef:aDogadjaj_koef.slice(aDogadjaj_koef_index, aDogadjaj_koef_index+7), vrijeme:new Date(tmpDate), broj:tmpDogadjaj[1], naziv:sNaziv, koeff:new Array(), domTR:null, domTR_ID:this.domTABLE_ID+'d'+iID_dogadjaja};var arrSlice = aDogadjaj_koef.slice(aDogadjaj_koef_index, aDogadjaj_koef_index+7);var tmpVrijeme = new Date(tmpDate);var tmpKoeffArr = new Array();var tmpDomTR_ID =this.domTABLE_ID+'d'+iID_dogadjaja;if(!sportLoto)sBrojDogadjaja = tmpDataItem.broj;else sBrojDogadjaja = '';outBuff.push('</tr><tr id="');outBuff.push(tmpDataItem.domTR_ID);outBuff.push('"><td class="');outBuff.push(sClassName);outBuff.push('"><a title="Prikaži događaj sa specijalnim igrama" href="#" onClick="return(false);">');outBuff.push(sBrojDogadjaja);outBuff.push(' ');outBuff.push(tmpDataItem.naziv);outBuff.push( '</a></td><td');outBuff.push(sClassVrijeme);outBuff.push('>');outBuff.push(tmpDate.getHRTime());outBuff.push('</td>');aPolje_koef_index = 0;aTipovi_index = 0;if(tmpTip_ispisa == 0){aPolje_koef = aDogadjaj_koef[aDogadjaj_koef_index+7];do {iID_tipa = this.aTipovi[aTipovi_index+0];if(iID_tipa == aPolje_koef[aPolje_koef_index+0]){tmpDataItem.koeff[iID_tipa] = aPolje_koef[aPolje_koef_index+1];if(sportLoto || sportSuperPrognoza){outBuff.push('<td class="tdcoeff">');outBuff.push(formatKoeff(tmpDataItem.koeff[iID_tipa]));outBuff.push('</td>');}else {outBuff.push('<td class="tdcoeff"><a title="Dodaj događaj na listić" href="#" onClick="return(false);" id="td_d');outBuff.push(iID_dogadjaja);outBuff.push('t');outBuff.push(iID_tipa);outBuff.push('">');outBuff.push(formatKoeff(tmpDataItem.koeff[iID_tipa]));outBuff.push('</a></td>');}aPolje_koef_index+=2;}else outBuff.push('<td>&nbsp;</td>');} while((aTipovi_index+=2)<aTipovi_index_to);aDogadjaj_koef_index+=8;}else if(sportLoto){aPolje_koef = aDogadjaj_koef[aDogadjaj_koef_index+3];do {if(this.aTipovi[aTipovi_index + 0] == aPolje_koef[aPolje_koef_index+0]){outBuff.push('<td>');outBuff.push(this.aTipovi[aTipovi_index+1]);outBuff.push('</td>');aPolje_koef_index+=4;}} while((aTipovi_index+=2) < aTipovi_index_to);aDogadjaj_koef_index+=4;}else {aPolje_koef = aDogadjaj_koef[aDogadjaj_koef_index+3];do {iID_tipa = this.aTipovi[aTipovi_index+0];if(iID_tipa == aPolje_koef[aPolje_koef_index+0]){if(aPolje_koef[aPolje_koef_index+2]==1)outBuff.push('<td class="tdwin">K1</td>');else {switch(aPolje_koef[aPolje_koef_index+3]){case -1: if(site_const.ispisRezultata==0)outBuff.push('<td>-</td>');else {outBuff.push('<td>');outBuff.push(formatKoeff(aPolje_koef[aPolje_koef_index+1]));outBuff.push('</td>');}break;case 1: if(site_const.ispisRezultata==0)outBuff.push('<td class="tdwin">+</td>');else {outBuff.push('<td class="tdwin">');outBuff.push(formatKoeff(aPolje_koef[aPolje_koef_index+1]));outBuff.push('</td>');}break;case 0: outBuff.push('<td class="td_dis">&nbsp;</td>');break;}}aPolje_koef_index+=4;}else outBuff.push('<td>&nbsp;</td>');} while((aTipovi_index+=2)<aTipovi_index_to);var sIshod = aDogadjaj_koef[aDogadjaj_koef_index + 2];if(sIshod=='') sIshod = '&nbsp;';outBuff.push('<td');outBuff.push(sClassVrijeme);outBuff.push('>');outBuff.push(sIshod);outBuff.push('</td>');aDogadjaj_koef_index+=4;}this.aData.push(tmpDataItem);} while(aDogadjaj_koef_index < aDogadjaj_koef_index_to);outBuff.push('</tr></table>');if(inData[2] != ''){this.domNapomena_ID = 'napomena_gd'+this.grupa_dogadjaja.id_grupe+'sd'+this.grupa_dogadjaja.id_seta+'st'+this.id;outBuff.push('<div id="');outBuff.push(this.domNapomena_ID);outBuff.push('" class="napomena_d">');outBuff.push(inData[2]);outBuff.push('</div>');}
this.hide_old = function()
{var currentTime = this.grupa_dogadjaja.sport.ponuda.currentTime;this.allHidden = true;for(var i in this.aData){if(this.aData[i].vrijeme < currentTime){if(this.aData[i].domTR==null)this.aData[i].domTR = document.getElementById(this.aData[i].domTR_ID);this.aData[i].domTR.style.display = 'none';}else this.allHidden = false;}if(this.allHidden){var domTABLE = document.getElementById(this.domTABLE_ID);domTABLE.style.display = 'none';domTABLE.style.visibility = 'hidden';if(this.domNapomena_ID!=null){var domNapomena = document.getElementById(this.domNapomena_ID);domNapomena.style.display = 'none';domNapomena.style.visibility = 'hidden';}}return(this.allHidden);}
this.unhide = function()
{for(var i in this.aData)if(this.aData[i].domTR!=null)try {this.aData[i].domTR.style.display = 'table-row';} catch(err) {this.aData[i].domTR.style.display = 'block';};var domTABLE = document.getElementById(this.domTABLE_ID);if(this.allHidden){try {domTABLE.style.display = 'table';} catch(err) {domTABLE.style.display = 'block';};domTABLE.style.visibility = 'visible';if(this.domNapomena_ID!=null){var domNapomena = document.getElementById(this.domNapomena_ID);domNapomena.style.display = 'block';domNapomena.style.visibility = 'visible';}}this.allHidden = false;}
this.terminate = function()
{for(var i in this.aData)this.aData.domTR = null;this.aData = null;this.topParent = null;this.grupa_dogadjaja = null;}}
function ponuda_rezultati_class(inTip_ispisa, inDataSource)
{this.sportovi = null;this.setovi_tipova = null;this.tip_ispisa = inTip_ispisa;this.request = false;this.dataSource = '';this.onload = null;this.past_events = null;this.currentTime = null;center_div.domObj.className = 'ponuda_rezultati';
this.loadData = function(inParams)
{output_buffer.clear();output_buffer.autoFlush = false;this.sportovi = new Array();this.setovi_tipova = new Array();if(!this.request)this.request = mainRequest;this.request.open("GET", this.dataSource, true);this.request.onload = ponuda_rezultati.receiveData;if(this.onload != null)
this.request.onreadystatechange = function()
{if(ponuda_rezultati.request.readyState == 4)ponuda_rezultati.onload();};this.request.send(inParams);}
this.abort = function()
{this.request.abort();return;}
this.receiveData = function()
{try {var dataObj = eval(ponuda_rezultati.request.responseText);} catch(err) {debug('<b>Greška pri parsiranju bloka sa podacima ('+err+')!</b>');debug('ponuda_rezultati.request.responseText='+ponuda_rezultati.request.responseText);ponuda_rezultati.request.abort();return;}switch(dataObj[0]){case 0: ponuda_rezultati.sportovi.push(new sport_class(ponuda_rezultati, dataObj));break;case 1: ponuda_rezultati.sportovi[ponuda_rezultati.sportovi.length-1].dodajGrupuDogadjaja(dataObj);break;}}
this.hide_old = function()
{this.currentTime = null;this.currentTime = getServerTime();if(this.sportovi != null)for(var i in this.sportovi)this.sportovi[i].hide_old();appStatus.setStatus(0);titlebar.icons.unhide_old.show();titlebar.icons.hide_old.hide();}
this.unhide = function()
{if(this.sportovi != null)for(var i in this.sportovi)this.sportovi[i].unhide();appStatus.setStatus(0);titlebar.icons.unhide_old.hide();titlebar.icons.hide_old.show();}
this.onclick = function(inEvent)
{if (!inEvent) var inEvent = window.event;if(inEvent.target)var domTarget = inEvent.target;else if (inEvent.srcElement)var domTarget = inEvent.srcElement;if (domTarget.nodeType == 3)domTarget = targ.parentNode;if(domTarget.nodeName!='A') return;var domTR = domTarget;while(domTR.nodeName!='TR')domTR = domTR.parentNode;var domTable = domTR;while(domTable.nodeName!='TABLE')domTable = domTable.parentNode;var parentSetTipova = this.setovi_tipova[domTable.id];if(domTarget.nodeName=='A'){var sRegExp = /^gd(\d+)sd(\d+)st(\d+)d(\d+)$/;var aID_ovi = sRegExp.exec(domTR.id);if(domTarget.id==''){if(domTable.specijalkaObj) return;var objSpecijalka = new specijalka_class(aID_ovi[4]);objSpecijalka.scanGD(parentSetTipova.grupa_dogadjaja);objSpecijalka.show(inEvent);}else {sRegExp = /^td_d(\d+)t(\d+)$/;aID_ovi.push(sRegExp.exec(domTarget.id)[2]);if(listic.addDogadjaj(parentSetTipova, aID_ovi))if(domTable.specijalkaObj)domTable.specijalkaObj.close();}}}
this.terminate = function()
{if(this.sportovi != null)for(var i in this.sportovi)this.sportovi[i].terminate();this.sportovi=null;if(this.request)this.request.abort();this.request = false;center_div.clear();}}
function sport_class(inParentObj, inData)
{var sDatum = inData[3].toString();this.ponuda = inParentObj;this.id_sporta = inData[2];this.grupe_dogadjaja = new Array();this.datum = new Date();this.datum.parseHRDate(sDatum);this.tip_ispisa = inParentObj.tip_ispisa;this.domLinkovi = null;this.domLinkovi_ID = 'ul'+this.id_sporta+sDatum;this.domH1 = null;this.domH1_ID = 'h1'+this.id_sporta+sDatum;this.title = inData[1].toUpperCase() + ', ' + this.datum.getWeekday().toUpperCase() + ', ' + this.datum.getHRString();output_buffer.append('<a name="a_'+this.domH1_ID+'"></a><h1 id="'+this.domH1_ID+'">'+this.title+'</h1>' +'<div class="grupe_dogadjaja" id="'+this.domLinkovi_ID+'"></div>');
this.dodajGrupuDogadjaja = function(inData)
{var domA  = document.createElement('a');this.grupe_dogadjaja.push(new grupaDogadjaja_class(inParentObj, this, inData, domA));if(this.domLinkovi == null){this.domLinkovi = document.getElementById(this.domLinkovi_ID);this.domH1 = document.getElementById(this.domH1_ID);}domA.innerHTML = inData[1];domA.href = '#gd'+inData[2]+'sd'+inData[3];this.domLinkovi.appendChild(domA);}
this.hide_old = function()
{var allHidden = true;var gdReturn = false;var sDisplay = 'none';for(var i in this.grupe_dogadjaja){gdReturn = this.grupe_dogadjaja[i].hide_old();allHidden = allHidden && gdReturn;}if(!allHidden)sDisplay = 'block';this.domH1.style.display = sDisplay;this.domLinkovi.style.display = sDisplay;}
this.unhide = function()
{for(var i in this.grupe_dogadjaja)this.grupe_dogadjaja[i].unhide();this.domH1.style.display = 'block';this.domLinkovi.style.display = 'block';}
this.terminate = function()
{for(var i in this.grupe_dogadjaja)this.grupe_dogadjaja[i].terminate();this.grupe_dogadjaja = null;this.domLinkovi = null;}}
function grupaDogadjaja_class(inTopParent, inParentObj, inData, inDomLink)
{this.sport = inParentObj;this.topParent = inTopParent;this.id_grupe = inData[2];this.id_seta = inData[3];this.domH2 = null;this.domH2_id = 'gd'+this.id_grupe+'sd'+this.id_seta;this.domNapomena = null;this.domNapomena_id = null;this.domLink = inDomLink;output_buffer.append('<h2 id="'+this.domH2_id+'">' + '<a class="link_sport" href="#a_'+this.sport.domH1_ID+'" title="Skoči na '+this.sport.title+'">&nbsp;</a>' + inData[1].toUpperCase()+'</h2>');this.dogadjaji = new Array();for(var i in inData[5])this.dogadjaji[inData[5][i][0]] = inData[5][i];this.setovi_tipova = new Array();for(var i in inData[6])this.setovi_tipova.push(new setTipova_class(inTopParent, this, inData[6][i]));if(inData[4] != ''){this.domNapomena_id = 'napomena_'+this.domH2_id;output_buffer.append('<div id="'+this.domNapomena_id+'" class="napomena_g">'+inData[4]+'</div>');}else output_buffer.append('<br>');output_buffer.flush();
this.hide_old = function()
{var allHidden = true;var sdReturn = false;if(this.domH2 == null){this.domH2 = document.getElementById(this.domH2_id);if(this.domNapomena_id!=null)this.domNapomena = document.getElementById(this.domNapomena_id);}for(var i in this.setovi_tipova){sdReturn = this.setovi_tipova[i].hide_old();allHidden = allHidden && sdReturn;}if(allHidden){this.domH2.style.display = 'none';this.domH2.style.visibility = 'hidden';if(this.domNapomena!=null){this.domNapomena.style.display = 'none';this.domNapomena.style.visibility = 'hidden';}this.domLink.style.display = 'none';}return(allHidden);}
this.unhide = function()
{for(var i in this.setovi_tipova)this.setovi_tipova[i].unhide();if(this.domH2!=null){this.domH2.style.display = 'block';this.domH2.style.visibility = 'visible';}if(this.domNapomena!=null){this.domNapomena.style.display = 'block';this.domNapomena.style.visibility = 'visible';}this.domLink.style.display = 'inline';}
this.terminate = function()
{for(var i in this.setovi_tipova)this.setovi_tipova[i].terminate();this.setovi_tipova = null;this.dogadjaji = null;this.topParent = null;this.sport = null;this.domH2 = null;this.domNapomena = null;this.domLink = null;}}
function specijalka_class(inDogadjajID)
{this.windowObj = new window_class(wrapper_div, 'Događaj sa specijalnim igrama', true);this.windowObj.parentObj = this;this.windowObj.domContainer.id = 'specijalke';this.dogadjajID = inDogadjajID;this.domTables = new Array();
this.scanGD = function(inGrupaDogadjaja)
{appStatus.setStatus(2);for(var i in inGrupaDogadjaja.setovi_tipova)this.scanST(inGrupaDogadjaja.setovi_tipova[i]);if(inGrupaDogadjaja.domNapomena_id!=null){if(inGrupaDogadjaja.domNapomena==null)inGrupaDogadjaja.domNapomena = document.getElementById(inGrupaDogadjaja.domNapomena_id);var domNapomena = inGrupaDogadjaja.domNapomena.cloneNode(true);domNapomena.id = '';this.windowObj.addContent(domNapomena);}appStatus.setStatus(0);}
this.scanST = function(inSetTipova)
{var aData_index = inSetTipova.aData.length-1;do {if(inSetTipova.aData[aData_index].id_dogadjaja == this.dogadjajID)break;} while(--aData_index>=0)if(aData_index<0) return;var domTable = document.getElementById(inSetTipova.domTABLE_ID).cloneNode(true);var domTRs = domTable.getElementsByTagName('tr');var rowContainer = domTRs[0].parentNode;var i=domTRs.length-1;var tmpTD_ID = inSetTipova.aData[aData_index].domTR_ID;do {if(domTRs[i].id == tmpTD_ID)domTRs[i].getElementsByTagName('td')[0].innerHTML = inSetTipova.aData[aData_index].naziv;else rowContainer.removeChild(domTRs[i]);} while(--i>0);this.domTables.push(domTable);this.windowObj.addContent(domTable);if(inSetTipova.domNapomena_ID!=null){var domNapomena = document.getElementById(inSetTipova.domNapomena_ID).cloneNode(true);domNapomena.id = '';this.windowObj.addContent(domNapomena);}return;}
this.show = function(inEvent)
{var innerHeight = document.body.clientHeight;var domContainer = this.windowObj.domContainer;var maxHeight = innerHeight-35;var winTop = inEvent.screenY-200;if(winTop < 70) winTop = 70;center_div.showOverlay();this.windowObj.queryUnload = this.queryUnload;this.windowObj.open(100,100,650,5);var winHeight = domContainer.scrollHeight;winHeight = domContainer.scrollHeight+5;if(winHeight > maxHeight-80)winHeight = maxHeight-80;if((winTop+winHeight) > maxHeight)winTop = maxHeight-winHeight;domContainer.style.height = winHeight+'px';this.windowObj.domObj.style.top = winTop+'px';}
this.queryUnload = function()
{this.terminate();center_div.hideOverlay();return(true);}
this.close = function()
{this.windowObj.close();this.terminate();}
this.terminate = function()
{for(var i in this.domTables)this.domTables[i] = null;this.domTables = null;this.windowObj = null;}}
function menu_loader_class(inDataSource)
{this.reloadTimeout = site_const.menuRefreshRate;this.reloadTimerID = null;this.menuRequest = false;this.dataSource = inDataSource;this.version = null;this.domZadnja_promjena_ponude = document.getElementById('zadnja_promjena_ponude');
this.loadData = function()
{if(!this.menuRequest){this.menuRequest = createHTTPRequest();}this.menuRequest.open("GET", this.dataSource+'?verzija='+this.version, true);try { this.menuRequest.onload = this.receiveData; }catch(error){
this.menuRequest.onreadystatechange = function()
{if(menu_loader.menuRequest.readyState == 4)menu_loader.receiveData();}}this.menuRequest.send(null);}
this.receiveData = function()
{if(menu_loader.menuRequest.status != 404){setServerTime(menu_loader.menuRequest.getResponseHeader("ServerTime"));var tmpDatum = new Date();tmpDatum.parseHRDate(menu_loader.menuRequest.getResponseHeader('vrijeme'));menu_loader.domZadnja_promjena_ponude.innerHTML = 'Zadnja promjena<br>ponude:<br>' + tmpDatum.getHRString(false) + '<br>' + tmpDatum.getHRTime(true);if(menu_loader.version != menu_loader.menuRequest.getResponseHeader("verzija")){menu_loader.version = menu_loader.menuRequest.getResponseHeader("verzija");menuData = eval(menu_loader.menuRequest.responseText);var j = 0;var aMenuData = new Array();for(var i=0; i<menuData.length; i+=4)aMenuData[j++] = menuLoader_item({level:-1}, menuData.slice(i,i+4));aMenuData[j++] = ['LOTO','LOTO',null,null, [['IZVLAČENJA','LOTO - IZVLAČENJA',10,null,null], ['PONUDA','LOTO - PONUDA',11,null,null], ['REZULTATI','LOTO - REZULTATI',12,null,null]]];if(leftMenu == null)leftMenu = new menu_class();leftMenu.load(aMenuData);aMenuData = null;}menu_loader.reloadTimerID = window.setTimeout("menu_loader.loadData()", menu_loader.reloadTimeout);appStatus.setStatus(0);}}}
function menuLoader_item(inParentData, inMenuData)
{var myData = {level:inParentData.level+1, title:'', datum:null, page_title:'', page_type:'', rpc_data:null, submenu:null };switch(myData.level){case 0: myData.title = inMenuData[0];myData.page_title = myData.title;myData.page_type  = inMenuData[1];myData.rpc_data = null;break;case 1: var tmpDatum = new Date();tmpDatum.parseHRDate(inMenuData[0].toString());myData.title =  tmpDatum.getHRString(true) + ' ' + tmpDatum.getWeekday(true);myData.page_title = inParentData.title + ', ' + tmpDatum.getWeekday(false) + ' ' + tmpDatum.getHRString(false);myData.page_type  = inParentData.page_type;myData.rpc_data = 'd='+inMenuData[0].toString();break;case 2: myData.title = inMenuData[0];myData.page_title = inParentData.page_title + ', ' + myData.title;myData.page_type  = inParentData.page_type;myData.rpc_data = inParentData.rpc_data+'&s='+inMenuData[1];break;case 3: myData.title = inMenuData[0];myData.page_title = inParentData.page_title + ' - ' + myData.title;myData.page_type  = inParentData.page_type;myData.rpc_data = inParentData.rpc_data+'&gd='+inMenuData[1]+'&sd='+inMenuData[2];break;};if(inMenuData[3] != null){myData.submenu = new Array();var j = 0;var len = inMenuData[3].length;for(var i=0; i<len; i+=4)myData.submenu[j++] = menuLoader_item(myData, inMenuData[3].slice(i,i+4));};if(myData.level == 0){myData.page_type = null;};return(Array(myData.title, myData.page_title.ent2txt(), myData.page_type, myData.rpc_data, myData.submenu));}
function menu_class()
{this.domObj  = mnu_left;this.container = this.domObj;this.activeItem = null;this.level = 0;this.items = Array();this.hideTimerID = null;this.timerID = globalTimer.add(null, 1000, false);
this.showSubmenu = function(inMenuItem)
{if(this.activeItem != null && this.activeItem != inMenuItem)this.activeItem.submenu.hide();this.activeItem = inMenuItem;this.activeItem.submenu.show();}
this.hideSubmenu = function()
{if(this.activeItem != null){this.activeItem.submenu.hide();this.activeItem = null;}}
this.autohideSubmenu = function()
{if(this.activeItem == null) return;if(this.activeItem.submenu == null) return;if(this.activeItem.submenu.activeItem == null) return;this.activeItem.submenu.hideSubmenu();}
this.load = function(inMenuData)
{this.domObj.style.display = 'none';this.terminate();this.items = new Array();this.domObj.innerHTML = '';var j = 0;for(var i=0; i<inMenuData.length; i++)this.items[j++] = new menu_item_class(this, inMenuData[i]);this.domObj.style.display = 'block';}
this.terminate = function()
{for(var i in this.items)this.items[i].terminate();this.items = null;this.activeItem = null;}}
function sub_menu_class(inParentObj, inMenuData, inRootParent, inMenuDetails)
{this.menuData = inMenuData;this.activeItem = null;this.parentObj = inParentObj;this.level = this.parentObj.parentObj.level + 1;this.rootParent = inRootParent;this.domObj = null;this.buttonUp = null;this.buttonDown = null;this.scrollTop = 0;this.scrollBottom = null;this.scrollCount = null;this.scrollDirection = 1;this.absParent = null;this.clientHeight = null;this.offsetLeft = null;this.visible = false;this.loaded = false;this.menuDetails = inMenuDetails || false;
this.show = function()
{if(!this.loaded)this.load();this.domObj.style.display = 'block';this.visible = true;if(!this.menuDetails){this.absParent = findAbsParent(this.parentObj.domObj);if(this.offsetLeft != this.absParent.offsetLeft){this.offsetLeft = this.absParent.offsetLeft;this.domObj.style.left = (this.offsetLeft + this.parentObj.domObj.offsetWidth  - 18) + 'px';this.domObj.getElementsByTagName('td')[2].style.width = this.domObj.offsetWidth-29;}if(this.clientHeight != document.body.clientHeight){this.clientHeight = document.body.clientHeight;var objTop = (this.absParent.offsetTop  + this.parentObj.domObj.offsetHeight - 35);if(this.buttonUp != null){this.buttonUp.ownerObj = null;this.buttonUp.onmousedown = null;this.buttonUp = null;this.buttonDown.ownerObj = null;this.buttonDown.onmousedown = null;this.buttonDown = null;this.container.removeChild(this.container.firstChild);this.container.removeChild(this.container.lastChild);}var objHeight = this.items.length*15+25;if(objHeight > this.clientHeight){this.scrollCount = Math.floor((this.clientHeight - 25)/15)-2;if(this.scrollBottom != null)for(var i=this.scrollBottom+1; i<this.scrollCount; i++)this.items[i].unhide();this.scrollBottom = this.scrollCount-1;for(var i=this.scrollBottom+1; i< this.items.length; i++)this.items[i].hide();this.buttonUp = document.createElement('a');this.buttonUp.ownerObj = this;this.buttonUp.href = '#';var liUp = document.createElement('li');liUp.appendChild(this.buttonUp);liUp.className = 'tree_arrow_up';this.buttonDown = document.createElement('a');this.buttonDown.ownerObj = this;this.buttonDown.href = '#';var liDown = document.createElement('li');liDown.appendChild(this.buttonDown);liDown.className = 'tree_arrow_down';this.container.appendChild(liDown);this.container.insertBefore(liUp, this.container.firstChild);
this.buttonDown.onmousedown = function() { this.ownerObj.onScrollClick(1); return(false);}
this.buttonUp.onmousedown = function() { this.ownerObj.onScrollClick(0); return(false);}
objHeight = (this.scrollCount+2)*15+25;}else if(this.scrollBottom!=null){for(var i=0; i< this.items.length; i++)this.items[i].unhide();this.scrollTop = 0;this.scrollBottom = null;this.scrollCount = null;}if((objTop + objHeight) > this.clientHeight)objTop = this.clientHeight - objHeight;this.domObj.style.top = objTop + 'px';}}};
this.scrollDown = function()
{if(this.scrollBottom == this.items.length-1) return(false);this.items[this.scrollTop++].hide();this.items[++this.scrollBottom].unhide();return(true);}
this.scrollUp = function()
{if(this.scrollTop == 0) return(false);this.items[--this.scrollTop].unhide();this.items[this.scrollBottom--].hide();return(true);}
this.onScrollClick = function(inDirection)
{this.scrollDirection = inDirection;switch(inDirection){case(0): this.scrollUp();break;case(1): this.scrollDown();break;}globalTimer.set_Listener(this.rootParent.timerID, this);globalTimer.set_Interval(this.rootParent.timerID, 500);globalTimer.start(this.rootParent.timerID);eventCenter.register('mouseup', this);}
this.timerTimeout = function()
{switch(this.scrollDirection){case(0): if(!this.scrollUp()) return;break;case(1): if(!this.scrollDown()) return;break;}globalTimer.set_Interval(this.rootParent.timerID, 100);globalTimer.start(this.rootParent.timerID);}
this.handle_mouseUp = function()
{globalTimer.stop(this.rootParent.timerID);eventCenter.unregister('mouseup', this);}
this.load = function()
{this.loaded = true;if(this.menuDetails){this.domObj    = this.parentObj.domObj.getElementsByTagName('div')[2];this.container = this.domObj.getElementsByTagName('ul')[0];}else {this.domObj = submnu_template.cloneNode(true);this.domObj.id = '';document.body.appendChild(this.domObj);this.domObj.rootParent = this.rootParent;this.container = this.domObj.getElementsByTagName('ul')[0];
this.domObj.onmouseout = function()
{if(this.rootParent.hideTimerID != null)window.clearTimeout(this.rootParent.hideTimerID);this.rootParent.hideTimerID = window.setTimeout("leftMenu.autohideSubmenu()", 1000);};
this.domObj.onmouseover = function()
{if(this.rootParent.hideTimerID != null){window.clearTimeout(this.rootParent.hideTimerID);this.rootParent.hideTimerID = null;}}}this.items = new Array();var j = 0;for(var i=0; i<this.menuData.length; i++)this.items[j++] = new sub_menu_item_class(this, this.menuData[i], inRootParent);this.menuData = null;}
this.hide = function()
{this.hideSubmenu();this.domObj.style.display = 'none';this.visible = false;globalTimer.stop(this.rootParent.timerID);if(this.buttonUp != null){while(this.scrollTop-->0){this.items[this.scrollTop].unhide();}this.scrollTop=0;while((this.scrollBottom+1) > this.scrollCount){this.items[this.scrollBottom--].hide();}}};
this.showSubmenu = function(inMenuItem)
{if(this.rootParent.hideTimerID != null)window.clearTimeout(this.rootParent.hideTimerID);this.rootParent.hideTimerID = null;if(this.activeItem != null && this.activeItem != inMenuItem){this.activeItem.submenu.hide();this.activeItem.objA.parentNode.className = '';}this.activeItem = inMenuItem;this.activeItem.submenu.show();this.activeItem.objA.parentNode.className = 'submnu_links_active';}
this.hideSubmenu = function()
{if(this.rootParent.hideTimerID != null)window.clearTimeout(this.rootParent.hideTimerID);this.rootParent.hideTimerID = null;if(this.activeItem != null){this.activeItem.submenu.hide();this.activeItem.objA.parentNode.className = '';this.activeItem = null;}}
this.terminate = function()
{for(var i in this.items){this.items[i].terminate();this.items[i] = null;}if(this.buttonUp != null){this.buttonUp.ownerObj = null;this.buttonUp.onmousedown = null;this.buttonUp = null;this.buttonDown.ownerObj = null;this.buttonDown.onmousedown = null;this.buttonDown = null;}if(this.loaded && !this.menuDetails)document.body.removeChild(this.domObj);this.items = null;this.activeItem = null;this.parentObj = null;this.rootParent = null;this.domObj = null;this.container = null;this.menuData = null;this.menuDetails = null;this.absParent = null;}}
function menu_item_class(inParentObj, inMenuData)
{this.parentObj = inParentObj;this.submenu = null;this.domObj = mnu_item_template.cloneNode(true);this.domObj.id = '';this.domObj.rootParent = inParentObj;
this.domObj.onmouseout = function()
{if(this.rootParent.hideTimerID != null)window.clearTimeout(this.rootParent.hideTimerID);this.rootParent.hideTimerID = window.setTimeout("leftMenu.autohideSubmenu()", 1000);};this.parentObj.container.appendChild(this.domObj);this.objA = this.domObj.getElementsByTagName('a')[0];this.objA.href = '#';this.objA.title = inMenuData[1];this.objA.innerHTML  = inMenuData[0];
this.makeRPC = function()
{this.rootParent.autohideSubmenu();controler.loadPage(rpc_data.page_type, this.page_title, this.rpc_data);};if(inMenuData[2] != null){this.rpc_data = inMenuData[3];this.page_title = inMenuData[1];this.page_type = inMenuData[2];
this.objA.onclick = function()
{this.mnuObj.makeRPC();return(false);};}else if(inMenuData[4] != null){this.submenu = new sub_menu_class(this, inMenuData[4], inParentObj, true);this.objA.mnuObj = this;
this.objA.onclick = function()
{if(this.mnuObj.submenu.visible)this.mnuObj.parentObj.hideSubmenu(this.mnuObj);else this.mnuObj.parentObj.showSubmenu(this.mnuObj);return(false);};}
this.terminate = function()
{if(this.submenu != null)this.submenu.terminate();this.objA.onclick = null;this.objA.mnuObj = null;this.parentObj.container.removeChild(this.domObj);this.domObj.rootParent = null;this.domObj.onmouseout = null;this.submenu = null;this.parentObj = null;this.domObj = null;this.objA = null;}}
function sub_menu_item_class(inParentObj, inMenuData, inRootParent)
{this.parentObj = inParentObj;this.rootParent = inRootParent;this.submenu = null;this.objA = document.createElement('a');this.objA.href = "#";this.objA.title     = inMenuData[1];this.objA.innerHTML = inMenuData[0];this.objA.mnuObj = this;this.domObj = document.createElement("li");this.domObj.appendChild(this.objA);this.parentObj.container.appendChild(this.domObj);if(inMenuData[2] != null){this.rpc_data = inMenuData[3];this.page_title = inMenuData[1];this.page_type = inMenuData[2];
this.objA.onclick = function()
{this.mnuObj.makeRPC();return(false);};}
this.makeRPC = function()
{this.rootParent.autohideSubmenu();controler.loadPage(this.page_type, this.page_title, this.rpc_data);};if(inMenuData[4] != null){this.submenu = new sub_menu_class(this, inMenuData[4], inRootParent);
this.objA.onmouseover = function()
{this.mnuObj.parentObj.showSubmenu(this.mnuObj);};}else {
this.objA.onmouseover = function()
{this.mnuObj.parentObj.hideSubmenu();};}
this.hide = function()
{this.domObj.style.display = 'none';};
this.unhide = function()
{this.domObj.style.display = 'block';};
this.terminate = function()
{if(this.submenu != null)this.submenu.terminate();this.objA.onmouseover = null;this.objA.mnuObj = null;this.objA.onclick = null;this.parentObj.container.removeChild(this.domObj);delete this.domObj;delete this.parentObj;delete this.objA;delete this.rootParent;delete this.submenu;}}
function loading_icon_class(inParentObj)
{this.parentObj = inParentObj;this.domObj = document.createElement('img');this.domObj.src = '/img/loading.gif';this.domObj.title = 'loading...';this.domObj.style.width = '16px';this.domObj.style.Height = '16px';this.domObj.style.padding = '5px';this.parentObj.container.appendChild(this.domObj);
this.terminate = function()
{this.parentObj.container.removeChild(this.domObj);delete this.parentObj;}}
function htmlLoader_class(inInstaceName)
{this.onload = null;this.URL = null;this.loaded = false;this.aborted = false;this.timeout = 500;this.timeoutID = null;this.contentDocument = null;this.instanceName = inInstaceName;this.watchDogMaxCount = 10;this.iframeObj = createIframe(inInstaceName);
this.open = function(inURL)
{this.setLocation('about:blank');this.receiveCounter = 0;this.watchDogCounter = 0;this.nextChunkSize = this.headerChunkSize;this.aborted = false;output_buffer.clear();this.URL = inURL;this.loaded = false;}
this.setLocation = function(inURL)
{var tmpContentDocument = getContentDocument(this.iframeObj);try { this.contentDocument.body.innerHTML = ''; }catch(err){}try {if(!tmpContentDocument.location){tmpContentDocument.location = inURL;}else {tmpContentDocument.location.replace(inURL);}}catch(err){this.iframeObj.src = inURL;}}
this.loadData = function(inData)
{if(this.URL==''){this.URL = inData;inData = '';}if(inData)inData = '?'+inData;else inData = '';this.setLocation(this.URL+inData);this.timeoutID = window.setTimeout(this.instanceName+'.receive();', 1000);}
this.receive = function()
{if(this.aborted) return;if(this.receiveCounter == 0)this.contentDocument = getContentDocument(this.iframeObj);var responseTextLength = this.contentDocument.body.innerHTML.length;if(responseTextLength > this.receiveCounter){center_div.domObj.innerHTML = unescape(this.contentDocument.body.innerHTML);this.receiveCounter = responseTextLength;this.watchDogCounter = 0;}else this.watchDogCounter++;if(!this.loaded && this.watchDogCounter < this.watchDogMaxCount){this.timeoutID = window.setTimeout(this.instanceName+'.receive();', this.timeout);}else {if(this.onload != null)try { this.onload(); } catch(err) { debug(err); }this.URL = null;}}
this.abort = function()
{this.aborted = true;this.setLocation('about:blank');if(this.timeoutID != null)window.clearTimeout(this.timeoutID);this.URL = null;this.loaded = false;return;}
this.finishLoad = function()
{if(this.timeoutID != null)window.clearTimeout(this.timeoutID);if(this.URL == null)return;this.watchDogCounter = this.watchDogMaxCount;this.loaded = true;this.receive();}
this.terminate = function()
{this.contentDocument = null;return;}}
function createHTTPRequest()
{/*@cc_on @*/ /*@if (@_jscript_version >= 5)try {return(new ActiveXObject("Msxml2.XMLHTTP"));}catch (e){try {return(new ActiveXObject("Microsoft.XMLHTTP"));}catch (E){return(false);}}@end @*/ try {return(new XMLHttpRequest());}catch (e){return(false);}try {return(window.createRequest());}catch (e){return(false);}}
function iframeRequest(inInstaceName)
{this.responseText = '';this.URL = null;this.method = null;this.async = true;this.readyState = 0;this.aborted = false;this.onload = null;this.onreadystatechange = null;this.timeout = 500;this.timeoutID = null;this.instanceName = inInstaceName;this.iframeObj = createIframe(inInstaceName);this.headerChunkSize = 8;this.nextChunkSize = null;this.expectedChunk = null;this.receiveCounter = null;
this.open = function(inMethod, inURL, inAsync)
{this.URL = inURL;this.setLocation('about:blank');this.method = inMethod;this.inAsync = inAsync;this.readyState = 1;if(this.onreadystatechange != null)try {this.onreadystatechange(); } catch(err) {}}
this.setLocation = function(inURL)
{var tmpContentDocument = getContentDocument(this.iframeObj);try { this.contentDocument.body.innerHTML = ''; }catch(err){}try {if(!tmpContentDocument.location){tmpContentDocument.location = inURL;}else {tmpContentDocument.location.replace(inURL);}}catch(err){this.iframeObj.src = inURL;}}
this.send = function(inData)
{this.receiveCounter = 0;this.nextChunkSize = this.headerChunkSize;this.expectedChunk = 0;this.aborted = false;if(inData)inData = '?'+inData;else inData = '';this.contentDocument = getContentDocument(this.iframeObj);this.setLocation(this.URL+inData);if(debugMode)debug('request URL='+this.URL+inData);this.readyState = 2;if(this.onreadystatechange != null)try {this.onreadystatechange(); } catch(err) {}this.timeoutID = window.setTimeout(this.instanceName+'.receive();', this.timeout);}
this.receive = function()
{if(this.aborted) return;if(this.receiveCounter == 0)this.contentDocument = getContentDocument(this.iframeObj);var responseTextLength = this.contentDocument.body.innerHTML.length;var dataReceived = false;if(responseTextLength >= (this.receiveCounter + this.nextChunkSize)){if(this.expectedChunk == 1){try {this.responseText = this.contentDocument.body.innerHTML.substr(this.receiveCounter, this.nextChunkSize);this.receiveCounter += this.nextChunkSize;this.nextChunkSize = this.headerChunkSize;this.expectedChunk = 0;dataReceived = true;}catch(inError){debug('<b>Error parsing Data Chunk ('+inError+')!</b>');debug('this.nextChunkSize='+this.nextChunkSize+'; this.receiveCounter='+this.receiveCounter);debug('this.contentDocument.body.innerHTML='+this.contentDocument.body.innerHTML);this.abort();return;}}if(responseTextLength >= (this.receiveCounter + this.nextChunkSize)){try {var chunkSize = eval(this.contentDocument.body.innerHTML.substr(this.receiveCounter, this.nextChunkSize))-10000000;this.receiveCounter += this.nextChunkSize;this.nextChunkSize = chunkSize;this.expectedChunk = 1;if(this.nextChunkSize < 0){debug('<b>Chunk size error!</b>');debug('this.nextChunkSize='+this.nextChunkSize);debug('this.receiveCounter='+this.receiveCounter);debug('responseTextLength='+responseTextLength);this.abort();return;}} catch(inError) {debug('<b>Error parsing Header Chunk ('+inError+')!</b>');debug('this.nextChunkSize='+this.nextChunkSize+'; this.receiveCounter='+this.receiveCounter);debug('this.contentDocument.body.innerHTML.substr(this.receiveCounter, this.nextChunkSize)='+this.contentDocument.body.innerHTML.substr(this.receiveCounter, this.nextChunkSize));debug('this.contentDocument.body.innerHTML='+this.contentDocument.body.innerHTML);this.abort();return;}}}if(this.nextChunkSize == 0){this.readyState = 4;if(this.onreadystatechange != null)try {this.onreadystatechange(); } catch(err) {}this.timeoutID = null;this.contentDocument.body.innerHTML = '';}else {if(dataReceived)if(this.readyState != 3){this.readyState = 3;if(this.onreadystatechange != null)try {this.onreadystatechange(); } catch(err) {}}if(responseTextLength >= (this.receiveCounter + this.nextChunkSize)){this.timeoutID = window.setTimeout(this.instanceName+'.receive();', 10);}else this.timeoutID = window.setTimeout(this.instanceName+'.receive();', this.timeout);}if(dataReceived)if(this.onload != null)try { this.onload(); } catch(err) { throw(err); }}
this.abort = function()
{this.aborted = true;this.setLocation('about:blank');if(this.timeoutID != null)window.clearTimeout(this.timeoutID);this.timeoutID = null;this.readyState = 0;if(this.onreadystatechange != null)try {this.onreadystatechange(); } catch(err) {}}}
function getContentDocument(inIFrameObj)
{if (inIFrameObj.contentDocument){return(inIFrameObj.contentDocument);}else if (inIFrameObj.contentWindow){return(inIFrameObj.contentWindow.document);}else if (inIFrameObj.document){return(inIFrameObj.document);}else {return(null);}}
function createIframe(inIFrameID)
{var iframeObj = null;var iFrameID = inIFrameID;var divID = inIFrameID+'_div';var iframeStyle = 'border-width:0;height:0;width:0;visibility:hidden;';var divStyle = 'position:absolute;top:0;left:0;width:0;height:0;overflow:hidden;';if(document.getElementById(iFrameID))return(document.getElementById(iFrameID));try {var tmpFrame = document.createElement("iframe");tmpFrame.setAttribute("id", iFrameID);tmpFrame.setAttribute("name", iFrameID);tmpFrame.setAttribute("style", iframeStyle);var tmpDiv = document.createElement("div");tmpDiv.setAttribute("id", divID);tmpDiv.setAttribute("style", divStyle);tmpDiv.appendChild(tmpFrame);document.body.appendChild(tmpDiv);if (typeof document.frames != "undefined")iframeObj = document.frames[iFrameID];if (!iframeObj || typeof iframeObj.nodeType == "undefined")iframeObj = document.getElementById(iFrameID);}catch (e){var iframeHTML = '<iframe id="'+iFrameID+'" name="'+iFrameID+'" style="+iframeStyle+"><\/iframe>';if (!document.getElementById(divID)){tmpDiv = document.createElement("div");tmpDiv.setAttribute('id', divID);tmpDiv.setAttribute('style', divStyle);tmpDiv.innerHTML = iframeHTML;document.getElementsByTagName('DIV')[0].appendChild(tmpDiv);}else {document.getElementById(divID).innerHTML = iframeHTML;};iframeObj = document.getElementById(iFrameID);}return iframeObj;}
function ttx_class(inWindowType, inActivePage, inActiveSubpage)
{this.refreshTimeout = site_const.ttxRefreshRate;this.refreshTimerID = null;this.refreshCounter = 0;this.request = null;this.dataSource = '/rpc/teletext.asp';this.domFullscreen = null;this.buttonContainer=null;this.checkingVersion=false;this.window_type = inWindowType;switch(this.window_type){case 0: this.scrollMaxCount = 9;this.scrollCount = 7;break;case 1: this.scrollMaxCount = 9;this.scrollCount = 7;break;case 2: this.scrollMaxCount = 9;this.scrollCount = 7;break;}this.buttonUp = null;this.buttonDown = null;this.scrollTop = 0;this.scrollBottom = null;this.scrollDirection = 1;eventCenter.register('keydown', this);if(!inActivePage)this.activePage = 0;else this.activePage = inActivePage - site_const.ttxStartPage;if(this.activePage < 0)this.activePage = 0;if(!inActiveSubpage)this.activeSubPage = 0;else this.activeSubPage = inActiveSubpage-1;this.domLoading = document.createElement('img');this.domLoading.src = '/img/teletext/tx_loading.gif';var sTemplate =  '<div id="ttx_fullscreen">&nbsp;</div>' +'<div id="ttx_banner">Teletext OnLine omogućuje Vam kladionica <a href="http:/'+'/'+site_const.sSiteURL+'/" title="Posjetite naše web stranice" onclick="openNewWindow(\'http:/'+'/'+site_const.sSiteURL+'\',\''+site_const.sSiteTitle+'\');return(false);" target="_blank">'+site_const.sSiteTitle+'</a></div>' +'<div id="ttx_pages"><ul></ul></div>' +'<div id="ttx_subpages"><ul></ul></div>' +'<div id="ttx_picture"><img src="/img/teletext/tx_loading.gif" /></div>';switch(this.window_type){case 0: this.trackerURL = '/teletext/windowed/';this.windowObj = new window_class(wrapper_div, 'Teletext', false, false, true, true);this.windowObj.parentObj = this;this.windowObj.domContainer.id = 'ttx';this.windowObj.queryUnload = this.queryUnload;this.windowObj.addContent(sTemplate);break;case 1: this.trackerURL = '/teletext/fullscreen/';document.write(sTemplate);break;case 2: this.trackerURL = '/teletext/detached/';document.write(sTemplate);break;}this.ttxPages = new Array();
this.loadData = function(inPageIndex, inSubpageIndex)
{if(this.refreshTimerID != null)window.clearTimeout(this.refreshTimerID);this.refreshTimerID = null;if(this.activePage != null && this.activePage != inPageIndex)this.ttxPages[this.activePage].deactivate();this.activePage = inPageIndex;if(this.request == null)this.request = createHTTPRequest();else if(this.request.readyState != 4)this.request.abort();this.request.open("GET", this.dataSource + '?activePage='+this.ttxPages[this.activePage].pageNo+'&activeSubpage='+(inSubpageIndex+1), true);try { this.request.onload = this.receiveData; }catch(error){
this.request.onreadystatechange = function()
{if(ttx.request.readyState == 4)ttx.receiveData();}}this.request.send(null);}
this.receiveData = function()
{if(ttx.request.status != 404){ttx.ttxPages[ttx.activePage].loadData(ttx.request.getResponseHeader("subpagesCount"), ttx.request.getResponseHeader("imageVersion"));ttx.checkingVersion=false;}}
this.queryUnload = function()
{this.terminate();if(this.window_type == 0)center_div.hideOverlay();return(true);}
this.maximize = function()
{this.showFullscreen();}
this.detach = function()
{this.showDetached();}
this.show = function()
{switch(this.window_type){case 0: center_div.showOverlay();this.windowObj.open(100,150,520,361);this.windowObj.hideScrollbar();this.buttonContainer = this.windowObj.domContainer.getElementsByTagName('ul')[0];this.domImage = this.windowObj.domContainer.getElementsByTagName('img')[0];this.domFullscreen = this.windowObj.domContainer.getElementsByTagName('div')[0];this.domFullscreen.parentObj = this;this.domFullscreen.title = 'Prikaži teletext preko cijelog ekrana';
this.domFullscreen.onclick = function() { this.parentObj.showFullscreen(); };
break;case 1: this.buttonContainer = document.getElementsByTagName('ul')[0];this.domImage = document.getElementsByTagName('img')[0];this.domFullscreen = document.getElementsByTagName('div')[0];this.domFullscreen.parentObj = this;this.domFullscreen.title = 'Zatvori teletext preko cijelog ekrana';
this.domFullscreen.onclick = function() { this.parentObj.terminate(); };
this.domImage.style.height = (document.body.clientHeight - 40) + 'px';break;case 2: this.buttonContainer = document.getElementsByTagName('ul')[0];this.domImage = document.getElementsByTagName('img')[0];this.domFullscreen = document.getElementsByTagName('div')[0];this.domFullscreen.title = 'Posjetite naše web stranice';
this.domFullscreen.onclick = function() { openNewWindow('http:/'+'/'+site_const.sSiteURL,site_const.sSiteTitle); };
break;}var j=0;for(var i = site_const.ttxStartPage; i <= site_const.ttxEndPage; i++, j++)this.ttxPages.push(new ttx_page_class(this, this.buttonContainer, j, i));this.setupScroll();this.ttxPages[this.activePage].activate(this.activeSubPage);}
this.setupScroll = function()
{if(this.ttxPages.length > this.scrollMaxCount){this.scrollBottom = this.scrollCount-1;var aLeft = document.createElement('a');aLeft.href = "#";aLeft.innerHTML = '&laquo;';
aLeft.onclick = function() { return(false); }
this.buttonLeft = document.createElement('li');this.buttonLeft.appendChild(aLeft);var aRight = document.createElement('a');aRight.href = "#";aRight.innerHTML = '&raquo;';
aRight.onclick = function() { return(false); }
this.buttonRight = document.createElement('li');this.buttonRight.appendChild(aRight);this.buttonLeft.ownerObj = this;this.buttonRight.ownerObj = this;var aDown = document.createElement('a');aDown.innerHTML = '&nbsp;';aDown.href = '#';this.buttonContainer.appendChild(this.buttonRight);this.buttonContainer.insertBefore(this.buttonLeft, this.buttonContainer.firstChild);
this.buttonRight.onmousedown = function() { this.ownerObj.onScrollClick(1); return(false);}
this.buttonLeft.onmousedown  = function() { this.ownerObj.onScrollClick(0); return(false);}
}else this.scrollBottom = this.ttxPages.length-1;for(var i=0; i<=this.scrollBottom; i++)this.ttxPages[i].unhide();}
this.showFullscreen = function()
{var sWinSize='';try {sWinSize = 'screenX=0,screenY=0,height='+(screen.height)+',width='+(screen.width)+',';} catch(err) {};var sDebugMode = '';if(debugMode)sDebugMode = '_debugMode';var child_prozor = window.open('/teletext/fullscreen/'+this.ttxPages[this.activePage].pageNo+'_'+(this.activeSubPage+1)+sDebugMode, '_blank', sWinSize+'fullscreen=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');parent.blur();child_prozor.window.focus();}
this.showDetached = function()
{var sDebugMode = '';var iWidth = 520, iHeight=390;var LeftPosition = (screen.width)?(screen.width-iWidth)/2:100;var TopPosition = (screen.height)?(screen.height-iHeight)/2:100;if(debugMode)sDebugMode = '_debugMode';var child_prozor = window.open('/teletext/detached/'+this.ttxPages[this.activePage].pageNo+'_'+(this.activeSubPage+1)+sDebugMode, '_blank', 'height='+iHeight+',width='+iWidth+',fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top='+TopPosition+',left='+LeftPosition);parent.blur();child_prozor.window.focus();}
this.loadImage = function(inPageIndex, inSubpageIndex, inImageVersion)
{this.activePage    = inPageIndex;this.activeSubPage = inSubpageIndex;this.domImage.src = '/img/tx/' + this.ttxPages[inPageIndex].pageNo + '-' + (inSubpageIndex+1) + '.png?v=' + inImageVersion;if(this.refreshTimerID == null)this.refreshTimerID = window.setTimeout("ttx.refresh()", this.refreshTimeout);try {if(!debugMode && !this.checkingVersion)pageTracker._trackPageview(this.trackerURL+this.ttxPages[inPageIndex].pageNo+'_'+(inSubpageIndex+1));} catch(err) {};}
this.showLoadingImage = function(inShowPreviousImage)
{if(inShowPreviousImage)this.domImage.src = this.domImage.src;else this.domImage.src = '/img/teletext/tx_loading.gif';}
this.refresh = function()
{this.refreshTimerID = null;this.checkingVersion=true;this.loadData(this.activePage, this.activeSubPage);if(this.refreshTimerID == null)this.refreshTimerID = window.setTimeout("ttx.refresh()", this.refreshTimeout);}
this.handle_onkeydown = function(inEvent, iKeyCode)
{switch(iKeyCode){case 39: if(this.activePage+1 == this.ttxPages.length) break;this.ttxPages[this.activePage+1].activate();if(this.scrollBottom != null)if(this.scrollBottom < this.activePage)this.scrollRight();break;case 37: if(this.activePage == 0) break;this.ttxPages[this.activePage-1].activate();if(this.scrollTop != 0)if(this.scrollTop > this.activePage)this.scrollLeft();break;case 40: if(this.activeSubPage+1 == this.ttxPages[this.activePage].subpages.length) break;this.ttxPages[this.activePage].subpages[this.activeSubPage+1].handleOnClick();if(this.ttxPages[this.activePage].scrollBottom != null)if(this.ttxPages[this.activePage].scrollBottom < this.activeSubPage)this.ttxPages[this.activePage].scrollDown();break;case 38: if(this.activeSubPage == 0) break;this.ttxPages[this.activePage].subpages[this.activeSubPage-1].handleOnClick();if(this.ttxPages[this.activePage].scrollTop != 0)if(this.ttxPages[this.activePage].scrollTop > this.activeSubPage)this.ttxPages[this.activePage].scrollUp();break;}return(true);}
this.onScrollClick = function(inDirection)
{this.scrollDirection = inDirection;switch(inDirection){case(0): this.scrollLeft();break;case(1): this.scrollRight();break;}}
this.scrollRight = function()
{if(this.scrollBottom == this.ttxPages.length-1) return(false);this.ttxPages[this.scrollTop++].hide();this.ttxPages[++this.scrollBottom].unhide();return(true);}
this.scrollLeft = function()
{if(this.scrollTop == 0) return(false);this.ttxPages[--this.scrollTop].unhide();this.ttxPages[this.scrollBottom--].hide();return(true);}
this.terminate = function()
{if(this.refreshTimerID != null)window.clearTimeout(this.refreshTimerID);for(var i in this.ttxPages){this.ttxPages[i].terminate();this.ttxPages[i] = null;}eventCenter.unregister('keydown', this);this.domLoading = null;this.ttxPages = null;this.domImage = null;try { this.request.onload = null; } catch(err) {}try { this.request.onreadystatechange = null; } catch(err) {}this.request = null;this.windowObj = null;this.domFullscreen.parentObj = null;this.domFullscreen.onclick = null;this.domFullscreen = null;if(this.window_type == 1){if(opener && !opener.closed)opener.window.focus();window.close();}}}
function showTTX(inWindowType)
{if(!inWindowType) inWindowType = 0;if(ttx != null)if(ttx.domImage==null)ttx=null;else return;ttx = new ttx_class(inWindowType, site_const.ttxDefaultPage, site_const.ttxDefaultSubPage);ttx.show();}
function ttx_page_class(inParent, inDomContainer, inPageIndex, inPageNo)
{this.parent = inParent;this.pageNo = inPageNo;this.pageIndex = inPageIndex;this.domContainer = inDomContainer;switch(this.parent.window_type){case 0: this.subpageContainer = this.parent.windowObj.domContainer.getElementsByTagName('ul')[1];this.scrollMaxCount = 17;this.scrollCount = 15;this.aDown_className = 'ttx_arrow_down';this.aUp_className = 'ttx_arrow_up';break;case 1: this.subpageContainer = document.getElementsByTagName('ul')[1];this.scrollMaxCount = 16;this.scrollCount = 14;this.aDown_className = 'ttx_arrow_right';this.aUp_className = 'ttx_arrow_left';break;case 2: this.subpageContainer = document.getElementsByTagName('ul')[1];this.scrollMaxCount = 17;this.scrollCount = 15;this.aDown_className = 'ttx_arrow_down';this.aUp_className = 'ttx_arrow_up';break;}this.buttonUp = null;this.buttonDown = null;this.scrollTop = 0;this.scrollBottom = null;this.scrollDirection = 1;this.domA = document.createElement('a');this.domA.href = "#";this.domA.innerHTML = inPageNo;this.domA.parentObj = this;
this.domA.onclick = function() { this.parentObj.activate(); return(false);}
this.domLI = document.createElement('li');this.domLI.style.display = 'none';this.domLI.appendChild(this.domA);this.domContainer.appendChild(this.domLI);this.active = false;this.subpages = null;this.subpagesCount = null;this.activeSubpage = 0;this.imageVersion = null;
this.activateSubpage = function(inSubpageIndex)
{this.parent.showLoadingImage(false);this.subpages[this.activeSubpage].deactivate();this.activeSubpage = inSubpageIndex;this.parent.loadImage(this.pageIndex, this.activeSubpage, this.imageVersion, true);}
this.activate = function(inActiveSubpage)
{if(this.active) return;this.parent.showLoadingImage(false);this.subpagesCount = null;if(!inActiveSubpage)this.activeSubpage = 0;else this.activeSubpage = inActiveSubpage;this.imageVersion = null;this.parent.loadData(this.pageIndex, this.activeSubpage);this.domLI.className = 'active';this.active = true;}
this.deactivate = function()
{this.unloadSubpages();this.domLI.className = '';this.active = false;}
this.loadData = function(inSubpagesCount, inImageVersion)
{if(this.subpagesCount != inSubpagesCount){this.unloadSubpages();this.subpagesCount = inSubpagesCount;this.loadSubpages();if(this.activeSubpage == null || this.activeSubpage+1 > this.subpagesCount){this.activeSubpage = 0;this.imageVersion = null;}}this.subpages[this.activeSubpage].activate();if(this.imageVersion != inImageVersion){if(this.imageVersion != null)this.parent.showLoadingImage(true);else this.parent.showLoadingImage(false);this.imageVersion = inImageVersion;this.parent.loadImage(this.pageIndex, this.activeSubpage, this.imageVersion);}}
this.unloadSubpages = function()
{if(this.buttonUp!=null){this.buttonUp.onmousedown = null;this.buttonUp.getElementsByTagName('a')[0].onclick = null;this.buttonDown.onmousedown = null;this.buttonDown.getElementsByTagName('a')[0].onclick = null;this.buttonUp.ownerObj = null;this.buttonDown.ownerObj = null;this.subpageContainer.removeChild(this.buttonUp);this.subpageContainer.removeChild(this.buttonDown);this.buttonUp = null;this.buttonDown = null;this.scrollTop = 0;this.scrollBottom = null;this.scrollDirection = 1;}for(var i = 0 in this.subpages){this.subpages[i].terminate();this.subpages[i] = null;}this.subpages = new Array();}
this.loadSubpages = function()
{for(var i = 0; i<this.subpagesCount; i++)this.subpages.push(new ttx_subpage_class(this, this.subpageContainer, i));this.setupScroll();}
this.setupScroll = function()
{if(this.subpagesCount > this.scrollMaxCount){this.scrollBottom = this.scrollCount-1;var aUp = document.createElement('a');aUp.innerHTML = '&nbsp;';aUp.href = '#';
aUp.href.onclick = function() { return(false); }
this.buttonUp = document.createElement('li');this.buttonUp.ownerObj = this;this.buttonUp.className=this.aUp_className;this.buttonUp.appendChild(aUp);var aDown = document.createElement('a');aDown.innerHTML = '&nbsp;';aDown.href = '#';
aDown.href.onclick = function() { return(false); }
this.buttonDown = document.createElement('li');this.buttonDown.ownerObj = this;this.buttonDown.className=this.aDown_className;this.buttonDown.appendChild(aDown);this.subpageContainer.appendChild(this.buttonDown);this.subpageContainer.insertBefore(this.buttonUp, this.subpageContainer.firstChild);
this.buttonDown.onmousedown = function() { this.ownerObj.onScrollClick(1); return(false);}
this.buttonUp.onmousedown = function() { this.ownerObj.onScrollClick(0); return(false);}
}else this.scrollBottom = this.subpagesCount-1;for(var i=0; i<=this.scrollBottom; i++)this.subpages[i].unhide();}
this.scrollDown = function()
{if(this.scrollBottom == this.subpages.length-1) return(false);this.subpages[this.scrollTop++].hide();this.subpages[++this.scrollBottom].unhide();return(true);}
this.scrollUp = function()
{if(this.scrollTop == 0) return(false);this.subpages[--this.scrollTop].unhide();this.subpages[this.scrollBottom--].hide();return(true);}
this.onScrollClick = function(inDirection)
{this.scrollDirection = inDirection;switch(inDirection){case(0): this.scrollUp();break;case(1): this.scrollDown();break;}}
this.unhide = function()
{this.domLI.style.display = 'block';}
this.hide = function()
{this.domLI.style.display = 'none';}
this.terminate = function()
{if(this.active) this.unloadSubpages();this.domA.onclick = null;this.domA.parentObj = null;this.domContainer.removeChild(this.domLI);this.domContainer = null;this.domA = null;this.domLI = null;this.parent = null;this.subpages = null;}}
function ttx_subpage_class(inParent, inDomContainer, inSubpageIndex)
{this.parent = inParent;this.subpageIndex = inSubpageIndex;this.domContainer = inDomContainer;this.domA = document.createElement('a');this.domA.href = "#";this.domA.innerHTML = inSubpageIndex+1;this.domA.parentObj = this;
this.domA.onclick = function() { this.parentObj.handleOnClick(); return(false); }
this.domLI = document.createElement('li');this.domLI.className = 'ttx_subpages_inactive';this.domLI.style.display = 'none';this.domLI.appendChild(this.domA);this.domContainer.appendChild(this.domLI);this.active = false;
this.handleOnClick = function()
{if(this.active) return;this.activate();this.parent.activateSubpage(this.subpageIndex);}
this.activate = function()
{this.domLI.className = 'ttx_subpages_active';this.active = true;}
this.deactivate = function()
{this.domLI.className = 'ttx_subpages_inactive';this.active = false;}
this.hide = function()
{this.domLI.style.display = 'none';}
this.unhide = function()
{this.domLI.style.display = 'block';}
this.terminate = function()
{this.domA.onclick = null;this.domA.parentObj = null;this.domContainer.removeChild(this.domLI);this.domContainer = null;this.domA = null;this.domLI = null;this.parent = null;}}
function provList_class(inWindowType, inBrojListica, inKodListica)
{this.broj_listica = inBrojListica;this.kod_listica = inKodListica;this.receivedData = null;this.htmlCache = '';this.refreshTimerID = null;this.refreshCounter = 0;this.request = null;this.dataSource = '/rpc/provList.asp';this.domProvList_tbx_kod = null;this.domProvList_tbx = null;this.domProvList_osvjez = null;this.domProvList_container = null;this.window_type = inWindowType;var sTemplate='<div id="provList_header">Broj listića: <input maxlength="14" type="text" value="';if(this.broj_listica!=null) {sTemplate+=this.broj_listica;}sTemplate+='" id="provList_tbx" onKeyDown="return(provList.provList_tbxKeyDown(event));" /> Prve tri znamenke koda: <input maxlength="3" type="text" value="';if(this.kod_listica!=null) {sTemplate+=this.kod_listica;}sTemplate+='" id="provList_tbx_kod" onKeyDown="return(provList.provList_tbx_kodKeyDown(event));" /> <input class="cmd" type="submit" value="Provjeri" onClick="provList.buttonDown();" id="provList_cmd" /> <span id="provList_osvjez"></span> </div>' +'<div id="provList_container"><p class="provList_uputa"><b>Uputa:</b> unesite broj vašeg listića, pa pritisnite tipku "Provjeri"...</p></div>';switch(this.window_type){case 0: this.trackerURL = '/prov_list/windowed/';this.windowObj = new window_class(wrapper_div, 'Provjera listića', false, false, false, true);this.windowObj.parentObj = this;this.windowObj.domContainer.id = 'provList';this.windowObj.queryUnload = this.queryUnload;this.windowObj.addContent(sTemplate);break;case 2: this.trackerURL = '/prov_list/detached/';document.write(sTemplate);break;}
this.init = function()
{this.domProvList_tbx_kod=document.getElementById('provList_tbx_kod');this.domProvList_tbx=document.getElementById('provList_tbx');this.domProvList_osvjez=document.getElementById('provList_osvjez');this.domProvList_container=document.getElementById('provList_container');}
this.buttonDown = function()
{this.showLoadingImage();this.loadData(this.domProvList_tbx.value, this.domProvList_tbx_kod.value, false);}
this.provList_tbxKeyDown = function(e)
{var iKeyCode;if(window.event) {iKeyCode = e.keyCode;} else {iKeyCode = e.which;}if(this.domProvList_container == null)this.init();if(iKeyCode==13) this.domProvList_tbx_kod.focus();return(true);}
this.provList_tbx_kodKeyDown = function(e)
{var iKeyCode;if(window.event) {iKeyCode = e.keyCode;} else {iKeyCode = e.which;}if(iKeyCode==13) this.buttonDown();return(true);}
this.loadData = function(inBrojListica, inKodListica, inRefresh)
{var sBrojListica=inBrojListica+'';var sKodListica=inKodListica+'';if(sBrojListica.length == 0){provList.domProvList_container.innerHTML = '<p class="provList_uputa"><b>Greška:</b> Broj listića nije unešen!<br>Molimo unesite ga, te pokušajte ponovo...</p><p class="provList_uputa"><b>Uputa:</b> unesite broj vašeg listića i tri prve znamenke kôda,<br>pa pritisnite tipku "Provjeri"...</p>';return;}if(!IsNumeric(inBrojListica)){provList.domProvList_container.innerHTML = '<p class="provList_uputa"><b>Greška:</b> Unešeni broj listića je neispravan.<br>Molimo provjerite unešeni broj, te pokušajte ponovo...</p><p class="provList_uputa"><b>Uputa:</b> unesite broj vašeg listića i tri prve znamenke kôda,<br>pa pritisnite tipku "Provjeri"...</p>';return;}if(sKodListica.length == 0){provList.domProvList_container.innerHTML = '<p class="provList_uputa"><b>Greška:</b> Prve tri znamenke kôda listića nisu unešene!<br>Molimo unesite ih, te pokušajte ponovo...</p><p class="provList_uputa"><b>Uputa:</b> unesite broj vašeg listića i tri prve znamenke kôda,<br>pa pritisnite tipku "Provjeri"...</p>';return;}if(sKodListica.length != 3){provList.domProvList_container.innerHTML = '<p class="provList_uputa"><b>Greška:</b> Unešeni kôd listića mora sadržavati tri znamenke.<br>Molimo provjerite unešeni kôd, te pokušajte ponovo...</p><p class="provList_uputa"><b>Uputa:</b> unesite broj vašeg listića i tri prve znamenke kôda,<br>pa pritisnite tipku "Provjeri"...</p>';return;}if(!IsNumeric(inKodListica)){provList.domProvList_container.innerHTML = '<p class="provList_uputa"><b>Greška:</b> Unešeni kôd listića je neispravan.<br>Molimo provjerite unešeni kôd, te pokušajte ponovo...</p><p class="provList_uputa"><b>Uputa:</b> unesite broj vašeg listića i tri prve znamenke kôda,<br>pa pritisnite tipku "Provjeri"...</p>';return;}if(this.refreshTimerID != null)window.clearTimeout(this.refreshTimerID);this.broj_listica = inBrojListica;this.kod_listica = inKodListica;this.refreshTimerID = null;if(this.request == null)this.request = createHTTPRequest();else if(this.request.readyState != 4)this.request.abort();var urlRefresh=1;if(!inRefresh){this.receivedData=null;urlRefresh=0;}this.request.open('GET',this.dataSource+'?l='+this.broj_listica+'&k='+this.kod_listica+'&r='+urlRefresh,true);try { this.request.onload = this.receiveData; }catch(error){
this.request.onreadystatechange = function()
{if(provList.request.readyState == 4)provList.receiveData();}}this.request.send(null);}
this.receiveData = function()
{if(provList.request.status != 404){if(provList.request.getResponseHeader('listic_nadjen') == 'n') {provList.domProvList_container.innerHTML = '<p class="provList_uputa">Listić nije pronađen! Provjerite unešeni broj listića, pa pokušajte ponovo...</p><p class="provList_uputa"><b>Uputa:</b> unesite broj vašeg listića i tri prve znamenke kôda,<br>pa pritisnite tipku "Provjeri"...</p>';} else {provList.parseData();}}}
this.parseData = function()
{this.domProvList_osvjez.innerHTML = '<img src="/img/provjera_listica/refreshing.gif" /> auto refresh';if(this.receivedData==null){this.receivedData = eval(this.request.responseText);}else{if(!this.mergeData(this.request.responseText)){this.domProvList_container.innerHTML = this.htmlCache;this.scheduleRefresh();return;}}var tmpDatum = new Date();tmpDatum.parseHRDate(this.receivedData[5]);var sHTML = '';switch(this.receivedData[15]){case 1: sHTML+='<p class="provList_ishod_win" ><img src="/img/provjera_listica/win.gif" /> <b>ČESTITAMO!</b> Vaš listić je dobitni. Isplata je: <b>'+formatCurr(this.receivedData[14])+'</b></p>';break;case -1: sHTML+='<p class="provList_ishod_loss"><img src="/img/provjera_listica/loss.gif" /> Nažalost vaš listić je gubitni.</p>';break;case 0: sHTML+='<p class="provList_ishod_playing"><img src="/img/provjera_listica/playing.gif" /> Neki događaji na Vašem listiću još nisu odigrani...</p>';break;}sHTML +='<table><tbody><tr><th>Uplatno mjesto:</th><th>Uplata:</th><th>Broj listića:</th></tr>' +'<tr><td>' + this.receivedData[1]+'. ' + this.receivedData[2]+' - ' + this.receivedData[3]+', ' + this.receivedData[4]+'</td>' +'<td>' + tmpDatum.getHRString(false)+' - '+tmpDatum.getHRTime(true)+', '+tmpDatum.getWeekday(false)+'</td>' +'<td>'+ formatCurr(this.broj_listica,0)+'</td></tr></table>';if(this.receivedData[8]=='') {sColTH1 = 'Koeficijent:';sColTD1=formatKoeff(this.receivedData[9],2);} else {sColTH1='Sistem:';sColTD1=this.receivedData[8];}if(this.receivedData[11]=='') {sColTH2='Moguća isplata:';sColTD2='';} else {sColTH2='M.T.</th><th>Ulog:</th><th>Maksimalna moguća isplata:';sColTD2=formatCurr(this.receivedData[11])+'</td><td>' +formatCurr(this.receivedData[12])+'</td><td>';}sHTML+='<table><tbody><tr><th>'+sColTH1+'</th><th>Uplata:</th><th>'+sColTH2+'</th></tr>' +'<tr><td>'+sColTD1+'</td><td>'+formatCurr(this.receivedData[10])+'</td><td>' +sColTD2+formatCurr(this.receivedData[13])+'</td></tr></table>';if(this.receivedData[6]!='') {sHTML+='<p class="provList_varijanta">'+this.receivedData[6]+'</p>';}if(this.receivedData[7]==3){sHTML+=this.renderLotoTable(this.receivedData[16]);}else{sHTML+=this.renderNormalTable(this.receivedData[16]);}this.htmlCache=sHTML+'<p id="provList_sub_footer"><img src="/img/provjera_listica/win.gif" /> = dobitni događaj; <img src="/img/provjera_listica/loss.gif" /> = gubitni događaj; <img src="/img/provjera_listica/playing_w.gif" /> = događaj još nije odigran ili je u tijeku</p>';this.domProvList_container.innerHTML = this.htmlCache;if(this.window_type == 0)this.resize();this.scheduleRefresh();}
this.renderNormalTable = function(aDogadjaji)
{var sHTML='<table class="provList_dogadjaji"><colgroup><col style="width:25px;"><col><col><col style="width:70px;"><col style="width:35px;"><col style="width:40px;"><col style="width:40px;"><col style="width:30px;"></colgroup>' +'<tbody><tr><th>&nbsp;</th><th>&nbsp;</th><th style="text-align:left;">&nbsp;Događaji</th><th>Vrijeme</th><th>Tip</th><th>Koef.</th><th class="threz">Rezultat</th><th>K1</th></tr>';var tmpDatum = new Date();for(var i=0; i<aDogadjaji.length; i+=9){switch(aDogadjaji[i+6]){case 1: sHTML+='<tr class="provListWIN"><td><img src="/img/provjera_listica/win.gif" /></td>';break;case 0: sHTML+='<tr><td><img src="/img/provjera_listica/playing.gif" /></td>';break;case -1: sHTML+='<tr class="provListLOSS"><td><img src="/img/provjera_listica/loss.gif" /></td>';break;}if(aDogadjaji[i+1] != '') {sHTML+='<td><b>'+aDogadjaji[i+0]+'</b></td><td style="text-align:left;">&nbsp;'+aDogadjaji[i+1]+'=';} else {sHTML+='<td><b>'+aDogadjaji[i+0]+'</b></td><td style="text-align:left;">&nbsp;';}tmpDatum.parseHRDate(aDogadjaji[i+3]);sHTML+=aDogadjaji[i+2]+'</td><td>' +tmpDatum.getWeekday(true)+','+tmpDatum.getHRTime(false)+'</td><td><b>' +aDogadjaji[i+4]+'</b></td><td><b>' +formatKoeff(aDogadjaji[i+5])+'</b></td><td>' +aDogadjaji[i+8]+'</td><td>';if(aDogadjaji[i+7]==0) {sHTML+='<img src="/img/provjera_listica/unchecked.png" /></td></tr>';} else {sHTML+='<img src="/img/provjera_listica/checked.png" /></td></tr>';}}return(sHTML+'</tbody></table>');}
this.mergeData = function(inShortString)
{var shortData = eval(inShortString);var dataChanged = false;if(this.receivedData[14]!= shortData[0]){dataChanged = true;}if(this.receivedData[15]!= shortData[1]){dataChanged = true;}this.receivedData[1]= shortData[1];this.receivedData[0]= shortData[0];var shortPopis = shortData[2];var longPopis = this.receivedData[16];var iLong = 0;for(var iShort=0; iShort<shortPopis.length; iShort+=4){if(!dataChanged){if(shortPopis[iShort+0]!= longPopis[iLong+3]){dataChanged=true;}if(shortPopis[iShort+1]!= longPopis[iLong+6]){dataChanged=true;}if(shortPopis[iShort+2]!= longPopis[iLong+7]){dataChanged=true;}if(shortPopis[iShort+3]!= longPopis[iLong+8]){dataChanged=true;}}this.receivedData[2][iLong+3]= shortPopis[iShort+0];this.receivedData[2][iLong+6]= shortPopis[iShort+1];this.receivedData[2][iLong+7]= shortPopis[iShort+2];this.receivedData[2][iLong+8]= shortPopis[iShort+3];iLong+=9;}return(dataChanged);}
this.renderLotoTable = function(aDogadjaji)
{var sHTML='<table class="provList_dogadjaji">' +'<tbody><tr><th>&nbsp;</th><th style="text-align:left;">&nbsp;</th><th>Vrijeme</th><th>Loptice</th></tr>';var tmpDatum = new Date();for(var i=0; i<aDogadjaji.length; i+=9){switch(aDogadjaji[i+6]){case 1: sHTML+='<tr class="provListWIN"><td><img src="/img/provjera_listica/win.gif" /></td><td>';break;case 0: sHTML+='<tr><td><img src="/img/provjera_listica/playing.gif" /></td><td>';break;case -1: sHTML+='<tr class="provListLOSS"><td><img src="/img/provjera_listica/loss.gif" /></td><td>';break;}if(aDogadjaji[i+1] != '') {sHTML+=aDogadjaji[i+1];} else {sHTML+='&nbsp;';}tmpDatum.parseHRDate(aDogadjaji[i+3]);sHTML+='</td><td>'+tmpDatum.getWeekday(true)+','+tmpDatum.getHRTime(false)+'</td><td><b>' +aDogadjaji[i+4]+'</b></td></tr>';}return(sHTML+'</tbody></table>');}
this.queryUnload = function()
{this.terminate();if(this.window_type == 0)center_div.hideOverlay();return(true);}
this.resize = function()
{var innerHeight = document.body.clientHeight;var domContainer = this.windowObj.domContainer;var maxHeight = innerHeight-35;domContainer.style.height='';var winHeight = domContainer.scrollHeight+3;if(winHeight > maxHeight-80)winHeight = maxHeight-80;domContainer.style.height = winHeight+'px';}
this.detach = function()
{this.showDetached();}
this.showDetached = function()
{var sDebugMode = '';var iWidth = 580, iHeight=400;var LeftPosition = (screen.width)?(screen.width-iWidth)/2:100;var TopPosition = (screen.height)?(screen.height-iHeight)/2:100;if(debugMode)sDebugMode = '_debugMode';var child_prozor = window.open('/provList/detached/'+this.broj_listica+'_'+this.kod_listica+sDebugMode, '_blank', 'height='+iHeight+',width='+iWidth+',fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,top='+TopPosition+',left='+LeftPosition);parent.blur();child_prozor.window.focus();}
this.show = function()
{switch(this.window_type){case 0: center_div.showOverlay();this.windowObj.open(70,120,580,400);break;case 2: if(this.broj_listica != null) {this.showLoadingImage();this.loadData(this.broj_listica, this.kod_listica, false);}break;}}
this.showLoadingImage = function(inShowPreviousImage)
{if(this.domProvList_container == null)this.init();provList.domProvList_osvjez.innerHTML = '';this.domProvList_container.innerHTML = '<p class="provList_loading"><img src="/img/provjera_listica/loading.gif" /></p>';}
this.refresh = function()
{this.refreshTimerID = null;this.loadData(this.broj_listica, this.kod_listica, true);}
this.scheduleRefresh = function()
{if(this.refreshTimerID == null){if(this.receivedData[15]==0){this.refreshTimerID = window.setTimeout("provList.refresh()", site_const.provListRefreshRateNormal);}else{this.refreshTimerID = window.setTimeout("provList.refresh()", site_const.provListRefreshRateLong);}}}
this.terminate = function()
{if(this.refreshTimerID != null)window.clearTimeout(this.refreshTimerID);this.domProvList_tbx = null;this.domProvList_tbx_kod = null;this.domProvList_container = null;this.domProvList_osvjez=null;this.receivedData=null;try { this.request.onload = null; } catch(err) {}try { this.request.onreadystatechange = null; } catch(err) {}this.request = null;this.windowObj = null;if(this.window_type == 1){if(opener && !opener.closed)opener.window.focus();window.close();}}}
function showProvList(inWindowType, inBrListica, inKodListica)
{if(!inWindowType) inWindowType = 0;if(provList != null)if(provList.domProvList_container==null)provList=null;else return;provList = new provList_class(inWindowType, inBrListica, inKodListica);provList.show();}
function sidebarProvList()
{showProvList(0, document.getElementById('provList_tbx_sidebar').value, document.getElementById('provList_tbx_kod_sidebar').value);provList.show();provList.buttonDown();}var mainRequest;var leftMenu, menu_loader, controler, htmlLoader, output_buffer, titlebar, domBody;var ttx=null;var provList=null;var center_div, center_overlay, mnu_left, status_div, wrapper_div;var ponuda_sport_template, ponuda_grupa_template, ponuda_grupa_komentar_template, ponuda_table_template, ponuda_tr_template, ponuda_td_template, ponuda_set_komentar_template, mnu_item_template, submnu_template;var appStatus, listic;
function init()
{appStatus = new appstatus_class();appStatus.setStatus(1);ponuda_sport_template = document.getElementById('ponuda_sport_template');ponuda_grupa_template = document.getElementById('ponuda_grupa_template');ponuda_grupa_komentar_template = document.getElementById('ponuda_grupa_komentar_template');ponuda_table_template = document.getElementById('ponuda_table_template');ponuda_tr_template = document.getElementById('ponuda_tr_template');ponuda_td_template = document.getElementById('ponuda_td_template');ponuda_set_komentar_template = document.getElementById('ponuda_set_komentar_template');mnu_item_template = document.getElementById('mnu_item_template');submnu_template = document.getElementById('submnu_template');mnu_left = document.getElementById('mnu_left');wrapper_div = document.getElementById('wrapper');center_overlay = document.getElementById('center_overlay');status_div = document.getElementById('status');listic = new listic_class();listic.clearAll();center_div = new center_div_class();center_div.resize();menu_loader = new menu_loader_class('/rpc/meni_u_polju.asp');menu_loader.loadData();mainRequest = new iframeRequest('mainRequest');titlebar = new titlebar_class();controler = new controler_class();htmlLoader = new htmlLoader_class('htmlLoader');htmlLoader.onload = controler.onLoadHandler;output_buffer = new output_buffer_class(center_div.domObj, false);}