var AdFEngineLoaded = true; function AdFEngine(){ 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=\"AdFFlashLoader\" id=\"AdFFlashLoader\" 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=\"AdFFlashLoader\" id=\"AdFFlashLoader\" 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; } } } } AdFEngine.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 }; AdFEngine.prototype.run = function() { this.flashPlugin = AdFEngine.IsFlashInstalled(); AdFEngine.events(); AdFEngine.flash(); AdFEngine.container(); }; AdFEngine.prototype.events = function() { for(i=0; i < this.siteLinks.length; i++) { if(this.siteLinks[i].className.search("AdF")>-1) { var AdChannelCode = this.siteLinks[i].className.split("-"); if(AdChannelCode[1]) { this.siteLinks[i].onclick = function() { var AdChannelCode = this.className.split("-"); AdFEngine.show(AdChannelCode[1]); return false; } } } } }; AdFEngine.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 ""; }; AdFEngine.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 = AdFEngine.outerHTML(embedCollection[i]); if(outer.search("AdFFlash")<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("AdFFlash")<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; } } } }; AdFEngine.prototype.loaded = function() { if(this.flashPlugin && this.mobileBrowser==0) { document.getElementById("AdFLoader").innerHTML = ""; document.getElementById("AdFLoader").style.display = "none"; document.getElementById("AdFLoader").style.top = "0px"; document.getElementById("AdFLoader").style.left = "0px"; } document.getElementById("AdFFrame").style.display = "block"; }; AdFEngine.prototype.show = function(AdChannelCode) { AdFEngine.resize(this.adBoxWidth, this.adBoxHeight); if(this.flashPlugin && this.mobileBrowser==0) { document.getElementById("AdFLoader").innerHTML = this.flashLoader; document.getElementById("AdFLoader").style.display = "block"; document.getElementById("AdFLoader").style.position = "fixed"; document.getElementById("AdFLoader").style.top = "50%"; document.getElementById("AdFLoader").style.left = "50%"; document.getElementById("AdFLoader").style.marginLeft = "-75px"; document.getElementById("AdFLoader").style.marginTop = "-100px"; document.getElementById("AdFLoader").style.zIndex=AdFEngine.maxZIndex(); } document.getElementById("AdFContent").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=\"AdFFrame\" onload=\"AdFEngine.loaded();\" style=\"display:none;\"></iframe>"; var PageSize = AdFEngine.getPageSize(); var ScrollOffsets = AdFEngine.getScrollOffsets(); if(!this.DoctypeLabel && this.msie!=-1) { if(PageSize[2] == PageSize[0] || (PageSize[2]-16) == PageSize[0]) document.getElementById("AdFOverlay").style.width = "100%"; else document.getElementById("AdFOverlay").style.width = (PageSize[2]-22) + "px"; } else { if(PageSize[2] == PageSize[0] || (PageSize[2]-16) == PageSize[0]) document.getElementById("AdFOverlay").style.width = "100%"; else document.getElementById("AdFOverlay").style.width = PageSize[2] + "px"; } document.getElementById("AdFOverlay").style.height = PageSize[1] + "px"; AdFEngine.Animate(0, this.alpha, 1, "incrase", "AdFEngine.FadeUp", "AdFOverlay"); document.getElementById("AdFContainer").style.display = "block"; document.getElementById("AdFOverlay").style.zIndex = 1566638; document.getElementById("AdFContainer").style.zIndex = 1566639; if((this.engineIE < 7 && this.engineIE) || this.isIE6) { noFixedPosition =(PageSize[3]/2)+ScrollOffsets[1]; document.getElementById("AdFContainer").style.top = ""+noFixedPosition+"px"; } document.getElementById("AdFClose").onclick = function(){ AdFEngine.hide(); } }; AdFEngine.prototype.flatfee = function(AdChannelCode) { AdFEngine.resize(720, 430); if(this.flashPlugin && this.mobileBrowser==0) { document.getElementById("AdFLoader").innerHTML = this.flashLoader; document.getElementById("AdFLoader").style.display = "block"; document.getElementById("AdFLoader").style.position = "fixed"; document.getElementById("AdFLoader").style.top = "50%"; document.getElementById("AdFLoader").style.left = "50%"; document.getElementById("AdFLoader").style.marginLeft = "-75px"; document.getElementById("AdFLoader").style.marginTop = "-50px"; document.getElementById("AdFLoader").style.zIndex=AdFEngine.maxZIndex(); } document.getElementById("AdFContent").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=\"AdFFrame\" onload=\"AdFEngine.loaded();\" style=\"display:none;\"></iframe>"; var PageSize = AdFEngine.getPageSize(); var ScrollOffsets = AdFEngine.getScrollOffsets(); if(!this.DoctypeLabel && this.msie!=-1) { if(PageSize[2] == PageSize[0] || (PageSize[2]-16) == PageSize[0]) document.getElementById("AdFOverlay").style.width = "100%"; else document.getElementById("AdFOverlay").style.width = (PageSize[2]-22) + "px"; } else { if(PageSize[2] == PageSize[0] || (PageSize[2]-16) == PageSize[0]) document.getElementById("AdFOverlay").style.width = "100%"; else document.getElementById("AdFOverlay").style.width = PageSize[2] + "px"; } document.getElementById("AdFOverlay").style.height = PageSize[1] + "px"; AdFEngine.Animate(0, this.alpha, 1, "incrase", "AdFEngine.FadeUp", "AdFOverlay"); document.getElementById("AdFContainer").style.display = "block"; document.getElementById("AdFOverlay").style.zIndex = 1566638; document.getElementById("AdFContainer").style.zIndex = 1566639; if((this.engineIE < 7 && this.engineIE) || this.isIE6) { noFixedPosition =(PageSize[3]/2)+ScrollOffsets[1]; document.getElementById("AdFContainer").style.top = ""+noFixedPosition+"px"; } document.getElementById("AdFClose").onclick = function(){ AdFEngine.hide(); } }; AdFEngine.prototype.hide = function() { AdFEngine.Animate(100, 0, 1, "decrase", "AdFEngine.FadeDown", "AdFOverlay"); document.getElementById("AdFContainer").style.display = "none"; }; AdFEngine.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]; }; AdFEngine.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]; }; AdFEngine.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); }; AdFEngine.prototype.banner = function() { }; AdFEngine.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=\"AdFContainer\" class=\"AdFContainer\">"; innerData += "<div id=\"AdFLoader\" class=\"AdFLoader\"></div>"; innerData += "<div id=\"AdFClose\" class=\"AdFClose\"><a><img src=\"http://www.adfreestyle.pl/img/close_b_bt_on.png\" /></a></div>"; /*innerData += "<div id=\"AdFContent\" class=\"AdFContent\"><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=\"AdFFrame\"></iframe></div>"; */ innerData += "<div id=\"AdFContent\" class=\"AdFContent\"><iframe src=\"\" width=\"100%\" height=\"100%\" marginwidth=\"0\" marginheight=\"0\" hspace=\"0\" vspace=\"0\" frameborder=\"0\" scrolling=\"yes\" allowtransparency=\"true\" id=\"AdFFrame\"></iframe></div>"; innerData += "<div id=\"AdFFoot\" class=\"AdFFoot\"><a href=\"http://www.adfreestyle.pl/ref/1ULTww52jif\" title=\"adFreestyle\" target=\"_blank\"><img src=\"http://www.adfreestyle.pl/img/adbox/logo_light.png\" class=\"AdFLogo\" id=\"AdFLogo\" align=\"absmiddle\" alt=\"AdF - system reklamy internetowej, programy partnerskie\" /></a> <a href=\"http://www.adfreestyle.pl/ref/1ULTww52jif\" title=\"adFreestyle\" target=\"_blank\" />AdF - system reklamy internetowej, programy partnerskie</a></div>"; innerData += "</div>"; innerData += "<div id=\"AdFOverlay\"></div>"; innerData += "<style type=\"text/css\">"; innerData += ".AdFContainer {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 += ".AdFLogo {border:none;}"; innerData += ".AdFContent {background-color:transparent;border:none;height:"+(this.adBoxHeight)+"px; width:"+(this.adBoxWidth)+"px;overflow:hidden;padding:0px;margin:0px;}"; innerData += ".AdFOverlay {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 += ".AdFFoot {text-align:right;color:#FFFFFF;height:23px;margin-top:10px;text-shadow: #000000 1px 1px 1px;font:11px Tahoma,Arial,sans-serif;}"; innerData += ".AdFFoot a {border:none;color:#FFFFFF;text-decoration:none;background-color:transparent;}"; innerData += ".AdFFoot a:hover {border:none;color:#FFFFFF;text-decoration:underline;background-color:transparent;}"; innerData += ".AdFFoot a:visited {border:none;color:#FFFFFF;background-color:transparent;}"; innerData += ".AdFFoot a:focus {border:none;color:#FFFFFF;background-color:transparent;}"; innerData += ".AdFFoot img {margin-right:10px;background-color:transparent;border: none !important;padding: 0px !important;margin: 0px !important;}"; innerData += ".AdFLoader {display:none; width:150;height:50px;top:position:fixed;z-index:16777273;top:0px;left:0px;}"; innerData += ".AdFClose {margin-bottom:10px;float:right;width:100%;}"; innerData += ".AdFClose 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 += ".AdFClose 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("AdFOverlay").setAttribute("class", "AdFOverlay"); document.getElementById("AdFContainer").setAttribute("class", "AdFContainer"); document.getElementById("AdFOverlay").setAttribute(document.all ? "className" : "class", "AdFOverlay"); document.getElementById("AdFContainer").setAttribute(document.all ? "className" : "class", "AdFContainer"); }; AdFEngine.prototype.resize = function(newWidth, newHeight) { document.getElementById("AdFContainer").style.width = newWidth+"px"; document.getElementById("AdFContainer").style.marginTop = -(newHeight/2+50)+"px"; document.getElementById("AdFContainer").style.marginLeft = -(newWidth/2+16)+"px"; document.getElementById("AdFContent").style.width = newWidth+"px"; document.getElementById("AdFContent").style.height = newHeight+"px"; document.getElementById("AdFOverlay").style.zIndex=AdFEngine.maxZIndex(); document.getElementById("AdFContainer").style.zIndex=AdFEngine.maxZIndex(); }; AdFEngine.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); } } }; AdFEngine.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"; }; AdFEngine.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(AdFEngine) == "function"){ var AdFEngine = new AdFEngine(); AdFEngine.run();}
