var AdFreestyleEngineLoaded = true; function AdFreestyleEngine(){ this.alpha = 46; this.bgAlpha = 46; this.layerPallette = "000000,FFAD08,EEEEEE,28CEFF,46,000000,90,FFAD08"; this.adBoxWidth = 550; this.adBoxHeight = 480; this.msie = navigator.userAgent.toLowerCase().indexOf("msie"); this.isIE6 = (navigator.userAgent.toLowerCase().indexOf("msie 6.") != -1); this.engineIE = null; this.DoctypeLabel = false; this.siteLinks = document.getElementsByTagName("a"); this.flashPlugin = false; this.mobileBrowser = "0"; if(this.mobileBrowser > 0) { this.flashLoader = "<img src=\"http://www.adfreestyle.pl/img/loading.gif\" />"; } else { this.flashLoader = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"150\" height=\"60\" name=\"AdFreestyleFlashLoader\" id=\"AdFreestyleFlashLoader\" align=\"middle\"><param name=\"wmode\" value=\"transparent\" /><param name=\"movie\" value=\"http://www.adfreestyle.pl/img/loader.swf\" /><param name=\"quality\" value=\"high\" /><embed src=\"http://www.adfreestyle.pl/img/loader.swf\" wmode=\"transparent\" quality=\"high\" width=\"150\" height=\"60\" name=\"AdFreestyleFlashLoader\" id=\"AdFreestyleFlashLoader\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" /></object>"; } if (window.navigator.appName == "Microsoft Internet Explorer") { if (document.documentMode) this.engineIE = document.documentMode; else { this.engineIE = 5; if (document.compatMode) { if (document.compatMode == "CSS1Compat") this.engineIE = 7; } } for (i = 0; i < document.getElementsByTagName("!").length; i++) { if (parseInt(document.getElementsByTagName("!")[i].nodeType,10) == 8) { if (document.getElementsByTagName("!")[i].nodeValue.toLowerCase().indexOf("ctype") > -1) { this.DoctypeLabel = true; break; } } } } AdFreestyleEngine.prototype.IsFlashInstalled = function() { if (navigator.mimeTypes && navigator.mimeTypes.length > 0) { var mime = navigator.mimeTypes['application/x-shockwave-flash']; if (mime && mime.enabledPlugin) { var version = mime.enabledPlugin.description; return true; } } else { if (typeof (ActiveXObject) != "undefined") { try { var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.1"); return true; } catch(e) { } } } return false }; AdFreestyleEngine.prototype.run = function() { this.flashPlugin = AdFreestyleEngine.IsFlashInstalled(); AdFreestyleEngine.events(); AdFreestyleEngine.flash(); AdFreestyleEngine.container(); }; AdFreestyleEngine.prototype.events = function() { for(i=0; i < this.siteLinks.length; i++) { if(this.siteLinks[i].className.search("AdFreestyle")>-1) { var AdChannelCode = this.siteLinks[i].className.split("-"); if(AdChannelCode[1]) { this.siteLinks[i].onclick = function() { var AdChannelCode = this.className.split("-"); AdFreestyleEngine.show(AdChannelCode[1]); return false; } } } } }; AdFreestyleEngine.prototype.outerHTML = function(node) { var el; if (node.outerHTML) { return node.outerHTML; } else if (node.parentNode && node.parentNode.nodeType == 1) { var el = document.createElement(node.parentNode.nodeName); el.appendChild( node.cloneNode(true) ); return el.innerHTML; } return ""; }; AdFreestyleEngine.prototype.flash = function() { var embedCollection = document.getElementsByTagName("embed"); var objectCollection = document.getElementsByTagName("object"); var ParentObjects = Array(); for(i=0;i<embedCollection.length;i++){ var outer = AdFreestyleEngine.outerHTML(embedCollection[i]); if(outer.search("AdFreestyleFlash")<0 && outer.search("opaque")<0 && outer.search("transparent")<0) { embedCollection[i].setAttribute("wmode","opaque"); ParentObjects.push(embedCollection[i].parentNode); } } for(i=0;i<embedCollection.length;i++){ if(ParentObjects[i]){ var outerSrc = ParentObjects[i].innerHTML; ParentObjects[i].innerHTML = outerSrc; } } if(this.msie!=-1) { var objects = document.getElementsByTagName("object"); for(i=0; i<objects.length; i++) { object = objects[i]; var new_object; if(object.outerHTML && object.outerHTML.search("AdFreestyleFlash")<0 && object.outerHTML.search("opaque")<0 && object.outerHTML.search("transparent")<0) { var html = object.outerHTML; if(html.match(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")[a-zA-Z]+('|")\s*\/?\>/i)) { new_object = html.replace(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")window('|")\s*\/?\>/i,"<param name='wmode' value='opaque' /><param name='play' value='true' />"); } else { new_object = html.replace(/<\/object\>/i,"<param name=\"wmode\" value=\"opaque\" /><param name=\"play\" value=\"true\" />\n</object>"); } if(!html.match(/<param\s+name\s*=\s*('|")data('|")\s+value\s*=\s*('|")[a-zA-Z]+('|")\s*\/?\>/i)) { new_object = new_object.replace(/<\/object\>/i,"<param name=\"movie\" value=\""+object.data+"\" />\n</object>"); } object.outerHTML = new_object; var width = object.style.width; } } } }; AdFreestyleEngine.prototype.loaded = function() { if(this.flashPlugin && this.mobileBrowser==0) { document.getElementById("AdFreestyleLoader").innerHTML = ""; document.getElementById("AdFreestyleLoader").style.display = "none"; document.getElementById("AdFreestyleLoader").style.top = "0px"; document.getElementById("AdFreestyleLoader").style.left = "0px"; } document.getElementById("AdFreestyleFrame").style.display = "block"; }; AdFreestyleEngine.prototype.show = function(AdChannelCode) { AdFreestyleEngine.resize(this.adBoxWidth, this.adBoxHeight); if(this.flashPlugin && this.mobileBrowser==0) { document.getElementById("AdFreestyleLoader").innerHTML = this.flashLoader; document.getElementById("AdFreestyleLoader").style.display = "block"; document.getElementById("AdFreestyleLoader").style.position = "fixed"; document.getElementById("AdFreestyleLoader").style.top = "50%"; document.getElementById("AdFreestyleLoader").style.left = "50%"; document.getElementById("AdFreestyleLoader").style.marginLeft = "-75px"; document.getElementById("AdFreestyleLoader").style.marginTop = "-100px"; document.getElementById("AdFreestyleLoader").style.zIndex=AdFreestyleEngine.maxZIndex(); } document.getElementById("AdFreestyleContent").innerHTML = "<iframe src=\"http://www.adfreestyle.pl/overlay/"+AdChannelCode+"\" width=\"100%\" height=\"100%\" marginwidth=\"0\" marginheight=\"0\" hspace=\"0\" vspace=\"0\" frameborder=\"0\" scrolling=\"no\" allowtransparency=\"true\" id=\"AdFreestyleFrame\" onload=\"AdFreestyleEngine.loaded();\" style=\"display:none;\"></iframe>"; var PageSize = AdFreestyleEngine.getPageSize(); var ScrollOffsets = AdFreestyleEngine.getScrollOffsets(); if(!this.DoctypeLabel && this.msie!=-1) { if(PageSize[2] == PageSize[0] || (PageSize[2]-16) == PageSize[0]) document.getElementById("AdFreestyleOverlay").style.width = "100%"; else document.getElementById("AdFreestyleOverlay").style.width = (PageSize[2]-22) + "px"; } else { if(PageSize[2] == PageSize[0] || (PageSize[2]-16) == PageSize[0]) document.getElementById("AdFreestyleOverlay").style.width = "100%"; else document.getElementById("AdFreestyleOverlay").style.width = PageSize[2] + "px"; } document.getElementById("AdFreestyleOverlay").style.height = PageSize[1] + "px"; AdFreestyleEngine.Animate(0, this.alpha, 1, "incrase", "AdFreestyleEngine.FadeUp", "AdFreestyleOverlay"); document.getElementById("AdFreestyleContainer").style.display = "block"; document.getElementById("AdFreestyleOverlay").style.zIndex = 1566638; document.getElementById("AdFreestyleContainer").style.zIndex = 1566639; if((this.engineIE < 7 && this.engineIE) || this.isIE6) { noFixedPosition =(PageSize[3]/2)+ScrollOffsets[1]; document.getElementById("AdFreestyleContainer").style.top = ""+noFixedPosition+"px"; } document.getElementById("AdFreestyleClose").onclick = function(){ AdFreestyleEngine.hide(); } }; AdFreestyleEngine.prototype.flatfee = function(AdChannelCode) { AdFreestyleEngine.resize(720, 430); if(this.flashPlugin && this.mobileBrowser==0) { document.getElementById("AdFreestyleLoader").innerHTML = this.flashLoader; document.getElementById("AdFreestyleLoader").style.display = "block"; document.getElementById("AdFreestyleLoader").style.position = "fixed"; document.getElementById("AdFreestyleLoader").style.top = "50%"; document.getElementById("AdFreestyleLoader").style.left = "50%"; document.getElementById("AdFreestyleLoader").style.marginLeft = "-75px"; document.getElementById("AdFreestyleLoader").style.marginTop = "-50px"; document.getElementById("AdFreestyleLoader").style.zIndex=AdFreestyleEngine.maxZIndex(); } document.getElementById("AdFreestyleContent").innerHTML = "<iframe src=\"http://www.adfreestyle.pl/flatfee/"+AdChannelCode+"\" width=\"100%\" height=\"100%\" marginwidth=\"0\" marginheight=\"0\" hspace=\"0\" vspace=\"0\" frameborder=\"0\" scrolling=\"no\" allowtransparency=\"true\" id=\"AdFreestyleFrame\" onload=\"AdFreestyleEngine.loaded();\" style=\"display:none;\"></iframe>"; var PageSize = AdFreestyleEngine.getPageSize(); var ScrollOffsets = AdFreestyleEngine.getScrollOffsets(); if(!this.DoctypeLabel && this.msie!=-1) { if(PageSize[2] == PageSize[0] || (PageSize[2]-16) == PageSize[0]) document.getElementById("AdFreestyleOverlay").style.width = "100%"; else document.getElementById("AdFreestyleOverlay").style.width = (PageSize[2]-22) + "px"; } else { if(PageSize[2] == PageSize[0] || (PageSize[2]-16) == PageSize[0]) document.getElementById("AdFreestyleOverlay").style.width = "100%"; else document.getElementById("AdFreestyleOverlay").style.width = PageSize[2] + "px"; } document.getElementById("AdFreestyleOverlay").style.height = PageSize[1] + "px"; AdFreestyleEngine.Animate(0, this.alpha, 1, "incrase", "AdFreestyleEngine.FadeUp", "AdFreestyleOverlay"); document.getElementById("AdFreestyleContainer").style.display = "block"; document.getElementById("AdFreestyleOverlay").style.zIndex = 1566638; document.getElementById("AdFreestyleContainer").style.zIndex = 1566639; if((this.engineIE < 7 && this.engineIE) || this.isIE6) { noFixedPosition =(PageSize[3]/2)+ScrollOffsets[1]; document.getElementById("AdFreestyleContainer").style.top = ""+noFixedPosition+"px"; } document.getElementById("AdFreestyleClose").onclick = function(){ AdFreestyleEngine.hide(); } }; AdFreestyleEngine.prototype.hide = function() { AdFreestyleEngine.Animate(100, 0, 1, "decrase", "AdFreestyleEngine.FadeDown", "AdFreestyleOverlay"); document.getElementById("AdFreestyleContainer").style.display = "none"; }; AdFreestyleEngine.prototype.getScrollOffsets = function() { var pageXOffset = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft; var pageYOffset = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; return [pageXOffset,pageYOffset]; }; AdFreestyleEngine.prototype.getPageSize = function() { var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = window.innerWidth + window.scrollMaxX; yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight) { xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } var windowWidth, windowHeight; if (self.innerHeight) { if(document.documentElement.clientWidth) { windowWidth = document.documentElement.clientWidth; } else { windowWidth = self.innerWidth; } windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } if(yScroll < windowHeight) { pageHeight = windowHeight; } else { pageHeight = yScroll; } if(xScroll < windowWidth) { pageWidth = xScroll; } else { pageWidth = windowWidth; } return [pageWidth,pageHeight,document.documentElement.scrollWidth,windowHeight]; }; AdFreestyleEngine.prototype.maxZIndex = function() { var highestIndex = 0; var currentIndex = 0; var elArray = Array(); elArray = document.getElementsByTagName('*'); for(var i=0; i < elArray.length; i++){ if (elArray[i].style) { currentIndex = parseInt(elArray[i].style['zIndex'],10); } else if(window.getComputedStyle) { currentIndex = parseInt(document.defaultView.getComputedStyle(elArray[i],null).getPropertyValue('z-index'),10); } if(!isNaN(currentIndex) && currentIndex > highestIndex) { highestIndex = currentIndex; } } if(highestIndex==0) return (1566633+1); else return(highestIndex+1); }; AdFreestyleEngine.prototype.banner = function() { }; AdFreestyleEngine.prototype.container = function() { var palletteArray = this.layerPallette.split(","); if(this.msie!=-1){ var imgIE = "-ie"; } else{ var imgIE = ""; } if((this.engineIE < 7 && this.engineIE) || this.isIE6){ var positionFix = "_position:absolute;"; } else{ var positionFix = ""; } var innerData = ""; innerData += "<div id=\"AdFreestyleContainer\" class=\"AdFreestyleContainer\">"; innerData += "<div id=\"AdFreestyleLoader\" class=\"AdFreestyleLoader\"></div>"; innerData += "<div id=\"AdFreestyleClose\" class=\"AdFreestyleClose\"><a><img src=\"http://www.adfreestyle.pl/img/close_b_bt_on.png\" /></a></div>"; /*innerData += "<div id=\"AdFreestyleContent\" class=\"AdFreestyleContent\"><iframe src=\"http://www.adfreestyle.pl/overlay\" width=\"100%\" height=\"100%\" marginwidth=\"0\" marginheight=\"0\" hspace=\"0\" vspace=\"0\" frameborder=\"0\" scrolling=\"yes\" allowtransparency=\"true\" id=\"AdFreestyleFrame\"></iframe></div>"; */ innerData += "<div id=\"AdFreestyleContent\" class=\"AdFreestyleContent\"><iframe src=\"\" width=\"100%\" height=\"100%\" marginwidth=\"0\" marginheight=\"0\" hspace=\"0\" vspace=\"0\" frameborder=\"0\" scrolling=\"yes\" allowtransparency=\"true\" id=\"AdFreestyleFrame\"></iframe></div>"; innerData += "<div id=\"AdFreestyleFoot\" class=\"AdFreestyleFoot\"><a href=\"http://www.adfreestyle.pl/ref/awIsOL4sPla\" title=\"adFreestyle\" target=\"_blank\"><img src=\"http://www.adfreestyle.pl/img/adbox/logo_light.png\" class=\"AdFreestyleLogo\" id=\"AdFreestyleLogo\" align=\"absmiddle\" alt=\"AdFreestyle - system reklamy internetowej, programy partnerskie\" /></a> <a href=\"http://www.adfreestyle.pl/ref/awIsOL4sPla\" title=\"adFreestyle\" target=\"_blank\" />AdFreestyle - system reklamy internetowej, programy partnerskie</a></div>"; innerData += "</div>"; innerData += "<div id=\"AdFreestyleOverlay\"></div>"; innerData += "<style type=\"text/css\">"; innerData += ".AdFreestyleContainer {position:fixed;"+positionFix+"display:none;top:50%;margin-top:-"+(this.adBoxHeight/2+100)+"px;left:50%;margin-left:-"+(this.adBoxWidth/2+16)+"px;width:"+this.adBoxWidth+"px;padding: 11px;z-index:16777272;}"; innerData += ".AdFreestyleLogo {border:none;}"; innerData += ".AdFreestyleContent {background-color:transparent;border:none;height:"+(this.adBoxHeight)+"px; width:"+(this.adBoxWidth)+"px;overflow:hidden;padding:0px;margin:0px;}"; innerData += ".AdFreestyleOverlay {display: none;position:fixed;"+positionFix+"top:0%;left:0%;width:100%;height: 100%;z-index:16777271;background-color: #"+palletteArray[0]+";-khtml-opacity: "+(palletteArray[4]/100)+"; -moz-opacity: "+(palletteArray[4]/100)+";opacity:"+(palletteArray[4]/100)+";filter: alpha(opacity="+palletteArray[4]+");}"; innerData += ".AdFreestyleFoot {text-align:right;color:#FFFFFF;height:23px;margin-top:10px;text-shadow: #000000 1px 1px 1px;font:11px Tahoma,Arial,sans-serif;}"; innerData += ".AdFreestyleFoot a {border:none;color:#FFFFFF;text-decoration:none;background-color:transparent;}"; innerData += ".AdFreestyleFoot a:hover {border:none;color:#FFFFFF;text-decoration:underline;background-color:transparent;}"; innerData += ".AdFreestyleFoot a:visited {border:none;color:#FFFFFF;background-color:transparent;}"; innerData += ".AdFreestyleFoot a:focus {border:none;color:#FFFFFF;background-color:transparent;}"; innerData += ".AdFreestyleFoot img {margin-right:10px;background-color:transparent;border: none !important;padding: 0px !important;margin: 0px !important;}"; innerData += ".AdFreestyleLoader {display:none; width:150;height:50px;top:position:fixed;z-index:16777273;top:0px;left:0px;}"; innerData += ".AdFreestyleClose {margin-bottom:10px;float:right;width:100%;}"; innerData += ".AdFreestyleClose a{display:block;text-indent:-9999px;margin-top:0px;margin-left:0px;float:right;background: url(http://www.adfreestyle.pl/img/close_b_bt_off.png) no-repeat;height:29px;width:29px;cursor:pointer;}"; innerData += ".AdFreestyleClose a:hover{background: url(http://www.adfreestyle.pl/img/close_b_bt_on.png) no-repeat;}"; innerData += "</style>"; var tagElement = document.getElementsByTagName("body")[0]; var newElement = document.createElement("div"); newElement.innerHTML = innerData; tagElement.appendChild(newElement); document.getElementById("AdFreestyleOverlay").setAttribute("class", "AdFreestyleOverlay"); document.getElementById("AdFreestyleContainer").setAttribute("class", "AdFreestyleContainer"); document.getElementById("AdFreestyleOverlay").setAttribute(document.all ? "className" : "class", "AdFreestyleOverlay"); document.getElementById("AdFreestyleContainer").setAttribute(document.all ? "className" : "class", "AdFreestyleContainer"); }; AdFreestyleEngine.prototype.resize = function(newWidth, newHeight) { document.getElementById("AdFreestyleContainer").style.width = newWidth+"px"; document.getElementById("AdFreestyleContainer").style.marginTop = -(newHeight/2+50)+"px"; document.getElementById("AdFreestyleContainer").style.marginLeft = -(newWidth/2+16)+"px"; document.getElementById("AdFreestyleContent").style.width = newWidth+"px"; document.getElementById("AdFreestyleContent").style.height = newHeight+"px"; document.getElementById("AdFreestyleOverlay").style.zIndex=AdFreestyleEngine.maxZIndex(); document.getElementById("AdFreestyleContainer").style.zIndex=AdFreestyleEngine.maxZIndex(); }; AdFreestyleEngine.prototype.Animate = function(start, end, speed, direction, callBackFunc, callBackElem) { if(this.msie!=-1){ speed = speed / 4; } if(direction == "incrase") { for(i=start; i<end; ++i) { setTimeout(""+callBackFunc+"('"+callBackElem+"', "+i+")", speed*i); } } if(direction == "decrase") { var delay = end; for(i=start; i>end; --i) { delay++; setTimeout(""+callBackFunc+"('"+callBackElem+"', "+i+")", speed*delay); } } }; AdFreestyleEngine.prototype.FadeUp = function(id, value) { var el = document.getElementById(id); el.style['opacity'] = value / 100; el.style['-moz-opacity'] = value / 100; el.style['-khtml-opacity'] = value / 100; if(el.filters) el.filters.alpha['opacity'] = value; el.style.display = "block"; }; AdFreestyleEngine.prototype.FadeDown = function(id, value) { var el = document.getElementById(id); el.style['opacity'] = value / 100; el.style['-moz-opacity'] = value / 100; el.style['-khtml-opacity'] = value / 100; if(el.filters) el.filters.alpha['opacity'] = value; if(value<2) { el.style.display = "none"; } };};if(typeof(AdFreestyleEngine) == "function"){ var AdFreestyleEngine = new AdFreestyleEngine(); AdFreestyleEngine.run();}
