if(typeof(Ankama)=="undefined"){var Ankama={}}if(typeof(Ankama.Ads)=="undefined"){Ankama.Ads={bConstruct:null,bDomReady:true,iMouseX:null,iMouseY:null,aZone:new Array(),aVars:{},DIVNAME:"ankama_ads",DomReady:function(a){this.bDomReady=a},CallAgain:function(){var a=false;for(i in Ankama.Ads.aZone){if(typeof(Ankama.Ads.aZone[i])!="function"&&typeof(Ankama.Ads.aZone[i].content)!="undefined"&&Ankama.Ads.aZone[i].content.type!="HTML"){a=true;Ankama.Ads.aZone[i].inserted=false}}if(a){Ankama.Ads._Call()}},Call:function(){Ankama.Ads._Call()},_Domain:function(){var a=document.location.host.substring(document.location.host.lastIndexOf(".")+1);if(a=="com"||a=="dev"||a=="lan"){return a}else{return"com"}},Insert:function(e){for(var f in Ankama.Ads.aZone){if(typeof(Ankama.Ads.aZone[f])!="function"){var b=Ankama.Ads.aZone[f];if((typeof(b.inserted)=="undefined"&&typeof(b.inserted)!="function")||b.inserted!=true){var a=document.getElementById(b.id);if(a&&e[b.zone]){if(e[b.zone].type!="HTML"){for(var d in a.childNodes){if(typeof(a.childNodes[d])!="function"&&a.childNodes[d].className=="ankama_ads_inserted"){a.removeChild(a.childNodes[d])}}}a.appendChild(this._GenerateAds(b.zone,e[b.zone]));if(e[b.zone].type=="HTML"){var c=document.getElementById(b.display_id);c.style.display="block";c.style.height=document.body.offsetHeight+"px";var h="visible";var g="visible";var l="auto";var n="visible";var m="visible";var k="auto";if(document.body.style.overflow!=""&&document.body.style.overflow!="undefined"){h=document.body.style.overflow;g=document.body.style.overflow}if(document.body.style.overflowX!=""&&document.body.style.overflowX!="undefined"){h=document.body.style.overflowX}if(document.body.style.overflowY!=""&&document.body.style.overflowY!="undefined"){g=document.body.style.overflowY}if(document.body.style.height!=""&&document.body.style.height!="undefined"){l=document.body.style.height}if(window.document.documentElement.style.overflow!=""&&window.document.documentElement.style.overflow!="undefined"){n=window.document.documentElement.style.overflow;m=window.document.documentElement.style.overflow}if(window.document.documentElement.style.overflowX!=""&&window.document.documentElement.style.overflowX!="undefined"){n=window.document.documentElement.style.overflowX}if(window.document.documentElement.style.overflowY!=""&&window.document.documentElement.style.overflowY!="undefined"){m=window.document.documentElement.style.overflowY}if(window.document.documentElement.style.height!=""&&window.document.documentElement.style.height!="undefined"){k=window.document.documentElement.style.height}document.body.style.overflow="hidden";document.body.style.overflowX="hidden";document.body.style.overflowY="hidden";document.body.style.height="100%";window.document.documentElement.style.overflow="hidden";window.document.documentElement.style.overflowX="hidden";window.document.documentElement.style.overflowY="hidden";window.document.documentElement.style.height="100%";window.setTimeout(function(){document.body.style.overflow="visible";document.body.style.overflowX=h;document.body.style.overflowY=g;document.body.style.height=l;window.document.documentElement.style.overflow="visible";window.document.documentElement.style.overflowX=n;window.document.documentElement.style.overflowY=m;window.document.documentElement.style.height=k;c.style.display="none"},e[b.zone].hidetime?e[b.zone].hidetime*1000:10000)}}b.inserted=true;b.content=e[b.zone]}}}},_GenerateAds:function(c,b){switch(b.type){case"IMAGE":var e=this._GenerateImage(c,b);e.onclick=function(){return Ankama.Ads.Click(c)};e.onmouseover=function(){window.status=b.url;return true};e.onmouseout=function(){window.status="";return true};break;case"FLASH":var e=this._GenerateFlash(c,b);if(e&&typeof(e.children)!="undefined"&&e.children.length>1){e.children[1].onclick=function(){return Ankama.Ads.Click(c)}}else{e.onclick=function(){return Ankama.Ads.Click(c)}}e.onmouseover=function(){window.status=b.url;return true};e.onmouseout=function(){window.status="";return true};break;case"HTML":var e=this._GenerateHtml(c,b);var j=/<a\s+[^>]*>/gi;var h=/href="([^"]*)"/i;var l=/target="([^"]*)"/i;var g=e.innerHTML.match(j);if(g.length>0){for(var f=0;f<g.length;f++){l.exec(g[f]);var a=RegExp.$1;h.exec(g[f]);var d=RegExp.$1;var k=new RegExp(g[f],"g");var m=e.innerHTML.replace(k,'<a href="javascript:void(0);" onclick="return Ankama.Ads.Click('+c+", '"+d+"', '"+a+"')\">");e.innerHTML=m}}else{e.style.cursor="pointer";e.onclick=function(){return Ankama.Ads.Click(c)};e.onmouseover=function(){window.status=b.url;return true};e.onmouseout=function(){window.status="";return true}}break}return e},_GenerateFlash:function(d,b){var h=new Array();h.quality="high";h.menu="false";h.AllowScriptAccess="always";h.wmode="transparent";h.flashvars="linkfunction=Ankama.Ads.Click&zone="+d;var g='<object id="ak_ads_zone_'+d+'" '+((window.ActiveXObject)?' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" data="'+b.file+'"':"");g+=' width="'+b.width+'"  height="'+b.height+'">';g+='<param name="movie" value="'+b.file+'">';var f="";var c="";for(var e in h){if(typeof(h[e])!="function"){f+='<param name="'+e+'" value="'+h[e]+'">';c+=" "+e+'="'+h[e]+'"'}}g+=f;g+='<embed id="ak_ads_emb_zone_'+d+'" src="'+b.file+'" width="'+b.width+'" height="'+b.height+'"';g+=' type="application/x-shockwave-flash"'+c+"></embed>";g+="</object>";var a=document.createElement("div");var j=document.createElement("div");a.style.position="relative";j.style.position="absolute";a.style.cssFloat="left";j.style.cssFloat="left";j.style.zIndex="9999";j.style.cursor="pointer";j.style.left="0px";j.style.top="0px";j.style.height=b.height+"px";j.style.width=b.width+"px";a.innerHTML=g;a.appendChild(j);a.className="ankama_ads_inserted";return a},_GenerateHtml:function(c,b){var a=document.createElement("div");a.innerHTML=b.html;a.className="ankama_ads_inserted";return a},_GenerateImage:function(d,b){var c=document.createElement("a");if(b){c.href=b.link;c.className="ankama_ads_inserted";switch(b.target){case"BLANK":c.target="_blank";break}var a=document.createElement("img");a.style.border=0;a.src=b.file;a.width=b.width;a.height=b.height;c.appendChild(a)}return c},_GetPosition:function(d){var a=d;var c=0;var b=0;while(a!=null&&a.tagName!="BODY"){c+=a.offsetTop;b+=a.offsetLeft;a=a.offsetParent}return{x:b,y:c}},_GetClickZone:function(b){if(this.iMouseX!=null&&this.iMouseY!=null){var a=this._GetPosition(b);return{x:this.iMouseX-a.x,y:this.iMouseY-a.y}}},_ReturnVars:function(a){sReturn="";if(document.referrer&&typeof(document.referrer)=="string"&&document.referrer.indexOf("?")!=-1){sReturn+="&referer="+escape(document.referrer.substr(0,document.referrer.indexOf("?")))}else{if(document.referrer&&typeof(document.referrer)=="string"){sReturn+="&referer="+escape(document.referrer)}}for(i in this.aVars){if(typeof(this.aVars[i])!="undefined"&&typeof(this.aVars[i])!="function"){sReturn+="&"+i+"="+this.aVars[i]}}for(i in a){if(typeof(a[i])!="undefined"&&typeof(a[i])!="function"){sReturn+="&"+i+"="+a[i]}}return sReturn},_Call:function(){var c=false;var b=new Array();for(i in Ankama.Ads.aZone){if(typeof(Ankama.Ads.aZone[i])!="function"){c=true;b.push(Ankama.Ads.aZone[i].zone)}}if(c){var a=document.createElement("script");a.type="text/javascript";a.src=(window.location.protocol=="https:"?"https:":"http:")+"//ads.ankama."+Ankama.Ads._Domain()+"/view?q="+b.join("-")+Ankama.Ads._ReturnVars();document.body.insertBefore(a,document.body.firstChild)}},MousePosition:function(a){if(!a){var a=window.event}if(a.pageX||a.pageY){this.iMouseX=a.pageX;this.iMouseY=a.pageY}else{if(a.clientX||a.clientY){this.iMouseX=parseInt(a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft);this.iMouseY=parseInt(a.clientY+document.body.scrollTop+document.documentElement.scrollTop)}}},_Construct:function(){this.bConstruct=true;if(this.bDomReady==true){Ankama._DomReady={};this._DomReady(this._Call)}var a=document.onmousemove;document.onmousemove=function(b){Ankama.Ads.MousePosition(b);if(a){a(b)}}},Zone:function(c,b){if(this.bConstruct!=true){this._Construct()}if(typeof(b)=="undefined"&&typeof(b)!="function"){b=this.DIVNAME+"_"+c;var a=true}else{var a=false}if(typeof(b)=="string"){if(a){document.write('<div id="'+this.DIVNAME+"_"+c+'"></div>')}this.aZone[c]={zone:c,id:b}}else{this.aZone[c]={zone:c,id:b[0],display_id:b[1]}}},Vars:function(a){for(i in a){if(typeof(a[i])!="undefined"&&typeof(a[i])!="function"){this.aVars[i]=a[i]}}},Click:function(g,f,c){for(i in Ankama.Ads.aZone){if(typeof(Ankama.Ads.aZone[i])!="function"){if(Ankama.Ads.aZone[i].zone==g){var d=Ankama.Ads.aZone[i];var e=(typeof(f)!="undefined")?f:d.content.link;var b=d.id?d.id:this.DIVNAME+"_"+d.zone;var a=this._GetClickZone(document.getElementById(b));if(a&&typeof(f)=="undefined"){e+="&x="+a.x+"&y="+a.y}if(typeof(c)=="string"){if(c==""||c=="_self"){window.location.href=e}else{window.open(e,c)}}else{switch(d.content.target){case"BLANK":window.open(e);break;default:window.location.href=e;break}}}}}return false},_DomReady:function(b){if(Ankama._DomReady.loaded){return b()}var e=Ankama._DomReady.observers;if(!e){e=Ankama._DomReady.observers=[]}e[e.length]=b;if(Ankama._DomReady.callback){return}Ankama._DomReady.callback=function(){if(Ankama._DomReady.loaded){return}Ankama._DomReady.loaded=true;if(Ankama._DomReady.timer){clearInterval(Ankama._DomReady.timer);Ankama._DomReady.timer=null}var j=Ankama._DomReady.observers;for(var f=0,h=j.length;f<h;f++){var g=j[f];j[f]=null;g()}Ankama._DomReady.callback=Ankama._DomReady.observers=null};var d=!!(window.attachEvent&&!window.opera);var a=navigator.userAgent.indexOf("AppleWebKit/")>-1;if(document.readyState&&a){Ankama._DomReady.timer=setInterval(function(){var f=document.readyState;if(f=="loaded"||f=="complete"){Ankama._DomReady.callback()}},50)}else{if(false&&document.readyState&&d){var c=(window.location.protocol=="https:")?"://0":"javascript:void(0)";document.write('<script type="text/javascript" defer="defer" src="'+c+'" onreadystatechange="if (this.readyState == \'complete\') Ankama._DomReady.callback();"><\/script>')}else{if(window.addEventListener){document.addEventListener("DOMContentLoaded",Ankama._DomReady.callback,false);window.addEventListener("load",Ankama._DomReady.callback,false)}else{if(window.attachEvent){window.attachEvent("onload",Ankama._DomReady.callback)}else{var b=window.onload;window.onload=function(){Ankama._DomReady.callback();if(b){b()}}}}}}}}};
