var navBreaks = []; var bodySize = {}; var audio5js = null; var alerts = null; var guestBookRadio = false; var fxWindow = null; var startLoadingTime; var flashVersion = 0; if (!window.requestAnimationFrame) { (function () { var lastTime = 0; var vendors = ["ms", "moz", "webkit", "o"]; for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { window.requestAnimationFrame = window[vendors[x] + "RequestAnimationFrame"]; window.cancelAnimationFrame = window[vendors[x] + "CancelAnimationFrame"] || window[vendors[x] + "CancelRequestAnimationFrame"]; } if (!window.requestAnimationFrame) window.requestAnimationFrame = function (callback, element) { var currTime = new Date().getTime(); var timeToCall = Math.max(0, 16 - (currTime - lastTime)); var id = window.setTimeout(function () { callback(currTime + timeToCall); }, timeToCall); lastTime = currTime + timeToCall; return id; }; if (!window.cancelAnimationFrame) { window.cancelAnimationFrame = function (id) { clearTimeout(id); }; } })(); } window.addEvent("resize", function () { setSizeNav(); setSizes(); setGamesCatalogSize(); setSubscriptionsSize(); if ($(document.body).getElement(".vscrollable")) { $(document.body).getElement(".vscrollable").retrieve("scrollerBar").calc(); $(document.body) .getElement(".vscrollable") .retrieve("scrollerBar") .autosize(); } }); window.addEvent("load", function () { setSizes(); setGamesCatalogSize(); if ($(document.body).getElement(".vscrollable")) { var sb = new ScrollerBar($(document.body).getElement(".vscrollable")); $(document.body).getElement(".vscrollable").store("scrollerBar", sb); } /* if($(document.body).getElement('.vscrollable')){ var sb=new ScrollerBar($(document.body).getElement('.vscrollable')); $(document.body).getElement('.vscrollable').store('scrollerBar',sb); } */ }); window.addEvent("scroll", function () { var bs = $(document.body).getSize(); var ws = $(window).getScroll().y; if (bs.x > 768) { if ($(document.body).hasClass("main")) { if (ws == 0) { $("parenting").setStyle("visibility", "hidden"); } else { $("parenting").setStyle("visibility", "visible"); } } if (ws > $("main").getSize().y - 50) { if ($("nav")) { $("nav").addClass("fixed shadow"); } } else { if ($("nav")) { $("nav").removeClass("fixed shadow"); if ( $("nav").getBoundingClientRect().top > $("nav").getElement("ul.notvisible").getSize().y ) { $("nav").getElement("ul.notvisible").removeClass("bottom"); } else { $("nav").getElement("ul.notvisible").addClass("bottom"); } } if ($("tooltip-hook")) { if ( $("nav").getBoundingClientRect().top - $("tooltip-hook").getElement("div.bubble").getSize().y < 50 ) { $("tooltip-hook").addClass("bottom"); } else { $("tooltip-hook").removeClass("bottom"); } } } } else { if ($("nav")) { if (ws > $(document.body).getElement("header").getSize().y) { $("nav").addClass("fixed shadow"); } else { $("nav").removeClass("fixed shadow"); } } } if ($(document.body).getElement("a.backtotop")) { if ( ws >= $(document.body).getScrollSize().y - $(document.body).getSize().y - 50 ) { $(document.body).getElement("a.backtotop").addClass("show"); } else { $(document.body).getElement("a.backtotop").removeClass("show"); } } }); function preload() { flashVersion = getFlashVersion().split(",").shift(); var imgs = $$("img:not(.notpreload)"); var imgsPath = new Array(); imgs.each(function (el) { if (el.src.indexOf(".svg") == -1 && el.src.indexOf("data:") == -1) { imgsPath.push(el.getProperty("src")); } }); var CSSrules, CSSSheets, rules; CSSSheets = document.styleSheets; for (j = 0; j < CSSSheets.length; j++) { if ( CSSSheets[j].href != null && CSSSheets[j].href.indexOf(document.domain) > -1 ) { if (CSSSheets[j].cssRules) rules = CSSSheets[j].cssRules; else if (CSSSheets[j].rules) rules = CSSSheets[j].rules; else { } for (i = 0; i < rules.length; i++) { var patt = /url\((['"])(.+?)\1\)/gi; var patt = /url\(["|']?([^"']*)["|']?\)/gi; try { var url = patt.exec(rules[i].cssText); if (url != null) { var ext = url[1] .substring(url[1].lastIndexOf(".") + 1, url[1].length) .toLowerCase(); if (ext == "jpg" || ext == "png") { var src = url[1] .replace('url("', "") .replace('")', "") .replace("../", "./"); imgsPath.push(src); var img = new Element("img", { src: src, width: 0, height: 0, class: "destroy-later", }).inject($(document.body), "bottom"); imgs.push(img); } } } catch (err) {} } } } var needToLoad = getNotCachedFiles(imgs); if (needToLoad > 0) { Asset.images(imgsPath, { onComplete: function () { $(document.documentElement).addClass("images-preloaded"); preloadSWF(); }, }); } else { $(document.documentElement).addClass("images-preloaded"); preloadSWF(); } } function preloadSWF() { if ($("game") && !$$("game").hasClass("preload") && flashVersion > 0) { new Element("div#tmpswfpreloader").inject(document.body, "bottom"); var swfJSPreLoaderConfig = { assets: [$("game").getProperty("data-swf")], _swfPath: "./js/", _container: $("tmpswfpreloader"), assetLoaded: function (asset, bytes, status) {}, loadComplete: function () { destroyPreloader(); initPage(); $("tmpswfpreloader").destroy(); }, loadError: function () {}, callback: function () {}, }; swfJSPreLoader.init.apply(swfJSPreLoader, [swfJSPreLoaderConfig]); // new Swiff($('game').getProperty('data-swf'),{id:'gameswf',width:'100%',height:'100%',container:$('game').getElement('>div>div'),params:{'wMode':'opaque','salign':'T','scale':scale,'allowScriptAccess':'always','bgcolor':'#fff','FlashVars':flashVars},properties:{'wMode':'opaque','salign':'T','scale':scale,'bgcolor':'#fff','allowScriptAccess':'always'}}); //new Swiff('/preloader/preloader.swf',{id:'gameswf',width:'100%',height:'100%',container:$('game').getElement('>div>div'),params:{'wMode':'opaque','salign':'T','scale':scale,'allowScriptAccess':'always','bgcolor':'#fff','FlashVars':'file='+$('game').getProperty('data-swf').replace('&','&')+'&'+flashVars},properties:{'wMode':'opaque','salign':'T','scale':scale,'bgcolor':'#fff','allowScriptAccess':'always'}}); } else { // if(!$(document.documentElement).hasClass('js')){ destroyPreloader(); initPage(); // } } } function destroyPreloader() { $$("img.destroy-later").destroy(); if ($("preloader") || $("overlay-ad")) { var endLoadingTime = Date.now(); var preloaderTime = 2000 - (endLoadingTime - startLoadingTime); if (preloaderTime < 2000) preloaderTime = 2000; (function () { if ($("game") && !$("game").hasClass("template")) { var flashVars = ""; //var scale=$(document.body).hasClass('pmb')?'showAll':'exactfit'; if ($("game").getProperty("data-flashvars")) flashVars = $("game").getProperty("data-flashvars"); if ($("game").getProperty("data-scale")) scale = $("game").getProperty("data-scale"); flashVars += "&file=" + $("game").getProperty("data-swf"); if (flashVersion > 0) new Swiff( $("game").hasClass("preload") ? "/js/preloader.swf" : $("game").getProperty("data-swf"), { id: "gameswf", width: "100%", height: "100%", container: $("game").getElement(">div>div"), params: { wMode: "opaque", salign: "T", scale: scale, allowScriptAccess: "always", bgcolor: "#fff", FlashVars: flashVars, }, properties: { wMode: "opaque", salign: "T", scale: scale, bgcolor: "#fff", allowScriptAccess: "always", }, } ); } $(document.documentElement).removeClass("preloading"); (function () { if ($("preloader")) { $("preloader").fadeAndDestroy(); } //if($('overlay-ad')){ // $('overlay-ad').destroy(); //} //$('preloader').destroy(); }.delay(50)); }.delay(preloaderTime)); } } function getNotCachedFiles(imgs) { var a = imgs.filter(function (item, index) { if (item.src && item.src.indexOf("svg") > -1) { return false; } else if (item.readyState !== undefined && item.readyState >= 3) { return false; } else if (item.complete) { return false; } return true; }); return a.length; } function initPage() { if ( navigator.userAgent.indexOf("Safari") != -1 && navigator.userAgent.indexOf("Chrome") == -1 ) { $(document.body).addClass("safari"); } if ($(document.body).hasClass("fullview")) { (function () { window.scrollTo(0, 2000); }.delay(2000)); } fxWindow = new Fx.Scroll($(window), { link: "chain" }); fxWindow.set(0, 0); if ($(document.body).getElement("a.backtotop")) { $(document.body) .getElement("a.backtotop") .addEvent("click", function (e) { e.stop(); fxWindow.start(0, 0); }); } if (flashVersion < 10) { noFlashInfo(); } $$("body.ng #middle>a:not(:nth-child(5))").addEvents({ mouseenter: function () { var name = this.get("title").match(/^(\S+)\s(.*)/); if (!name) { var name = new Array(); name[0] = this.get("title"); name[1] = ""; } else { name = name.slice(1); } $("middle").getElement("a:nth-child(5) div.talk").removeClass("hidden"); $("middle").getElement("a:nth-child(5) div.throw").addClass("hidden"); $("middle") .getElement("a:nth-child(5) div.talk") .retrieve("sprite") .reset(); // $('middle').getElement('a:nth-child(5) div.talk').getElements('svg g[type="text"] div span')[0].set('text',name[0]); // $('middle').getElement('a:nth-child(5) div.talk').getElements('svg g[type="text"] div span')[1].set('text',name[1]); $("middle") .getElement("a:nth-child(5) div.talk") .getElements("svg text")[0] .set("text", name[0]); $("middle") .getElement("a:nth-child(5) div.talk") .getElements("svg text")[1] .set("text", name[1]); $("middle") .getElement("a:nth-child(5) div.talk") .retrieve("sprite") .start(); }, mouseleave: function () { $("middle").getElement("a:nth-child(5) div.talk").addClass("hidden"); $("middle") .getElement("a:nth-child(5) div.throw") .retrieve("sprite") .reset(); $("middle").getElement("a:nth-child(5) div.throw").removeClass("hidden"); //$('middle').getElement('a:nth-child(5)').getElements('svg g[type="text"] div span').set('text',''); $("middle") .getElement("a:nth-child(5)") .getElements("svg text") .set("text", ""); }, }); $$(".swiffycontainer").each(function (el) { /*var stage=new swiffy.Stage(el,swiffies[el.getProperty('data-var')],{}); //stage.setBackground(null); el.store('stage',stage); stage.start();*/ var s = new sprite(swiffies[el.getProperty("data-var")]); el.store("animationEnded", true); s.init(el, function () { el.store("animationEnded", true); }); el.store("sprite", s); //s.setBackground('#ff0'); if (Browser.name == "ie" && parseInt(Browser.version) <= 10) { $$("div.land>div") .addClass("hover") .addEvent("click", function () { window.location.href = this.getParent() .getElement("a.hover") .getProperty("href"); }); } if (el.hasClass("onlyshape")) { el.getParent("div.land").addEvent( "mouseenter:relay(.hover)", function () { if (el.hasClass("stopothers")) { $$(".swiffycontainer").each(function (el2) { if (el !== el2) { el2.retrieve("sprite").reset(); // el2.retrieve('sprite').stop(); // el2.retrieve('sprite').goToFrame(0); } }); } if ( (!el.retrieve("mouseover") && !el.hasClass("continue")) || (el.hasClass("continue") && el.retrieve("animationEnded")) ) { el.store("animationEnded", false); el.store("mouseover", true); el.retrieve("sprite").stop(); if (el.hasClass("backonhover") || el.hasClass("continue")) { el.retrieve("sprite").goToFrame(0); } el.retrieve("sprite").setDirection(1); el.retrieve("sprite").start(); } } ); if (!el.hasClass("continue")) { el.getParent("div.land").addEvent( "mouseleave:relay(.hover)", function () { if (el.retrieve("mouseover")) { if (el.hasClass("reverseonhover")) { el.retrieve("sprite").stop(); el.retrieve("sprite").setDirection(-1); el.retrieve("sprite").start(); } else { //el.retrieve('sprite').goToFrame(0); //el.retrieve('sprite').stop(); el.retrieve("sprite").reset(); } } el.store("mouseover", false); } ); } } else { el.addEvents({ mouseenter: function () { if (el.hasClass("stopothers")) { $$(".swiffycontainer").each(function (el2) { // el2.retrieve('sprite').stop(); //el2.retrieve('sprite').goToFrame(0); el2.retrieve("sprite").reset(); }); } if (!el.retrieve("mouseover") || el.hasClass("continue")) { el.store("mouseover", true); el.retrieve("sprite").stop(); if (el.hasClass("backonhover") || el.hasClass("continue")) { el.retrieve("sprite").goToFrame(0); } el.retrieve("sprite").setDirection(1); el.retrieve("sprite").start(); } }, mouseleave: function () { if (!el.hasClass("continue")) { if (el.retrieve("mouseover")) { if (el.hasClass("reverseonhover")) { el.retrieve("sprite").stop(); el.retrieve("sprite").setDirection(-1); el.retrieve("sprite").start(); } else { //el.retrieve('sprite').goToFrame(0); //el.retrieve('sprite').stop(); el.retrieve("sprite").reset(); } } el.store("mouseover", false); } }, }); } }); /*if($('kg-slider')){ new SlideShow($('kg-slider'), { autoplay: true, delay: 5000, duration: 500, transition: 'crossFade', selector:'>div' }); }*/ $(document.body).addEvent( 'click:relay(input[name^="guest-book-step"])', function (event, target) { if (guestBookRadio != target) { guestBookRadio = target; } else { target.set("checked", false); guestBookRadio = null; } } ); $$("*[data-hover-sound]").each(function (el) { var hoversound = new Audio5js({ throw_errors: true, format_time: true, swf_path: "/js/audio5js/swf/audio5js.swf", ready: function () { this.load(el.getProperty("data-hover-sound")); }, }); el.store("hoversound", hoversound); if (el.hasClass("onlyshape")) { el.addEvent("mouseenter:relay(.hover)", function () { if (el.hasClass("muteothers")) { $$("*[data-hover-sound]").each(function (el2) { if (el !== el2) { el2.retrieve("hoversound").volume(0); } }); } if ( !el.hasClass("continue") || (el.hasClass("continue") && !el.retrieve("hoversound").playing) ) { el.retrieve("hoversound").volume(0); el.retrieve("hoversound").seek(0); el.retrieve("hoversound").volume(1); el.retrieve("hoversound").play(); } }); el.addEvent("mouseleave:relay(.hover)", function () { if (!el.hasClass("continue")) { el.retrieve("hoversound").volume(0); } }); } else { el.addEvents({ mouseenter: function () { if (el.hasClass("muteothers")) { $$("*[data-hover-sound]").each(function (el2) { if (el !== el2) { el2.retrieve("hoversound").volume(0); } }); } if ( !el.hasClass("continue") || (el.hasClass("continue") && !el.retrieve("hoversound").playing) ) { el.retrieve("hoversound").volume(0); el.retrieve("hoversound").seek(0); el.retrieve("hoversound").volume(1); el.retrieve("hoversound").play(); } }, mouseleave: function () { if (!el.hasClass("continue")) { el.retrieve("hoversound").volume(0); } }, }); } }); $$("header a.sound").addEvent("click", function (e) { e.stop(); if (Cookie.read("bgSoundStopped") == "1") { Cookie.write("bgSoundStopped", "0"); this.removeClass("off"); } else { Cookie.write("bgSoundStopped", "1"); this.addClass("off"); } if (audio5js) { audio5js.playPause(); } }); //installFC(); /* $$('#nav div.nav-wrapper a,footer li a').each(function(el){ el.addEvent('click',function(e){ e.preventDefault(); //e.stopPropagation(); setActiveLink(this); //fxWindow.start(0,bodySize.y-60); //fxWindow.toElement($('parenting')); }); el.setProperty('href',document.location.href.split('#').shift()+'#'+el.getProperty('href')); }); */ $(document.body).addEvent( "click:relay(#parenting a.ajax)", function (event, target) { // event.stop(); // fxWindow.start(0,$('parenting').getPosition().y-50); fxWindow.start(0, $("main").getCoordinates().bottom - 50); } ); if ($(document.body).getElement("header a.scroll")) { $(document.body) .getElement("header a.scroll") .addEvent("click", function (e) { if (e !== undefined) { e.stop(); } if (!this.hasClass("active")) { var scrollBy = $(document.body).getElement("header").getSize().y - $(window).getScroll().y - 100 + ($("main").getElement("h1.catalog") ? $("main").getElement("h1.catalog").getSize().y : 0); this.addClass("active"); $(document.body).addClass("fullview"); Cookie.write("fullView", "1", { duration: false }); } else { var scrollBy = -$(document.body).getElement("header").getSize().y - $(window).getScroll().y - 100 + ($("main").getElement("h1.catalog") ? $("main").getElement("h1.catalog").getSize().y : 0); this.removeClass("active"); $(document.body).removeClass("fullview"); Cookie.write("fullView", "0", { duration: false }); } if (scrollBy > 0) { fxWindow.start(0, scrollBy); } window.fireEvent("resize"); }); } /* $('nav').addEvent('click:relay(div a)',function(e,target){ e.stop(); document.location.hash='#'+target.get('href'); $('parenting').removeClass('hidden'); $('parenting').set('text',this.get('href')); //fxWindow.toElement($(document.body).getElement('nav')); if(iscr){ setTimeout(function () { iscr.refresh(); iscr.scrollToElement($(document.body).getElement('nav')); },0); } }); */ if ($("tooltip-hook")) { $("tooltip-hook") .getElement(".bubble span.buttons button") .addEvent("click", function (e) { if (e !== undefined) { e.stop(); } var duration = parseInt($("tooltip-hook").getProperty("data-lifespan")); Cookie.write($("tooltip-hook").getProperty("data-name"), true, { duration: duration > 0 ? duration : false, }); $("tooltip-hook").destroy(); }); var closeAfter = parseInt( $("tooltip-hook").getProperty("data-close-after") || 0 ); if (closeAfter > 0) { (function () { $("tooltip-hook") .getElement(".bubble span.buttons button") .fireEvent("click"); }.delay(closeAfter * 1000)); } $("tooltip-hook") .getElement(".bubble") .setStyle( "width", parseInt($("tooltip-hook").getProperty("data-width") || 356) ); } (function () { setSizeNav(); }.delay(100)); //window.fireEvent('resize'); (function () { window.fireEvent("scroll"); }.delay(0)); var pl = new pageLoader({ container: $("parenting"), }); pl.initPage(); if ($("games")) { if ($(document.body).hasClass("ng")) { new tbCarousel({ container: $("games").getElement("div.grid"), slidesSelector: "a.cell", navButtons: { prev: $("games").getElement("a.prev"), next: $("games").getElement("a.next"), }, }); } else { } var allImages = $$("#games img"); allImages.removeClass("transparent"); /*var imgs=new Array(); allImages.each(function(el){ imgs.push(el.getProperty('src')); }); new Asset.images(imgs,{ onProgress:function(c,i){ allImages[i].removeClass('transparent'); } });*/ } if ($("catalogs") && !$(document.body).hasClass("kolor")) { //setCatalogsSize(); new tbCarousel({ container: $("catalogs"), navContainer: "catalogs-nav", rows: 1, slidesSelector: "a", maxWidth: 768, }); } if ($("search") && $("search").hasClass("ajax")) { $("search").addEvent("submit", function (e) { e.stop(); var phrase = $("search").getElement("input").getProperty("value"); new Request({ method: "post", url: this.action, onSuccess: function (html) { $("games") .getElement("div.vscrollable div.content") .set("html", html); if ($(document.body).getElement(".vscrollable")) { $(document.body) .getElement(".vscrollable") .retrieve("scrollerBar") .calc(); $(document.body) .getElement(".vscrollable") .retrieve("scrollerBar") .autosize(); } }, }).send("phrase=" + phrase + "&ajax=1"); if (phrase) { $("games").getElement("h1").set("text", phrase); } else { $("games") .getElement("h1") .set( "text", $("search").getElement("input").getProperty("data-catalog") ); } }); } } window.addEvent("load", function () { if ($(document.body).getElement("header")) { var headerHeight = $(document.body).getElement("header").getSize().y; if (headerHeight >= 200) { $(document.body).addClass("high"); } } /* var endLoadingTime=Date.now(); var preloaderTime=3000-(endLoadingTime-startLoadingTime); if(preloaderTime<3000) preloaderTime=3000; (function(){ $('preloader').destroy(); }).delay(preloaderTime); */ }); function setActiveLink(el) { $$("#nav div a,footer li a").removeClass("active"); if (el !== false) { el.addClass("active"); } } function resetFC() { $$("form").each(function (el) { if (el.retrieve("fc")) el.retrieve("fc").reinitialize("forced"); }); } function installFC() { $$("form.fc").each(function (el) { var ajax = true; var mask; if (el.hasClass("noajax")) ajax = false; var fc = new FormCheck(el, { onValidateSuccess: function () {}, ajaxSubmit: ajax, ajaxOptions: { onSuccess: function (resp) { var resp = JSON.decode(resp); if (resp.clear == "1") { clearForm(el); } if ($("recaptcha")) { try { grecaptcha.render("recaptcha", { sitekey: "6LeXwgcUAAAAACVjycsrVopWdvzEaWCQYsHOQy4C", }); grecaptcha.reset(); } catch (error) {} } if (resp.status == "OK") { if (resp.immediate == true) { if ( el.getElement('input[name="back"]') && el.getElement('input[name="back"]').get("value") != "" ) { var newURL = el.getElement('input[name="back"]').get("value"); window.location.href = newURL; if (newURL.indexOf("#") > -1) { window.location.reload(); } } else { window.location.href = resp.backurl; if (resp.backurl.indexOf("#") > -1) { window.location.reload(); } } } else { if ( el.getElement('input[name="back"]') && el.getElement('input[name="back"]').get("value") != "" ) { window.location.href = el .getElement('input[name="back"]') .get("value"); } else { if (resp.backurl) { alerts.alert(resp.msg, { callbacks: [ { label: "ok", callback: function () { window.location.href = resp.backurl; }, }, { label: "no", callback: function () {}, }, ], klass: null, width: resp.width, }); } else { alerts.alert(resp.msg, { callbacks: [ { label: "ok", callback: function () {}, }, { label: "no", callback: function () {}, }, ], klass: null, width: resp.width, }); } } } } else { alerts.alert(resp.msg, { callbacks: [ { label: "ok", callback: function () {}, }, { label: "no", callback: function () {}, }, ], klass: null, width: resp.width, }); } }, }, container: $(document.body), display: { showErrors: 1, titlesInsteadNames: true, scrollToFirst: true, tipsPosition: "right", tipsOffsetX: -10, tipsOffsetY: -15, replaceTipsEffect: 0, }, }); el.store("fc", fc); if (el.getElement("div.info span")) { el.getElement("div.info span").addEvent("click", function () { this.get("reveal").cancel(); this.dissolve(); }); } }); } function setSizeNav() { if (!$("nav")) return; $("nav").getElement("ul.visible").removeClass("justified"); /* var children=$('nav').getElements('ul.visible li'); $('nav').getElement('ul.visible').set('html','').adopt(children); var children=$('nav').getElements('ul.notvisible li'); $('nav').getElement('ul.notvisible').set('html','').adopt(children); */ /* var maxWidth=0; $$('#nav ul.visible li a').each(function(el){ if(el.getSize().x>maxWidth){ maxWidth=el.getSize().x; } }); if(maxWidth<150) maxWidth=150; $$('#nav ul.visible li a').setStyle('min-width',maxWidth); $('morepageslab').setStyle('width',maxWidth); */ //var availableSpace=$('nav').getSize().x-(32+45)*2-35; var availableSpace = $("nav").getElement("div").getSize().x; var sixLength = 0; $("nav") .getElements("ul li:not(.pad)") .each(function (el, i) { if (i < 5) { sixLength += el.getSize().x; } }); if ($(document.body).getSize().x <= 768) { sixLength = 0; } if (sixLength < availableSpace) { availableSpace = sixLength; } if ($("nav").getElement("ul.visible").getSize().x > availableSpace) { navBreaks.push($("nav").getElement("ul.visible").getSize().x); if ($("nav").getElements("ul.visible li:not(.pad)").length > 0) { $("nav") .getElement("ul.visible") .getChildren("li:not(.pad)") .getLast() .inject($("nav").getElement("ul.notvisible"), "top"); } else { return; } if ($("morepageslab").hasClass("hidden")) { $("morepageslab").removeClass("hidden"); } } else { while (availableSpace > navBreaks[navBreaks.length - 1]) { $$("#nav ul.notvisible li:first-of-type")[0].inject( $("nav").getElement("ul.visible li.pad"), "before" ); $("nav") .getElement("ul.visible") .getChildren("li:not(.pad)") .getLast() .appendText(" ", "after"); navBreaks.pop(); } if (navBreaks.length < 1) { $("morepageslab").addClass("hidden"); $("nav").getElement("input").checked = false; } } $("morepageslab").setProperty("data-count", navBreaks.length); if ($("nav").getElement("ul.visible").getSize().x > availableSpace) { setSizeNav(); } /* var lengthWithoutLast=$$('#nav ul.visible li:not(.pad)').length; $$('#nav ul.visible li:not(.pad)').each(function(el,i){ if(i=6){ $("nav") .getElement("ul.visible") .addClass("justified") .removeClass("invisible"); //} } function showFormInfo(el, html) { el.getElement("div.info span") .set("html", html) .reveal({ display: "table-cell" }); if (iscr) iscr.scrollToElement(el.getElement("div.info span")); else winScroll.toElement(el.getElement("div.info span")); (function () { el.getElement("div.info span").set("html", html).dissolve(); }.delay(10000)); if (iscr) (function () { iscr.refresh(); }.delay(10)); } function clearForm(form) { form.reset(); return; $(form) .getElements("input,textarea,select") .each(function (el) { if (el.get("tag") == "input") { if ( el.getProperty("type") == "text" || el.getProperty("type") == "email" || el.getProperty("type") == "number" || el.getProperty("type") == "password" ) { if (!el.getProperty("readonly") && !el.getProperty("disabled")) { el.set("value", ""); } } else if (el.getProperty("type") == "checkbox") { el.removeProperty("checked"); el.checked = false; } } else if (el.get("tag") == "textarea") { el.set("value", ""); } else { var fs = el.get("fancySelect"); if (fs) fs.select(""); el.getElements("option").removeProperty("selected"); } }); } function is_touch_device() { return "ontouchstart" in window || navigator.msMaxTouchPoints; } Element.implement({ fadeAndDestroy: function (duration) { duration = duration || 600; var el = this; this.set("tween", { duration: duration, }) .fade("out") .get("tween") .chain(function () { el.destroy(); }); }, }); Element.implement({ dissolveHTMLReveal: function (html, target, duration) { duration = duration || 600; var el = this; this.set("tween", { duration: duration, }) .dissolve() .get("dissolve") .chain(function () { target.set("html", html); if (html != "") { FancyForm.add(el.getElements("input")); el.reveal(); } }); }, }); Element.implement("surround", function (els, where) { var elements = Array.slice(els), len = elements.length; for (var i = 0; i < len; i++) { this.wraps(elements[i], where); } return this; }); Element.implement({ unwrap: function () { var parent = this.getParent(); parent.getChildren().inject(parent, "before"); parent.dispose(); return this; }, }); function detectIE() { var ua = window.navigator.userAgent; var msie = ua.indexOf("MSIE "); var trident = ua.indexOf("Trident/"); if (msie > 0) return parseInt(ua.substring(msie + 5, ua.indexOf(".", msie)), 10); if (trident > 0) { var rv = ua.indexOf("rv:"); return parseInt(ua.substring(rv + 3, ua.indexOf(".", rv)), 10); } return false; } function setSizes() { bodySize = $(document.body).getSize(); return; if ($("games")) { var width = 224 * Math.floor(($(document.body).getSize().x - 100) / 224); var height = 140 * Math.floor($("games").getSize().y / 140); var mt = 0; //($('games').getSize().y-height)/2; $("games") .getElement(">div") .setStyles({ width: width, height: height, "margin-top": mt }); if ($("game")) { $("game").setStyles({ width: $("games").getSize().y * 1.6, height: $("games").getSize().y, }); } else { $("games") .getElement(">div") .setStyle("margin-top", ($("games").getSize().y - height) / 2); } } } function setGamesCatalogSize() { if ($("games") && $(document.body).hasClass("ng")) { $$("#games .gap-wrapper").each(function (wrapper) { wrapper.outerHTML = wrapper.innerHTML; }); var minRows = 3; var maxRows = 4; var maxCols = 5; var cellSize = { x: 200, y: 140 }; var margin = { x: 120, y: 15 }; var bs = $("middle").getSize(); var width = parseInt((bs.x - 2 * margin.x) / cellSize.x) * cellSize.x; var height = parseInt((bs.y - 2 * margin.y) / cellSize.y) * cellSize.y; var rows = height / cellSize.y; if (rows < minRows || rows > maxRows) { if (rows < minRows) { rows = minRows; } else { rows = maxRows; } height = bs.y - 2 * margin.y; var newCellHeight = parseInt(height / rows); var newCellWidth = Math.ceil((cellSize.x / cellSize.y) * newCellHeight); cellSize = { x: newCellWidth, y: newCellHeight }; //$$('#games a.cell').setStyles({'width':newCellWidth,'height':newCellHeight}); width = parseInt((bs.x - 2 * margin.x) / newCellWidth) * newCellWidth; } var cols = width / cellSize.x; if (cols > maxCols) { cols = maxCols; /*var width=bs.x-2*margin.x; var newCellWidth=parseInt(width/cols); var newCellHeight=Math.ceil((cellSize.y/cellSize.x)*newCellWidth); cellSize={x:newCellWidth,y:newCellHeight}; $$('#games a.cell').setStyles({'width':newCellWidth,'height':newCellHeight}); var height=parseInt((bs.y-2*margin.y)/newCellHeight)*newCellHeight; */ width = cellSize.x * cols; } $$("#games a.cell").setStyles({ width: cellSize.x, height: cellSize.y }); var ml = (bs.x - width) / 2; var mt = (bs.y - height) / 2; /* var gap=$$('#games a.cell').length-Math.ceil(width/cellSize.x)*rows; if(gap>0){ new Element('div',{class:'gap-wrapper'}).surround($$('#games a.cell:nth-last-child(-n+'+gap+')')).setStyle('width',width); } */ var forPage = cols * rows; //console.log(cols,rows,forPage); for (var i = 0; i < $$("#games a.cell").length; i += forPage) { new Element("div", { class: "gap-wrapper" }) .surround($$("#games a.cell").slice(i, i + forPage)) .setStyle("width", width); } // new Element('div',{class:'gap-wrapper'}).surround($$('#games a.cell:nth-last-child(-n+'+(Math.ceil(width/cellSize.x)*rows)+')')).setStyle('width',width); //console.log(Math.ceil(width/cellSize.x),rows); $("games").setStyles({ width: width, height: height, "margin-top": mt, "margin-left": ml, }); } } function setCatalogsSize() { if ($("catalogs")) { $$("#catalogs .gap-wrapper").each(function (wrapper) { wrapper.outerHTML = wrapper.innerHTML; }); var minRows = 4; var cellSize = { x: 200, y: 140 }; var margin = { x: 120, y: 15 }; var bs = $("middle").getSize(); var width = parseInt((bs.x - 2 * margin.x) / cellSize.x) * cellSize.x; var height = parseInt((bs.y - 2 * margin.y) / cellSize.y) * cellSize.y; var rows = height / cellSize.y; if (rows < minRows) { rows = minRows; var height = bs.y - 2 * margin.y; var newCellHeight = parseInt(height / rows); var newCellWidth = Math.ceil((cellSize.x / cellSize.y) * newCellHeight); cellSize = { x: newCellWidth, y: newCellHeight }; $$("#catalogs a.cell").setStyles({ width: newCellWidth, height: newCellHeight, }); var width = parseInt((bs.x - 2 * margin.x) / newCellWidth) * newCellWidth; } var ml = (bs.x - width) / 2; var mt = (bs.y - height) / 2; var gap = $$("#catalogs a.cell").length - Math.ceil(width / cellSize.x) * rows; if (gap > 0) { new Element("div", { class: "gap-wrapper" }) .surround($$("#catalogs a.cell:nth-last-child(-n+" + gap + ")")) .setStyle("width", width); } $("catalogs").setStyles({ width: width, height: height, "margin-top": mt, "margin-left": ml, }); } } function setSubscriptionsSize() { if ($("subscriptions")) { var wrapper = $("subscriptions").getElement(".subscriptions-wrapper"); if (wrapper) { wrapper.outerHTML = wrapper.innerHTML; } var width = 528; var forPage = 9; for (var i = 0; i < $$("#subscriptions a.slide").length; i += forPage) { new Element("div", { class: "subscriptions-table-wrapper" }) .surround($$("#subscriptions a.slide").slice(i, i + forPage)) .setStyle("width", width); } } } function formatPrice(cena) { var tmp = parseInt(cena); cena = parseFloat(cena); if (cena == tmp) return tmp; else return cena.toFixed(2).replace(".", ","); } function hasFlash() { return typeof navigator.plugins == "undefined" || navigator.plugins.length == 0 ? !!new ActiveXObject("ShockwaveFlash.ShockwaveFlash") : navigator.plugins["Shockwave Flash"]; } function getFlashVersion() { // ie try { try { // avoid fp6 minor version lookup issues // see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/ var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); try { axo.AllowScriptAccess = "always"; } catch (e) { return "6,0,0"; } } catch (e) {} return new ActiveXObject("ShockwaveFlash.ShockwaveFlash") .GetVariable("$version") .replace(/\D+/g, ",") .match(/^,?(.+),?$/)[1]; // other browsers } catch (e) { try { if (navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) { return ( navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"] ).description .replace(/\D+/g, ",") .match(/^,?(.+),?$/)[1]; } } catch (e) {} } return "0,0,0"; } var captureOutboundLink = function (url) { ga("send", "event", "outbound", "click", url, { transport: "beacon", hitCallback: function () { document.location = url; }, }); };