function AddFavorite(linkObj,addUrl,addTitle) { addTitle = "Onlinovky.cz - Hry online"; if (window.external) { window.external.AddFavorite(addUrl,addTitle); return false; } else if (window.opera && window.print) { linkObj.title = addTitle; return true; } else if (window.sidebar) { window.sidebar.addPanel(addTitle,addUrl,''); return false; } return false; } function SetHome() { document.body.style.behavior = 'url(#default#homepage)'; document.body.setHomePage('http://www.onlinovky.cz'); } var http_request = false; function makeRequest(url) { http_request = false; if (window.XMLHttpRequest) { http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } http_request.open('GET', url, true); } function makeRequestSync(url) { http_request = false; if (window.XMLHttpRequest) { http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } http_request.open('GET', url, false); } function LoadGamelist() { makeRequest("http://www.onlinovky.cz/loadgamelist.php"); http_request.onreadystatechange = function () { if(http_request.readyState == 4){ if(http_request.status == 200) { var data_feedback = http_request.responseText; var options = data_feedback.split("|"); var name, id; document.forms['quickForm'].quickSelect.options[1] = new Option("------------------------", 1); for (i=2; i <= options.length+1; i++) { if (i%2 == 0) name = options[i-2]; else { document.forms['quickForm'].quickSelect.options[((i+1)/2)] = new Option(name, options[i-2]); } } var defo = document.getElementById("defaultOption"); defo.innerHTML = "Rychlý výběr hry"; }} }; http_request.send(null); } function LoadGamelistNEW() { makeRequest("http://www.onlinovky.cz/loadgamelistnew.php"); http_request.onreadystatechange = function () { if(http_request.readyState == 4){ if(http_request.status == 200) { var data_feedback = http_request.responseText; var options = data_feedback.split("|"); var name, id, hs, hst; document.forms['quickForm'].quickSelect.options[1] = new Option("------------------------", 1); for (i=3; i <= options.length+1; i++) { if (i%3 == 0) name = options[i-3]; else if (i%3 == 1) { hs = options[i-3]; if (hs==1) {hst = "";} else { hst=""; } } //!!! (" HS") else { if (name.length > 22) { name = name.substr(0,20) + "..."; } document.forms['quickForm'].quickSelect.options[((i+1)/3)] = new Option(name + hst, options[i-3] + "-" + hs); } } var defo = document.getElementById("defaultOption"); defo.innerHTML = "Rychlý výběr hry"; }} }; http_request.send(null); } function GameJump(){ var current = document.forms['quickForm'].quickSelect.selectedIndex; if (current == 1) document.forms['quickForm'].quickSelect.selectedIndex = 0; else if (current != 0) { var url = document.forms['quickForm'].quickSelect.options[current].value; top.location = "http://www.onlinovky.cz/gamejump.php?id=" + url; } } function SortGames(currentPage){ var current = document.forms['sortForm'].sortSelect.selectedIndex; var sortID = document.forms['sortForm'].sortSelect.options[current].value; top.location = "http://www.onlinovky.cz/sortgames.php?by=" + sortID + "&cp=" + currentPage; } function ChangeBox(id){ if (id == 1) { document.getElementById('bookmark0').style.display = 'block'; document.getElementById('bookmark1').style.display = 'none'; document.getElementById('bookmark2').style.display = 'none'; document.getElementById('bookmark3').style.display = 'none'; document.getElementById('link0').className = 'ggin'; document.getElementById('link1').className = 'gm'; document.getElementById('link2').className = 'gm'; document.getElementById('link3').className = 'gm'; } if (id == 2) { document.getElementById('bookmark0').style.display = 'none'; document.getElementById('bookmark1').style.display = 'block'; document.getElementById('bookmark2').style.display = 'none'; document.getElementById('bookmark3').style.display = 'none'; document.getElementById('link0').className = 'gm'; document.getElementById('link1').className = 'ggin'; document.getElementById('link2').className = 'gm'; document.getElementById('link3').className = 'gm'; } if (id == 3) { document.getElementById('bookmark0').style.display = 'none'; document.getElementById('bookmark1').style.display = 'none'; document.getElementById('bookmark2').style.display = 'block'; document.getElementById('bookmark3').style.display = 'none'; document.getElementById('link0').className = 'gm'; document.getElementById('link1').className = 'gm'; document.getElementById('link2').className = 'ggin'; document.getElementById('link3').className = 'gm'; } if (id == 4) { document.getElementById('bookmark0').style.display = 'none'; document.getElementById('bookmark1').style.display = 'none'; document.getElementById('bookmark2').style.display = 'none'; document.getElementById('bookmark3').style.display = 'block'; document.getElementById('link0').className = 'gm'; document.getElementById('link1').className = 'gm'; document.getElementById('link2').className = 'gm'; document.getElementById('link3').className = 'ggin'; } return false; } function IncrementGamePlays(id) { makeRequest("http://www.onlinovky.cz/incgplays.php?id=" + id); http_request.send(null); } function IncrementGamePlaysHS(id) { makeRequest("http://www.onlinovky.cz/incgplayshs.php?id=" + id); http_request.send(null); } function VerifEmail() { var testResult; var str = document.forms['newsletterForm'].email.value; var filter = /^.+@.+\..{2,3}$/; if (filter.test(str)) { testResult = true; } else { window.alert("Zadaný email neodpovídá správnému formátu emailové adresy!"); testResult = false; } return testResult; } function ToggleVisibility(elid) { elem = document.getElementById(elid + "c"); if (elem.style.display == 'block') { elem.style.display = 'none'; } else { elem.style.display = 'block'; } } function HideHoverTitle(elid) { elem = document.getElementById(elid + "c"); elem.style.display = 'none'; } function Bandwidth(gameid) { msg = window.open('http://www.onlinovky.cz/bandwidth.php?gid=' + gameid, 'bandwidth', 'toolbar=no, menubar=no, location=no, directories=no, scrollbars=yes, resizable=yes, status=yes, width=600, height=180, top=' + (screen.height/2-250/2) + ', left=' + (screen.width/2-600/2)); } function GetLoadtime(gid) { makeRequest("http://www.onlinovky.cz/getloadtime.php?gid=" + gid); http_request.onreadystatechange = function () { if(http_request.readyState == 4){ if(http_request.status == 200) { var data_feedback = http_request.responseText; var lt = document.getElementById("loadtime"); lt.innerHTML = data_feedback; }} }; http_request.send(null); } function GetBoardID(user_id) { makeRequest("http://www.onlinovky.cz/getboardid.php?user_id=" + user_id); http_request.onreadystatechange = function () { if(http_request.readyState == 4){ if(http_request.status == 200) { var data_feedback = http_request.responseText; window.location.replace("http://www.onlinovky.cz/leaderboard.php?lid=" + data_feedback); }} }; http_request.send(null); } function GetProfileBox(user_id, gender) { makeRequestSync("http://www.onlinovky.cz/achievements_box_js.php?user_id=" + user_id + "&gender=" + gender); http_request.send(null); var data_feedback = http_request.responseText; return cup[user_id].replace('V_VXXX***|.', data_feedback); } function revStr(str){if(!str) return '';var revstr='';for(i=str.length-1;i>=0;i--){revstr+=str.charAt(i);}return revstr;}function sncq(sncqu){sstr='pass';sncqu='.'+sstr.charAt(0)+'hp';snul='se'+'rocsmochi';trl=snul.length;return 'mochi'+revStr(snul.substr(0,trl-5))+sncqu;}; var currentID = 1; var currentPosition = -300; var newPosition = 0; var timerID = 0; var mtID = 0; var isShifting = false; function goNext(){ if(currentID < 6){ stopMove(); currentID++; newPosition = (currentID)*(-300); startShift(); } } function goPrev(){ if(currentID > 0){ stopMove(); currentID--; newPosition = (currentID)*(-300); startShift(); } } function startShift(){ if (!isShifting){ isShifting = true; mtID = setInterval("shifting()", 50); } } function shifting(){ var promoItem = document.getElementById("jsPromoItemWrapper"); var dif = newPosition - currentPosition; if (dif < 0) { currentPosition -= 40; } else if (dif > 0) { currentPosition += 40; } var newDif = newPosition - currentPosition; if ((dif < 0 && newDif < 0) || (dif > 0 && newDif > 0)){ promoItem.style.left = currentPosition + "px"; } else { promoItem.style.left = newPosition + "px"; currentPosition = newPosition; autostopShift(); } } function autoRoll(){ currentID++; TempCurrentID = currentID; if (currentID == 6) { TempCurrentID = 1; } var dateobject = new Date; var progressbar = document.getElementById("progressbar" + TempCurrentID); progressbar.src = "http://www.onlinovky.cz/images/progressbar.gif?" + dateobject.getTime(); progressbar.style.visibility = "visible"; newPosition = (currentID)*(-300); startShift(); } function startMove(){ timerID = setInterval("autoRoll()", 7000); var progressbar = document.getElementById("progressbar1"); progressbar.src = "http://www.onlinovky.cz/images/progressbar.gif"; progressbar.style.visibility = "visible"; } function stopMove(){ clearInterval(timerID); for (i=0; i<=6; i++){ var progressbar = document.getElementById("progressbar" + i); progressbar.style.visibility = "hidden"; } } function stopShift(){ clearInterval(mtID); isShifting = false; } function autostopShift(){ if (currentID == 6) { currentID = 1; currentPosition = -300; var promoItem = document.getElementById("jsPromoItemWrapper"); promoItem.style.left = currentPosition + "px"; } else if (currentID == 0) { currentID = 5; currentPosition = 5*(-300); var promoItem = document.getElementById("jsPromoItemWrapper"); promoItem.style.left = currentPosition + "px"; } stopShift(); }