// javascripty spolocne pre vsetky moduly function getHTTPObject() { var xhr = false; if (window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } else if (window.ActiveXObject) { try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { xhr = false; } } } return xhr; } function str_replace(inputString, fromString, toString) { // Goes through the inputString and replaces every occurrence of fromString with toString var temp = inputString; if (fromString == "") { return inputString; } if (toString.indexOf(fromString) == -1) { // If the string being replaced is not a part of the replacement string (normal situation) while (temp.indexOf(fromString) != -1) { var toTheLeft = temp.substring(0, temp.indexOf(fromString)); var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length); temp = toTheLeft + toString + toTheRight; } } else { // String being replaced is part of replacement string (like "+" being replaced with "++") - prevent an infinite loop var midStrings = new Array("~", "`", "_", "^", "#"); var midStringLen = 1; var midString = ""; // Find a string that doesn't exist in the inputString to be used // as an "inbetween" string while (midString == "") { for (var i=0; i < midStrings.length; i++) { var tempMidString = ""; for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; } if (fromString.indexOf(tempMidString) == -1) { midString = tempMidString; i = midStrings.length + 1; } } } // Keep on going until we build an "inbetween" string that doesn't exist // Now go through and do two replaces - first, replace the "fromString" with the "inbetween" string while (temp.indexOf(fromString) != -1) { var toTheLeft = temp.substring(0, temp.indexOf(fromString)); var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length); temp = toTheLeft + midString + toTheRight; } // Next, replace the "inbetween" string with the "toString" while (temp.indexOf(midString) != -1) { var toTheLeft = temp.substring(0, temp.indexOf(midString)); var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length); temp = toTheLeft + toString + toTheRight; } } // Ends the check to see if the string being replaced is part of the replacement string or not return temp; // Send the updated string back to the user } function urlencode(str) { str = encodeURIComponent(str); str = str_replace(str,'+', '%2B'); str = str_replace(str,'%20', '+'); str = str_replace(str,'*', '%2A'); str = str_replace(str,'/', '%2F'); str = str_replace(str,'@', '%40'); return str; } function htmlspecialchars_decode(str) { str = str_replace(str,'&', '&'); str = str_replace(str,'>', '>'); str = str_replace(str,'<', '<'); str = str_replace(str,'"', '"'); return str; } function getwidth() { var myWidth = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; } return myWidth; } function getheight() { var myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myHeight = document.body.clientHeight; } return myHeight; } function getvar(name) { get_string = document.location.search; return_value = ''; do { //This loop is made to catch all instances of any get variable. name_index = get_string.indexOf(name + '='); if(name_index != -1) { get_string = get_string.substr(name_index + name.length + 1, get_string.length - name_index); end_of_value = get_string.indexOf('&'); if(end_of_value != -1) value = get_string.substr(0, end_of_value); else value = get_string; if(return_value == '' || value == '') return_value += value; else return_value += ', ' + value; } } while(name_index != -1) //Restores all the blank spaces. space = return_value.indexOf('+'); while(space != -1) { return_value = return_value.substr(0, space) + ' ' + return_value.substr(space + 1, return_value.length); space = return_value.indexOf('+'); } return(return_value); } function myalert(nadpis,message) { if (navigator.appName=="Microsoft Internet Explorer") // lamam s IE zobrazim len obycajny alert a pridu o vsetku paradu, lebo IE nepodporuje position fixed! grrrr { message=str_replace(message,'[NL]','\n'); alert(message); } else { message=str_replace(message,'[NL]','
'); document.getElementById('pozadie').style.display='block'; var vyska=getheight(); var sirka=getwidth(); switch (nadpis) { case 'info': { document.getElementById('nadpisinfo').style.left=(sirka/2)-(450/2)+'px'; document.getElementById('nadpisinfo').style.top=(vyska/2)-(150/2)+'px'; document.getElementById('obsaherror').style.left=(sirka/2)-(450/2)+'px'; document.getElementById('obsaherror').style.top=(vyska/2)-(150/2)+'px'; document.getElementById('nadpisinfo').style.display='block'; document.getElementById('obsaherror').style.display='block'; document.getElementById('obrazok1').src='./images/InfoBox.png'; document.getElementById('texterror').innerHTML=message; break; } case 'error': { document.getElementById('nadpiserror').style.left=(sirka/2)-(450/2)+'px'; document.getElementById('nadpiserror').style.top=(vyska/2)-(150/2)+'px'; document.getElementById('obsaherror').style.left=(sirka/2)-(450/2)+'px'; document.getElementById('obsaherror').style.top=(vyska/2)-(150/2)+'px'; document.getElementById('nadpiserror').style.display='block'; document.getElementById('obsaherror').style.display='block'; document.getElementById('obrazok1').src='./images/ErrorCircle.png'; document.getElementById('texterror').innerHTML=message; break; } } } } function closealert() { document.getElementById('nadpiserror').style.display='none'; document.getElementById('nadpisinfo').style.display='none'; document.getElementById('obsaherror').style.display='none'; document.getElementById('pozadie').style.display='none'; } function myconfirm(nadpis,message,onklik) { document.getElementById('pozadie').style.display='block'; var vyska=getheight(); var sirka=getwidth(); switch (nadpis) { case 'confirm': { document.getElementById('nadpisconfirm').style.left=(sirka/2)-(550/2)+'px'; document.getElementById('nadpisconfirm').style.top=(vyska/2)-(150/2)+'px'; document.getElementById('obsahconfirm').style.left=(sirka/2)-(550/2)+'px'; document.getElementById('obsahconfirm').style.top=(vyska/2)-(150/2)+'px'; document.getElementById('nadpisconfirm').style.display='block'; document.getElementById('obsahconfirm').style.display='block'; document.getElementById('textconfirm').innerHTML=message; document.getElementById('yesbtn').attributes['onclick'].value=str_replace(onklik,'*potvrdil*','2'); document.getElementById('nobtn').attributes['onclick'].value=str_replace(onklik,'*potvrdil*','1'); break; } } } function closeconfirm() { document.getElementById('nadpisconfirm').style.display='none'; document.getElementById('obsahconfirm').style.display='none'; document.getElementById('pozadie').style.display='none'; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function setCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function eraseCookie(name) { setCookie(name,"",-1); } function isnumber(sText) { var ValidChars = "0123456789"; var IsNumber=true; var Char; for (i = 0; i < sText.length && IsNumber == true; i++) { Char = sText.charAt(i); if (ValidChars.indexOf(Char) == -1) { IsNumber = false; } } return IsNumber; } function GetLongXmlNodeValue(co,zcoho) { return zcoho.substring(zcoho.indexOf('<'+co+'>')+co.length+2,zcoho.indexOf('')); } function removeHTMLTags(strInputCode){ strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){ return (p1 == "lt")? "<" : ">"; }); var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, ""); return strTagStrippedText; } String.prototype.count=function(s1) { return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length; } String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); } String.prototype.ltrim = function() { return this.replace(/^\s+/,""); } String.prototype.rtrim = function() { return this.replace(/\s+$/,""); } var imglist; function galeria(str) { var vyska=getheight(); var sirka=getwidth(); document.getElementById('galeriamain').style.left=(sirka/2)-(954/2)+'px'; document.getElementById('galeriamain').style.top=(vyska/2)-(604/2)+'px'; Effect.Appear('galeriamain'); document.getElementById('pozadie').style.display='block'; var request = getHTTPObject(); request.onreadystatechange=function() { if ((request.readyState==4) && (request.status==200)) { imglist=request.responseText.split('|'); document.getElementById('galimg').src='./files/Screenshoty/'+imglist[0]; document.getElementById('galprecache').src=imglist[0]; document.getElementById('galnums').innerHTML='1 / '+imglist.length; } } request.open("POST","./getimglist.php",true); request.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); data='gal='+urlencode(str); request.send(data); } function galeria_next() { var index = parseInt(document.getElementById('galnums').innerHTML.split('/')[0].rtrim()); if (index==parseInt(document.getElementById('galnums').innerHTML.split('/')[1].ltrim())) return false; crossfade(document.getElementById('galimg'),'./files/Screenshoty/'+imglist[index],.65); document.getElementById('galnums').innerHTML=(parseInt(index)+1) +' / '+imglist.length; if (imglist.length!=parseInt(index)+1) document.getElementById('galprecache').src=imglist[parseInt(index)+2]; return false; } function galeria_prev() { var index = parseInt(document.getElementById('galnums').innerHTML.split('/')[0].rtrim()); if (index==1) return false; crossfade(document.getElementById('galimg'),'./files/Screenshoty/'+imglist[index-2],.65); document.getElementById('galnums').innerHTML=(parseInt(index)-1) +' / '+imglist.length; return false; } function galeria_close(str) { Effect.Fade('galeriamain'); document.getElementById('pozadie').style.display='none'; document.getElementById('galimg').src=''; return false; }