(function(a,b){if(typeof a.topadvert!=="undefined"){return}var c=(function(){var f={};var e={};var d={};d.registerClass=function(h,g){if(e.hasOwnProperty(h)){return}e[h]=g};d.getClass=function(g){if(!f.hasOwnProperty(g)){if(e.hasOwnProperty(g)){f[g]=(e[g])()}}return f[g]};return d})();c.registerClass("Object",function(){var d=function(){};(function(){var e=false;var f=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;d.extend=function(l){var i=this.prototype;e=true;var h=new this();e=false;for(var g in l){if(!l.hasOwnProperty(g)){continue}var j=l[g];if(typeof l[g]==="function"&&typeof i[g]==="function"&&f.test(l[g])){j=(function(m,n){return function(){var p=this._super;this._super=i[m];var o=n.apply(this,arguments);this._super=p;return o}})(g,l[g])}h[g]=j}function k(){if(!e&&this.init){this.init.apply(this,arguments)}}k.prototype=h;k.constructor=k;k.extend=arguments.callee;return k}})();return d});c.registerClass("Utils",function(){var d=function(i){return toString.call(i)==="[object Array]"};var g=function(j){for(var i in j){return false}return true};var f=function(j){if(!j||toString.call(j)!=="[object Object]"||j.nodeType||j.setInterval){return false}if(j.constructor&&!hasOwnProperty.call(j,"constructor")&&!hasOwnProperty.call(j.constructor.prototype,"isPrototypeOf")){return false}var i;for(i in j){}return i===b||hasOwnProperty.call(j,i)};var h=function(){var o=arguments[0]||{},n=1,m=arguments.length,q=false,r,l,j,k;if(typeof o==="boolean"){q=o;o=arguments[1]||{};n=2}if(typeof o!=="object"&&!jQuery.isFunction(o)){o={}}for(;n<m;n++){if((r=arguments[n])!=null){for(l in r){j=o[l];k=r[l];if(o===k){continue}if(q&&k&&(f(k)||d(k))){var p=j&&(f(j)||d(j))?j:d(k)?[]:{};o[l]=h(q,p,k)}else{if(k!==b){o[l]=k}}}}}return o};var e=c.getClass("Object");e.extendObject=h;e.getRandomToken=function(){var n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghijklmnopqrstuvwxyz";var j=n.length;var m="";for(var l=0;l<10;++l){var k=Math.floor(Math.random()*j);if(k>=j){k=j-1}m+=n.charAt(k)}return m};e.strip=function(i){return i.replace(/^\s+/,"").replace(/\s+$/,"")};e.getHead=function(){return document.getElementsByTagName("head")[0]||document.documentElement};e.getReferer=function(){var i=document.referrer;if(i==null){i=""}if(i.length>255){i=i.substring(0,255)}return i};e.sendRequest=function(j,k){var i=document.createElement("script");if(k==null){k="topadvertScript"+e.getRandomToken()}i.type="text/javascript";i.setAttribute("src",j);i.setAttribute("id",k);i.setAttribute("charset","utf-8");i.setAttribute("defer","defer");i.setAttribute("async","async");e.getHead().appendChild(i)};e.sendImgRequest=function(j){var i=document.createElement("img");i.setAttribute("src",j)};return e});c.registerClass("Timer",function(){var d=c.getClass("Object").extend({init:function(){var e=this._getTime();this._t0=e;this._t1=e},_getTime:function(){var f=new Date();var e=f.getTime();return e},tic:function(){this._t0=this._getTime();this._t1=this._t0;return this._t0},toc:function(){this._t1=this._getTime();var e=this._t1-this._t0;return e}});return d});c.registerClass("Browser",function(){var e;var d=c.getClass("Object").extend({init:function(){this._loaded=false;this._onLoadFunctions=[];var f=this;var g=function(){if(f._loaded){return}f._loaded=true;var h=f._onLoadFunctions.length;for(var j=0;j<h;++j){f._onLoadFunctions[j]()}};(function(){if(document.readyState==="complete"){return g()}if(document.addEventListener){var i=function(){document.removeEventListener("DOMContentLoaded",i,false);g()};document.addEventListener("DOMContentLoaded",i,false);a.addEventListener("load",g,false)}if(document.attachEvent){var h=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",h);g()}};document.attachEvent("onreadystatechange",h);a.attachEvent("onload",g)}})()},loaded:function(){return this._loaded},onLoad:function(g){this._loaded?g():this._onLoadFunctions.push(g)},isAsync:function(){return a.opera?false:true},isIE:function(){return false}});d.getInstance=function(){if(e==null){e=new d()}return e};return d});c.registerClass("Context.Const",function(){var d=c.getClass("Object").extend({});d.MAX_TIME=500;d.TRUNCATE_WORDS_COUNT=50;return d});c.registerClass("Context.Timer",function(){var f=c.getClass("Context.Const").MAX_TIME;var d=function(){var h=new Date();return h.getTime()};var g=d();var e=c.getClass("Object").extend({});e.timeIsOver=function(){var h=d();if(h-g>f){return true}return false};return e});c.registerClass("Context.Variable.ContextData",function(){var g=c.getClass("Context.Const").TRUNCATE_WORDS_COUNT;var h=c.getClass("Context.Timer");var f=(function(){var m=["ru","\u0430","\u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e","\u0431\u043e\u043b\u044c\u0448\u0435","\u0431\u0443\u0434\u0435\u0442","\u0431\u044b","\u0431\u044b\u0432\u0430\u0435\u0442","\u0431\u044b\u043b","\u0431\u044b\u043b\u043e","\u0431\u044b\u0442\u044c","\u0432","\u0432\u0430\u0448\u0438","\u0432\u0435\u0441\u044c","\u0432\u043e","\u0432\u043e\u0442","\u0432\u0441\u0435","\u0432\u044b","\u0433\u0434\u0435","\u0433\u0434\u0435-\u0442\u043e","\u0433\u043e\u0434","\u0433\u043e\u0432\u043e\u0440\u0438\u0442","\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c","\u0433\u0440","\u0434\u0430","\u0434\u043b\u044f","\u0434\u043e","\u0434\u043e\u043b\u0433\u043e","\u0434\u043e\u043b\u0433\u0438\u0439","\u0434\u0440\u0443\u0433\u043e\u0439","\u0435\u0433\u043e","\u0435\u0435","\u0435\u0439","\u0435\u0441\u043b\u0438","\u0435\u0441\u043b\u0438","\u0435\u0441\u0442\u044c","\u0435\u0449\u0435","\u0436\u0435","\u0437\u0430","\u0437\u0430\u0447\u0435\u043c","\u0438","\u0438\u0437","\u0438\u0437-\u0437\u0430","\u0438\u043c","\u0438\u043b\u0438","\u043a","\u043a\u0430\u043a","\u043a\u0430\u043a\u043e\u0439-\u0442\u043e","\u043a\u0433","\u043a\u0442\u043e","\u043a\u0442\u043e-\u0442\u043e","\u043c\u0435\u043d\u044f","\u043c\u043d\u0435","\u043c\u043e\u0436\u043d\u043e","\u043c\u044b","\u043d\u0430","\u043d\u0430\u0434","\u043d\u0435","\u043d\u0435\u0433\u043e","\u043d\u0435\u0434\u043e\u0440\u043e\u0433\u043e\u0439","\u043d\u0435\u0435","\u043d\u0435\u0439","\u043d\u0435\u0442","\u043d\u0435\u0447\u0435\u0433\u043e","\u043d\u0438","\u043d\u0438\u0447\u0435\u0433\u043e","\u043d\u043e","\u043d\u0443\u0436\u043d\u043e","\u043e","\u043e\u0431\u0437\u043e\u0440","\u043e\u0431\u0437\u043e\u0440\u044b","\u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435","\u043e\u043d","\u043e\u043d\u0430","\u043e\u043d\u0438","\u043e\u043d\u043e","\u043e\u043f\u044f\u0442\u044c","\u043e\u0442","\u043e\u0442\u0437\u044b\u0432","\u043e\u0442\u0437\u044b\u0432\u044b","\u043e\u0447\u0435\u043d\u044c","\u043f\u043e","\u043f\u043e\u0434","\u043f\u043e\u0434\u043e\u043b\u044c\u0448\u0435","\u043f\u043e\u043a\u0443\u043f\u0430\u0442\u0435\u043b\u0435\u0439","\u043f\u043e\u043a\u0443\u043f\u0430\u0442\u0435\u043b\u044c","\u043f\u043e\u0441\u043b\u0435","\u043f\u043e\u0447\u0442\u0438","\u043f\u043e\u044d\u0442\u043e\u043c\u0443","\u043f\u0440\u0438","\u043f\u0440\u0438 \u044d\u0442\u043e\u043c","\u043f\u0440\u043e","\u043f\u0440\u043e\u0449\u0435","\u0440\u0443","\u0440\u0443\u0431","\u0441","\u0441\u043a\u0430\u0437\u0430\u0442\u044c","\u0441\u043e","\u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e","\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435","\u0441\u0441\u044b\u043b\u043a\u0430","\u0441\u043a\u0430\u0447\u0430\u0442\u044c","\u0442\u0430\u043a","\u0442\u044b","\u0442\u043e","\u0442\u043e\u0436\u0435","\u0442\u043e\u043b\u044c\u043a\u043e","\u0443","\u0443\u0436\u0435","\u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438","\u0445\u043e\u0440\u043e\u0448\u0438\u0439","\u0446\u0435\u043d\u0430","\u0446\u0435\u043d\u044b","\u0447\u0435\u0440\u0435\u0437","\u0447\u0438\u0442\u0430\u0442\u044c","\u0447\u0442\u043e","\u0447\u0442\u043e\u0431\u044b","\u0447\u0442\u043e-\u0442\u043e","\u044d\u0442\u0430","\u044d\u0442\u0438","\u044d\u0442\u0438\u043c","\u044d\u0442\u0438\u0445","\u044d\u0442\u0438\u0445","\u044d\u0442\u043e","\u044d\u0442\u043e\u0433\u043e","\u044d\u0442\u043e\u0439","\u044d\u0442\u043e\u043c","\u044d\u0442\u043e\u0442","\u044f"];var k={};for(var j=0;j<m.length;++j){var l=m[j];k[l]=true}return k})();var d=(function(){var l=["\u0440\u0444","aero","ag","biz","bz","cc","com","hn","info","lc","me","mn","mobi","name","net","org","pro","ru","sc","su","tel","travel","tv","vc"];var i="("+l.join("|")+")";var k="(^|\\s)([a-zA-Z\\d]([a-zA-Z\\d\\-]{0,61}[a-zA-Z\\d])?\\.)+"+i+"(\\s|$)";var j=new RegExp(k,"gm");return j})();var e=c.getClass("Object").extend({init:function(){this._array=[];this._hash={}},addString:function(n){var j=n.replace(d,"");j=j.toLowerCase();j=j.replace(/[\.,;:]+/g," | ");j=j.replace(/[^a-z\u0430-\u044f\u04510-9\-\|]+/gi," ");j=c.getClass("Utils").strip(j);if(j===""){this._addWord(null,false);return}var m=j.split(/\s+/);for(var k=0;k<m.length;++k){var l=m[k];if(l==="|"||l==null||l.length<=1||l.match(/^\-+$/)||l.match(/^\d{1,3}$/)||l.match(/^\d+\-\d+$/)||f[l]){l=null}this._addWord(l,true)}},addContextData:function(k){this._array.push(null);var j=k._array;for(var l=0;l<j.length;++l){this._addWord(j[l],false)}},_addWord:function(j,i){if(i){if(h.timeIsOver()){return false}}this._array.push(j);if(j!=null){if(this._hash[j]==null){this._hash[j]=0}this._hash[j]+=1}return true},_sort:function(j,i){if(i[1]>j[1]){return 1}if(i[1]<j[1]){return -1}if(j[0]>i[0]){return 1}if(j[0]<i[0]){return -1}return 0},_getTrimmedHash:function(){var o=this._hash;var p=[];for(var n in o){if(!o.hasOwnProperty(n)){continue}p.push([n,o[n]])}p.sort(this._sort);var m=p.slice(0,g);var j={};for(var k=0;k<m.length;++k){var l=m[k];j[l[0]]=l[1]}return j},getResult:function(){var r=this._array;var q=this._getTrimmedHash();var l={};var s=function(i){if(i==null||q[i]==null){return true}return false};for(var o=0;o<r.length;++o){if(s(r[o])){continue}for(var n=o;n<r.length;++n){if(s(r[n])){break}}var p=r.slice(o,n);var m=p.join(" ");if(l[m]==null){l[m]=0}++l[m];o=n}var t=[];for(var j in l){if(!l.hasOwnProperty(j)){continue}t.push([j,l[j]])}t.sort(this._sort);return t}});return e});c.registerClass("Context.Variable.AbstractContext",function(){var d=c.getClass("Object").extend({getContextData:function(){this._contextData=new (c.getClass("Context.Variable.ContextData"))();this._process();this._cacheContextData(this._contextData);return this._contextData},_addStringToContext:function(e){this._contextData.addString(e)},_addStructToContext:function(e){this._contextData.addContextData(e)},_cacheContextData:function(e){},_process:function(){}});return d});c.registerClass("Context.Variable.StringContext",function(){var d=c.getClass("Context.Variable.AbstractContext").extend({init:function(e){this._string=e},_process:function(){this._addStringToContext(this._string)}});return d});c.registerClass("Cache.ElementCache",function(){var d=c.getClass("Object").extend({init:function(){this._id=0;this._cache={};this._expando="topadvert"+c.getClass("Utils").getRandomToken()},get:function(g,f){if(g[this._expando]==null){return}var i=g[this._expando];var e=this._cache[i];var h=(e==null)?null:e[f];return h},set:function(f,e,g){if(f[this._expando]==null){f[this._expando]=++this._id}var h=f[this._expando];this._cache[h]={};this._cache[h][e]=g}});return d});c.registerClass("Cache.ElementHash",function(){var d=c.getClass("Object").extend({init:function(){this._key="elemHash"+c.getClass("Utils").getRandomToken();this._cache=new (c.getClass("Cache.ElementCache"))()},get:function(e){return this._cache.get(e,this._key)},set:function(e,f){this._cache.set(e,this._key,f)}});return d});c.registerClass("Context.Variable.ElementContext",function(){var e={ELEMENT_NODE:1,TEXT_NODE:3};var f=new (c.getClass("Cache.ElementHash"))();var g=c.getClass("Context.Timer");var d=c.getClass("Context.Variable.AbstractContext").extend({init:function(h){this._elem=h;this._domain=this._getDomain(a.location.href);this._domainBase=this._getDomainBase()},_cacheContextData:function(h){f.set(this._elem,h)},_process:function(){this._processElement(this._elem)},_getDomain:function(h){if(h.match(/^http(s)?\:\/\//)){h=h.replace(/^http(s)?\:\/\//,"");h=h.replace(/^www\./,"");var i=h.match(/^[a-z0-9\.\-]+/i);return(i!=null)?i[0]:null}return null},_getDomainBase:function(){var h=document.getElementsByTagName("base");for(var j=0;j<h.length;++j){var l=h[j];if(l.href!=null){var k=this._getDomain(l.href);if(k!=null){return k}}}return null},_isNodeToProcess:function(j){if(j.style.visibility==="hidden"){return false}if(j.style.display==="none"){return false}var i=j.tagName.toUpperCase();if(i==="NOSCRIPT"||i==="STYLE"||i==="SCRIPT"){return false}if(i==="A"){var h=j.attributes.getNamedItem("href");if(h!=null){var k=this._getDomain(h.value);if(k==null||k===this._domain||k===this._domainBase){return true}return false}}return true},_processElement:function(j){if(g.timeIsOver()){return}var k=f.get(j);if(k!=null){this._addStructToContext(k);return}for(var h=0;h<j.childNodes.length;++h){var m=j.childNodes[h];if(m.nodeType===e.TEXT_NODE){var l=m.nodeValue;if(/^<a/i.test(l)&&/<\/a>/i.test(l)){continue}this._addStringToContext(l)}else{if(m.nodeType===e.ELEMENT_NODE){if(this._isNodeToProcess(m)){this._processElement(m)}}}}}});return d});c.registerClass("Context.Variable.ContextCreator",function(){var d=c.getClass("Object").extend({_createContext:function(e,l){var g=new (c.getClass("Context.Variable.ContextData"))();for(var j=0;j<l.length;++j){var k=l[j];var h=new e(k);var f=h.getContextData();g.addContextData(f)}return g.getResult()},createFromStrings:function(e){var f=c.getClass("Context.Variable.StringContext");return this._createContext(f,e)},createFromElements:function(e){var f=c.getClass("Context.Variable.ElementContext");return this._createContext(f,e)}});return d});c.registerClass("Context.Context",function(){var e;var d=c.getClass("Object").extend({init:function(){this._timer=new (c.getClass("Timer"))();this._browser=c.getClass("Browser").getInstance();this._lastDomElement=null;this._prevTimePoint=this._timer.tic()},_getLastDomElement:function(){var f=document.getElementsByTagName("body")[0];while(f!=null){var g=f.lastChild;if(g==null){return f}f=g}return f},_needToWait:function(){if(this._timer.toc()>500||this._browser.loaded()){return false}else{var g=this._timer.toc();var f=this._getLastDomElement();if(g-this._prevTimePoint>100){if(f==null){return true}if(f===this._lastDomElement){return false}this._lastDomElement=f;this._prevTimePoint=g}}return true},defineContext:function(){if(this._isFinished){return true}if(this._needToWait()){return false}var p={};var l=new (c.getClass("Context.Variable.ContextCreator"))();p.tt=l.createFromStrings([document.title]);var o=["h1","h2","h3","h4"];for(var j=0;j<o.length;++j){var f=o[j];var g=document.getElementsByTagName(f);p[f]=l.createFromElements(g)}var m=document.getElementsByName("topadvert_context_label");for(var j=0;j<m.length;++j){var n=m[j];var h=n.value;p[h]=l.createFromElements([n.parentNode])}var k=document.body;if(k!=null&&p.body==null){p.body=l.createFromElements([k])}this._context=p;this._isFinished=true;return true},getData:function(){var h=this._context;var f=[];for(varName in h){if(!h.hasOwnProperty(varName)){continue}var g=h[varName];if(g.length>0){f.push([varName,h[varName]])}}return f}});d.getInstance=function(){if(!e){e=new d()}return e};return d});c.registerClass("Encoding.Abstract.SimpleEncoder",function(){var d=c.getClass("Object").extend({encode:function(e){},decode:function(e){}});return d});c.registerClass("Encoding.JSCompression.SimpleEncoder",function(){var f="_";var d="~";var e=c.getClass("Encoding.Abstract.SimpleEncoder").extend({init:function(){this._currentLang="en";this._firstLang=null;var g={};var h={};var l={all:{singleChars:"0123456789- ",singleMaps:"0123456789-+",doubleChars:"~_!@#$%^&*()+=`{}[]\\|:;\"'?/,\u2116<>.\u00ab\u00bb",doubleMaps:"Xx1234567890prVbBlLWIdDQqvwzNGgfkK"},en:{singleChars:"abvgdeqzijklmnoprstufhcyxwABVGDEQZIJKLMNOPRSTUFHCYXW",singleMaps:"abvgdeqzijklmnoprstufhcyxwABVGDEQZIJKLMNOPRSTUFHCYXW",doubleChars:"",doubleMaps:""},ru:{singleChars:"\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u044b\u044d\u044e\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u042b\u042d\u042e",singleMaps:"abvgdeqzijklmnoprstufhcyxwABVGDEQZIJKLMNOPRSTUFHCYXW",doubleChars:"\u0451\u0447\u0448\u0449\u044a\u044c\u044f\u0401\u0427\u0428\u0429\u042a\u042c\u042f",doubleMaps:"ecshtmaECSHTMA"}};for(var k in l){if(!l.hasOwnProperty(k)){continue}var j=function(q,m,n){var r=q.split("");var t=m.split("");for(var p=0;p<r.length;++p){var o=r[p];var s=n?d+t[p]:t[p];g[o]=[s,k];if(h[k]==null){h[k]={}}h[k][s]=o}};var i=l[k];j(i.singleChars,i.singleMaps,false);j(i.doubleChars,i.doubleMaps,true)}this._encode=function(s,t){if(t!=null){this._currentLang=t}var r=s.split("");var u="";for(var q=0;q<r.length;++q){var n=g[r[q]];if(n==null){n=g[" "]}var p="";var m=n[1];if(m!==this._currentLang&&m!=="all"){this._currentLang=m;p=f+m+f}var o=p+n[0];u+=o}this._firstLang=(u.charAt(0)===f)?u.substring(1,2):"en";return u};this._decode=function(t){var m="";var r="en";for(var p=0;p<t.length;++p){var q=t.charAt(p);if(q===f){var o=t.indexOf(q,p+1);if(o<0){return null}var s=t.substring(p+1,o);if(h[s]==null){return null}r=s;p+=o-p;continue}if(q===d){p+=1;if(p===t.length){return null}q+=t.charAt(p)}var n=h.all[q];if(n==null){n=h[r][q]}if(n==null){return null}m+=n}return m}},encodeWithPrevLang:function(h,g){if(g==null){g="en"}if(typeof h==="boolean"){h=h?"1":"0"}if(typeof h==="number"){h+=""}if(typeof h==="string"){return this._encode(h,g)}return""},encode:function(g){return this.encodeWithPrevLang(g)},decode:function(g){return this._decode(g)},getFirstLanguage:function(){return this._firstLang},getLastLanguage:function(){return this._currentLang}});e.getPageChar=function(){return f};return e});c.registerClass("URLParams",function(){var e;var d=c.getClass("Object").extend({init:function(){this._encoder=new (c.getClass("Encoding.JSCompression.SimpleEncoder"))()},get:function(){var f={};var g=a.location.href;var m=/[\?\&]topadvert_params=(.*?)(\&|$)/.exec(g);if(m!=null){var q=this._encoder.decode(m[1]);var o=q.split("&");for(var k=0;k<o.length;++k){var n=/^(.*?)=(.*?)$/.exec(o[k]);if(n!=null){f[RegExp.$1]=this._encoder.decode(RegExp.$2)}}}var j={pattern_id:null,common_params:{},components_params:{}};for(var r in f){if(f.hasOwnProperty(r)){if(r==="pattern_id"){j.pattern_id=f[r]}else{var m=/^(.*?):(.*?)$/.exec(r);if(m!=null){var p=RegExp.$1;var l=RegExp.$2;var h=j.components_params[p];if(h==null){h={};j.components_params[p]=h}h[l]=f[r]}else{j.common_params[r]=f[r]}}}}return j},set:function(m){var p;var l=this;var j=function(s,t){return s+"="+l._encoder.encode(t)};var g=m.url;var h=m.pattern_id;var k=m.common_params;var q=m.components_params;var f=[];f.push(j("pattern_id",h));if(k!=null){for(p in k){if(k.hasOwnProperty(p)){f.push(j(p,k[p]))}}}if(q!=null){for(var n in q){if(q.hasOwnProperty(n)){var i=q[n];for(p in i){if(i.hasOwnProperty(p)){f.push(j(n+":"+p,i[p]))}}}}}var o=f.join("&");var r=/\?/.test(g)?"&":"?";g=g+r+"topadvert_params="+this._encoder.encode(o);return g}});d.getInstance=function(){if(!e){e=new d()}return e};return d});c.registerClass("Request.Const",function(){var d=c.getClass("Object").extend({});d.ENCODE_JSCOMP="jscomp";d.ENCODE_URI_COMPONENT="encodeuricomponent";return d});c.registerClass("Encoding.Abstract.EncoderFactory",function(){var d=c.getClass("Object").extend({createSimpleEncoder:function(){},createBufferedEncoder:function(){}});return d});c.registerClass("Encoding.Abstract.BufferedEncoder",function(){var d=c.getClass("Object").extend({init:function(e){},addString:function(f,e){},getResult:function(){}});return d});c.registerClass("Encoding.JSCompression.BufferedEncoder",function(){var e=c.getClass("Encoding.JSCompression.SimpleEncoder").getPageChar();var d=c.getClass("Encoding.Abstract.BufferedEncoder").extend({init:function(f){this._result="";this._firstLanguage=null;this._lastLanguage="en";this._encoder=new (c.getClass("Encoding.JSCompression.SimpleEncoder"))()},addString:function(h,f){var g=this._encoder.encodeWithPrevLang(h,this._lastLanguage);if(f!=null){if(g.length>f){return -1}}this._result+=g;this._lastLanguage=this._encoder.getLastLanguage();if(this._firstLanguage==null){this._firstLanguage=this._encoder.getFirstLanguage()}return g.length},getResult:function(){var f=this._result;if(f===""){return""}if(f.charAt(0)!==e){f=e+this._firstLanguage+e+f}return f}});return d});c.registerClass("Encoding.JSCompression.EncoderFactory",function(){var d=c.getClass("Encoding.Abstract.EncoderFactory").extend({createSimpleEncoder:function(){var e=new (c.getClass("Encoding.JSCompression.SimpleEncoder"))();return e},createBufferedEncoder:function(){var e=new (c.getClass("Encoding.JSCompression.BufferedEncoder"))();return e}});return d});c.registerClass("Encoding.URIComponent.SimpleEncoder",function(){var d=c.getClass("Encoding.Abstract.SimpleEncoder").extend({encode:function(e){return encodeURIComponent(e)},decode:function(e){return decodeURIComponent(e)}});return d});c.registerClass("Encoding.URIComponent.BufferedEncoder",function(){var d=c.getClass("Encoding.Abstract.BufferedEncoder").extend({init:function(){this._result="";this._encoder=new (c.getClass("Encoding.URIComponent.SimpleEncoder"))()},addString:function(g,e){var f=this._encoder.encode(g);if(e!=null){if(f.length>e){return -1}}this._result+=f;return f.length},getResult:function(e){return this._result}});return d});c.registerClass("Encoding.URIComponent.EncoderFactory",function(){var d=c.getClass("Encoding.Abstract.EncoderFactory").extend({createSimpleEncoder:function(){var e=new (c.getClass("Encoding.URIComponent.SimpleEncoder"))();return e},createBufferedEncoder:function(){var e=new (c.getClass("Encoding.URIComponent.BufferedEncoder"))();return e}});return d});c.registerClass("Context.Encoding.Channel",function(){var d=c.getClass("Object").extend({init:function(f,e){this._encoder=e.createBufferedEncoder();this._encoder.addString(f+"~");this._prependDelim=false},addWord:function(j,i,f){var h=(this._prependDelim)?",":"";var e=h+j+":"+i;var g=this._encoder.addString(e,f);if(g>=0){this._prependDelim=true}return g},getResult:function(){return this._encoder.getResult()}});return d});c.registerClass("Context.Encoding.Encoder",function(){var e=c.getClass("Context.Const").TRUNCATE_WORDS_COUNT;var d=c.getClass("Object").extend({init:function(g){var f=g.createSimpleEncoder();this._encoderFactory=g;this._simpleEncoder=f},encodeContext:function(k){var m=k;var j=c.getClass("Context.Context").getInstance();var u=j.getData();var q=[];for(var o=0;o<u.length;++o){var l=(o>0)?";":"";var n=l+u[o][0];var t=new (c.getClass("Context.Encoding.Channel"))(n,this._encoderFactory);m-=t.getResult().length;q.push(t)}mainLoop:for(var r=0;r<e;++r){var v=false;for(var o=0;o<q.length;++o){var g=u[o][1];if(r>=g.length){continue}var f=g[r][0];var p=g[r][1];var s=q[o].addWord(f,p,m);if(s<0){break mainLoop}m-=s;v=true}if(!v){break}}var g=[];for(var o=0;o<q.length;++o){g[o]=q[o].getResult()}var h=g.join("");return h}});return d});c.registerClass("Request.Path",function(){var f=c.getClass("Request.Const").ENCODE_JSCOMP;var d=c.getClass("Request.Const").ENCODE_URI_COMPONENT;var e=c.getClass("Object").extend({init:function(k,g,h){this._fullPath=k;this._prefix="?";var i=2048;this._freeLength=i-k.length;var j;if(g===f){j=new (c.getClass("Encoding.JSCompression.EncoderFactory"))()}else{j=new (c.getClass("Encoding.URIComponent.EncoderFactory"))()}this._encoder=j.createSimpleEncoder();this._encoderFactory=j;this._getParamLength=function(l,m){return l.length+m.length+2};this._addParam=function(m,n){var l=this._getParamLength(m,n);if(l>this._freeLength){return false}this._fullPath+=this._prefix+m+"="+n;this._prefix="&";this._freeLength-=l;return true};this.addParam("rnd",c.getClass("Utils").getRandomToken());this.addParam("v","af1ed2530d");this.addParam("encode",g);this.addParam("post_message",a.postMessage!=null?"1":"0");if(h){this.addParam("referer",c.getClass("Utils").getReferer())}},addParam:function(h,i){var g=this._encoder.encode(i);return this._addParam(h,g)},addContext:function(){var i="context";var g=new (c.getClass("Context.Encoding.Encoder"))(this._encoderFactory);var h=this._freeLength-this._getParamLength(i,"");var j=g.encodeContext(h);this._addParam(i,j)},getFullPath:function(){return this._fullPath}});return e});c.registerClass("Request.Request",function(){var f=c.getClass("Request.Const").ENCODE_JSCOMP;var d=c.getClass("Request.Const").ENCODE_URI_COMPONENT;var e=c.getClass("Object").extend({init:function(i){if(typeof a.topadvertCallbacks==="undefined"){a.topadvertCallbacks={}}var m={url:"http://feed.topadvert.ru/feed",pack:false,timeout:0,onError:null,callback:null,context:true,referer:true,data:null};c.getClass("Utils").extendObject(m,i);var k=c.getClass("Utils").getRandomToken();var h='topadvertCallbacks["'+k+'"]';var g="topadvertCallback"+k;var j=(function(){var o=m.pack?f:d;var q=new (c.getClass("Request.Path"))(m.url,o,m.referer);if(m.data!=null){for(var p in m.data){if(!m.data.hasOwnProperty(p)){continue}var r=m.data[p];q.addParam(p,r)}}if(m.callback){q.addParam("callback",'topadvertCallbacks["'+k+'"]');q.addParam("response_encoding","utf-8")}if(m.context){q.addContext()}fullPath=q.getFullPath();return fullPath})();var l=function(o){topadvertCallbacks[k]=o};var n;l(function(o){clearTimeout(n);m.callback(o);delete topadvertCallbacks[k]});this._cancel=function(){l(function(p){});var o=document.getElementById(g);c.getClass("Utils").getHead().removeChild(o);if(m.onError&&typeof m.onError==="function"){m.onError()}};this._send=function(){c.getClass("Utils").sendRequest(j,g);var o=this;if(m.timeout>0){n=setTimeout(o._cancel,m.timeout)}}},send:function(){var g=c.getClass("Browser").getInstance();if(g.isAsync()){this._send()}else{var h=this;g.onLoad(function(){h._send()})}},cancel:function(){this._cancel()}});return e});c.registerClass("Counters.Openstat",function(){var e=false;var d=c.getClass("Object").extend({});d.count=function(){if(e){return}var f="http://openstat.net/cnt?cid=2169165&rn="+Math.random();c.getClass("Utils").sendImgRequest(f);e=true};return d});c.registerClass("Counters.Quantcast",function(){var e=false;var d=c.getClass("Object").extend({});d.count=function(){if(e){return}var f;var g;var k;var j;var h=[];h.push({qacct:"p-WCeJmPS5E7cR4"});if(!f){var f={qcdst:function(){if(f.qctzoff(0)!=f.qctzoff(6)){return 1}return 0},qctzoff:function(l){var p=new Date(2000,l,1,0,0,0,0);var n=p.toGMTString();var o=new Date(n.substring(0,n.lastIndexOf(" ")-1));return p-o},qceuc:function(l){if(typeof(encodeURIComponent)=="function"){return encodeURIComponent(l)}else{return escape(l)}},qcrnd:function(){return Math.round(Math.random()*2147483647)},qcgc:function(r){var o="";var q=document.cookie;if(!q){return o}var p=q.indexOf(r+"=");var l=p+r.length+1;if(p>-1){var m=q.indexOf(";",l);if(m<0){m=q.length}o=q.substring(l,m)}return o},qcdomain:function(){var o=document.domain;if(o.substring(0,4)=="www."){o=o.substring(4,o.length)}var m=o.split(".");var l=m.length;if(l<3){return o}var n=m[l-1];if(n.length<3){return o}o=m[l-2]+"."+m[l-1];return o},qhash2:function(n,m){for(var l=0;l<m.length;l++){n^=m.charCodeAt(l);n+=(n<<1)+(n<<4)+(n<<7)+(n<<8)+(n<<24)}return n},qhash:function(n){var m=2166136261,l=3386659096;var p=f.qhash2(m,n);var o=f.qhash2(l,n);return(Math.round(Math.abs(p*o)/65536)).toString(16)},sd:["4dcfa7079941","127fdf7967f31","588ab9292a3f","32f92b0727e5","22f9aa38dfd3","a4abfe8f3e04","18b66bc1325c","958e70ea2f28","bdbf0cb4bbb","65118a0d557","40a1d9db1864","18ae3d985046","3b26460f55d"],qcsc:function(){var r="";var t=f.qcdomain();if(f.qad==1){return";fpan=u;fpa="}var l=f.qhash(t);for(var q=0;q<f.sd.length;q++){if(f.sd[q]==l){return";fpan=u;fpa="}}var p=document;var m=f.qcgc("__qca");if(m.length>0){r+=";fpan=0;fpa="+m}else{var o=new Date();var n=new Date(o.getTime()+47335389000);m="P0-"+f.qcrnd()+"-"+o.getTime();p.cookie="__qca="+m+"; expires="+n.toGMTString()+"; path=/; domain="+t;m=f.qcgc("__qca");if(m.length>0){r+=";fpan=1;fpa="+m}else{r+=";fpan=u;fpa="}}return r},qcdc:function(l){document.cookie=l+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/; domain="+f.qcdomain()},qpxload:function(l){if(l&&typeof(l.width)=="number"&&l.width==3){f.qcdc("__qca")}},qcdnt:function(){var m=false;if(typeof(a.external)!=="undefined"&&a.external!==null){var l=a.external;m=(typeof l.InPrivateFilteringEnabled==="function"&&l.InPrivateFilteringEnabled()===true)}return(m||navigator.doNotTrack==="1"||navigator.doNotTrack==="yes"||navigator.msDoNotTrack==="1")},qcp:function(u,r){var o="",l=null;uh=null;var t="webpage",q="load";if(r!=null){for(var m in r){if(typeof(m)!="string"){continue}if(typeof(r[m])!="string"){continue}if(m=="uid"||m=="uh"){if(f.qcdnt()===false){uh=f.qhash(r[m])}delete r[m];continue}if(m=="qacct"){l=r[m];continue}o+=";"+m+u+"="+f.qceuc(r[m]);if(m=="media"){t=r[m]}if(m=="event"){q=r[m]}}}if(typeof l!="string"){if((typeof g=="undefined")||(g.length==0)){return""}l=g}if(typeof uh==="string"){r.uh=uh;o+=";uh"+u+"="+f.qceuc(uh)}if(t=="webpage"&&q=="load"){for(var n=0;n<f.qpixelsent.length;n++){if(f.qpixelsent[n]==l){return""}}f.qpixelsent.push(l)}if(t=="ad"){f.qad=1}o=";a"+u+"="+l+o;return o},qcesc:function(l){return l.replace(/\./g,"%2E").replace(/,/g,"%2C")},qcd:function(l){return(typeof(l)!="undefined"&&l!=null)},qcogl:function(){var n=document.getElementsByTagName("meta");var t="";for(var r=0;r<n.length;r++){if(t.length>=1000){return t}if(f.qcd(n[r])&&f.qcd(n[r].attributes)&&f.qcd(n[r].attributes.property)&&f.qcd(n[r].attributes.property.value)&&f.qcd(n[r].content)){var s=n[r].attributes.property.value;var u=n[r].content;if(s.length>3&&s.substring(0,3)=="og:"){if(t.length>0){t+=","}var q=(u.length>80)?80:u.length;t+=f.qcesc(s.substring(3,s.length))+"."+f.qcesc(u.substring(0,q))}}}return f.qceuc(t)},firepixel:function(n){var z=(typeof(encodeURIComponent)=="function")?"n":"s";var w=f.qcrnd();var y="",m="",p="",s="",t="",B="u",D="1";var o=0;f.qad=0;if(typeof f.qpixelsent=="undefined"){f.qpixelsent=new Array()}if(typeof n!="undefined"&&n!=null){f.qopts=n;for(var x in f.qopts){if(typeof(f.qopts[x])=="string"){m=f.qcp("",f.qopts);break}else{if(typeof(f.qopts[x])=="object"&&f.qopts[x]!=null){++o;m+=f.qcp("."+o,f.qopts[x])}}}}else{if(typeof g=="string"){m=f.qcp("",null)}}if(m.length==0){return}var v=(navigator.cookieEnabled)?"1":"0";if(typeof navigator.javaEnabled!="undefined"){B=(navigator.javaEnabled())?"1":"0"}if(typeof k!="undefined"&&k!=null){p=";m="+f.qceuc(k);k=null}if(self.screen){y=screen.width+"x"+screen.height+"x"+screen.colorDepth}var A=new Date();var E=f.qcdst();var l="http";if(a.location.protocol=="https:"){l+="s"}l+="://pixel.quantserve.com";var u=f.qcsc();if(a.location&&a.location.href){s=f.qceuc(a.location.href)}if(a.document&&a.document.referrer){t=f.qceuc(a.document.referrer)}if(self==top){D="0"}var q=f.qcogl();var C=new Image();C.alt="";C.src=l+"/pixel;r="+w+m+u+";ns="+D+";ce="+v+";je="+B+";sr="+y+";enc="+z+";dst="+E+";et="+A.getTime()+";tzo="+A.getTimezoneOffset()+p+";ref="+t+";url="+s+";ogl="+q;C.onload=function(){f.qpxload(C)}},quantserve:function(){if(typeof h=="undefined"){h=[]}if(typeof j!="undefined"&&j!=null){f.firepixel(j);j=null}else{if(!h.length&&typeof g!="undefined"){f.firepixel(null)}}if(!f.evts){for(var l in h){f.firepixel(h[l])}h={push:function(){var m=arguments;for(var n=0;n<m.length;n++){f.firepixel(m[n])}}};f.evts=1}}}}function i(){f.quantserve()}i();e=true};return d});c.registerClass("LoadJSAPI",function(){var e;var d=c.getClass("Object").extend({getClass:function(){return c.getClass("Object")},getURLParams:function(){return c.getClass("URLParams").getInstance()}});d.getInstance=function(){if(!e){e=new d()}return e};return d});c.registerClass("Request.Sender",function(){var d=c.getClass("Object").extend({init:function(h){var f=h;var e=h.addParams;var g=c.getClass("Context.Context").getInstance();delete f.addParams;this._send=function(n,s,o){if(!g.defineContext()){var q=this;var p=function(){q._send(n,s,o)};setTimeout(p,50);return}var i=c.getClass("Utils").extendObject({},e,n);var j=c.getClass("URLParams").getInstance().get();if(j.pattern_id!=null&&j.pattern_id===i.pattern_id){i=c.getClass("Utils").extendObject({},i,j.common_params);var r=i.component;if(r==null){r=""}var k=j.components_params[r];if(k!=null){i=c.getClass("Utils").extendObject({},i,k)}}var l=c.getClass("Utils").extendObject({},f,{data:i,callback:s,context:true,referer:true,onError:o});var m=new (c.getClass("Request.Request"))(l);m.send()}},send:function(g,e,f){c.getClass("Counters.Openstat").count();c.getClass("Counters.Quantcast").count();var h=function(i){i.process(e,c.getClass("LoadJSAPI").getInstance())};this._send(g,h,f)}});return d});c.registerClass("Processors.AbstractProcessor",function(){var d=c.getClass("Object").extend({init:function(e){var g={url:"http://feed.topadvert.ru/feed",pack:true,codeType:""};var f=c.getClass("Utils").extendObject(g,e);var h={js_code:f.codeType};this._sender=new (c.getClass("Request.Sender"))({url:f.url,pack:f.pack,timeout:f.timeout,addParams:h})},_getElementsToProcess:function(){return[]},_processSingleElement:function(e){return},process:function(){var f=this._getElementsToProcess();var e=f.length;for(var g=0;g<e;++g){this._processSingleElement(f[g])}}});return d});c.registerClass("Processors.Constant",function(){var d=c.getClass("Object").extend({});d.getAllowedParamNames=function(){var e=["adv_limit","all","alt_text","author","book","book_author","book_isbn","book_name","book_num","book_part","book_performed_by","book_publisher","book_series","book_type","book_volume","book_year","context","context_is_active","component","default_geo","dictionary","downloadable","feed_id","format","geo","category","has_image","hit_accuracy","ilist","ip","is_available","isbn","is_gl","is_images","is_item_params","is_partner","is_test","isbn","item_id","item_page_last","item_page_this","item_theme","item_type","load_event","limit","lo_page_limit","lo_page_number","max_offers_per_shop","offer_page_last","offer_page_this","name","page_limit","page_number","params","pattern_id","query","rand","rand_limit","referer","request","request_id","request_type","search","search1","search2","select_method","shop_name","show_all_parms","show_params","sort","sort_rank_step_number","sort_rank_step_type","sub_id","tech","tech_accessory","tech_color","tech_model","tech_name","tech_type","tech_vendor","test","title","topadvert_demo","uri","url","user_id",];return e};return d});c.registerClass("Parser",function(){var d=c.getClass("Object").extend({init:function(l){var f;var h;var k;var e={};for(var g=0;g<l.length;++g){e[l[g]]=1}var j=function(i){return i.replace(/^\s+|\s+$/g,"")};this._parse=function(r){var m={};var q;var i="";var n=/((\w+):(\s*(.|\n)*?\s*))(?=(\w+:|$))/g;var t=function(){if(q!=null){i=i.replace(/^\s*/,"");i=i.replace(/\s*$/,"");var u="_clean_"+q;if(typeof(this[u])==="function"){i=this[u](i)}m[q]=i;i=""}};while(n.exec(r)){var o=RegExp.$2;var s=RegExp.$3;var p=RegExp.$1;if(e[o]===1){t();q=o;i+=s}else{i+=p}}t();return m}},parse:function(f){var h=f;if(f.tagName){var e=f;h=e.value}var g=this._parse(h);return g},parseMultiple:function(j){var h=j.length;var f=[];for(var g=0;g<h;++g){var k=this.parse(j[g]);f.push(k)}return f}});return d});c.registerClass("Processors.Textarea.AbstractProcessor",function(){var d=c.getClass("Processors.AbstractProcessor").extend({init:function(e){this._super(e);var f=c.getClass("Processors.Constant").getAllowedParamNames();this._parser=new (c.getClass("Parser"))(f);this._processedElements=[];this._textareaName="to_be_redefined_in_child_class"},_onRequestTimeout:function(e){},_getAllElements:function(){return document.getElementsByName(this._textareaName)},_getElementsToProcess:function(){var m=this._getAllElements();var e=m.length;var f=[];for(var k=0;k<e;++k){var l=m[k];var h=false;for(var g=0;g<this._processedElements.length;++g){if(this._processedElements[g]===l){h=true;break}}if(!h){f.push(l);this._processedElements.push(l)}}return f},_processSingleElement:function(g){var h=this._parser.parse(g);var e={getType:function(){return"div"},getLoadEvent:function(){return"page_load"},getTextarea:function(){return g},getCodeElement:function(){return g},getDivId:function(){return null}};var f=this;this._sender.send(h,e,function(){f._onRequestTimeout(g)})}});return d});c.registerClass("Processors.Textarea.Async.Processor",function(){var d=c.getClass("Processors.Textarea.AbstractProcessor").extend({init:function(){this._super({codeType:"textarea_async"});this._textareaName="topadvert_request_async"}});return d});c.registerClass("Processors.Textarea.Sync.Processor",function(){var d=c.getClass("Processors.Textarea.AbstractProcessor").extend({init:function(){this._super({codeType:"textarea_sync"});this._textareaName="topadvert_request_sync"}});return d});c.registerClass("Processors.Textarea.Old.Processor",function(){var d=c.getClass("Processors.Textarea.AbstractProcessor").extend({init:function(){this._super({codeType:"textarea_old"});this._textareaName="topadvert_request"}});return d});c.registerClass("Processors.Textarea.Utils",function(){var d=c.getClass("Object").extend({});d.getEventPosition=function(h){var f=0;var i=0;if(h.pageX!=null&&h.pageY!=null){f=parseInt(h.pageX);i=parseInt(h.pageY)}else{var g=d.getPageScroll();f=parseInt(h.clientX)+g.left;i=parseInt(h.clientY)+g.top}return{x:f,y:i}};d.getPageScroll=function(){var e=0;var f=0;if(a.pageXOffset!=null&&a.pageYOffset!=null){e=parseInt(a.pageXOffset);f=parseInt(a.pageYOffset)}else{if(document.body!=null&&(document.body.scrollLeft||document.body.scrollTop)){e=parseInt(document.body.scrollLeft);f=parseInt(document.body.scrollTop)}else{if(document.documentElement!=null&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){e=parseInt(document.documentElement.scrollLeft);f=parseInt(document.documentElement.scrollTop)}}}return{left:e,top:f}};return d});c.registerClass("Processors.LoadEvent.MouseAction.Block",function(){var e={currentActiveIndex:1,openActiveIndex:0,blocks:[]};var d=c.getClass("Object").extend({init:function(){this.openHandler=null;this.closeHandler=null;this.activeIndex=null;this._isActive=false;e.blocks.push(this)},updateIndex:function(){this.activeIndex=e.currentActiveIndex++},isActual:function(){return this.activeIndex>=e.openActiveIndex},isActive:function(){return this._isActive},setOpenHandler:function(f){this.openHandler=f},setCloseHandler:function(f){this.closeHandler=f},activate:function(g,h){if(g){this.updateIndex()}e.openActiveIndex=this.activeIndex;for(var f=0;f<e.blocks.length;++f){e.blocks[f].deactivate()}if(this.openHandler){this.openHandler(h)}this._isActive=true},deactivate:function(){if(this.closeHandler){this.closeHandler()}this._isActive=false}});return d});c.registerClass("Processors.Textarea.Event.Old.Processor",function(){var d=c.getClass("Processors.Textarea.Utils").getEventPosition;var e=c.getClass("Processors.Textarea.AbstractProcessor").extend({init:function(){this._super({codeType:"textarea_event_old"});this._blocks={};var h=this;a.topadvert_internal_open_div=function(m,l){var k=h._prepareCoords(l);h._open_div(m,k)};a.topadvert_internal_close_div=function(k){h._close_div(k)};a.topadvert_open_div=function(m,l){var k=d(l);h._open_div(m,k)};a.topadvert_close_div=function(k){h._close_div(k)};if(typeof(topadvert_div_map)!="undefined"){for(var j in topadvert_div_map){if(!topadvert_div_map.hasOwnProperty(j)){continue}var i=topadvert_div_map[j];var f=this._prepareCoords(i);var g=document.getElementById(j);this._processSingleElement(g,f)}}},_processSingleElement:function(f,g){this._processedElements.push(f);var i=new (c.getClass("Processors.LoadEvent.MouseAction.Block"))();var h={codeElement:f,coords:g,hasMissedCloseEvent:false,bmBlock:i,openActionHandler:null,closeActionHandler:null};h.bmBlock.updateIndex();this._blocks[f.id]=h;this._sendRequest(h)},_sendRequest:function(h){if(h.requestIsSent){return}var f=this;var g=f._parser.parse(h.codeElement);f._sender.send(g,{getType:function(){return"old_event"},getLoadEvent:function(){return"old_mouse_action"},getTextarea:function(){return h.codeElement},getCodeElement:function(){return h.codeElement},getEventCoords:function(){return h.coords},hasMissedCloseEvent:function(){return h.hasMissedCloseEvent},delMissedCloseEvent:function(){h.hasMissedCloseEvent=false},setOpenActionHandler:function(i){h.openActionHandler=i},setCloseActionHandler:function(i){h.closeActionHandler=i},setOpenHandler:function(i){h.bmBlock.openHandler=i},setCloseHandler:function(i){h.bmBlock.closeHandler=i},isActual:function(){return h.bmBlock.isActual()},activate:function(i,j){h.bmBlock.activate(i,j)},deactivate:function(){h.bmBlock.deactivate()},isActive:function(){return h.bmBlock.isActive()}});h.requestIsSent=true},_prepareCoords:function(g){var f=(g==null)?null:{x:g[0],y:g[1]};return f},_open_div:function(l,f){var j=document.getElementById(l);var g=false;for(var h=0;h<this._processedElements.length;++h){if(this._processedElements[h]===j){g=true}}if(!g){this._processSingleElement(j,f)}else{var k=this._blocks[j.id];if(k!=null){if(k.openActionHandler){k.openActionHandler(f)}}}},_close_div:function(g){var f=this._blocks[g];if(f!=null){if(f.closeActionHandler){f.hasMissedCloseEvent=false;f.closeActionHandler()}else{f.hasMissedCloseEvent=true}}}});return e});c.registerClass("Processors.LoadEvent.MouseAction.Processor",function(){var e=c.getClass("Object").extend({init:function(f){this._sender=f.sender;this._elem=f.elem;this._data=f.data;this._event=f.event},process:function(){var g=this;var f=d(this._elem);if(!f){return}var i=new (c.getClass("Processors.LoadEvent.MouseAction.Block"))();var h={bmBlock:i,data:this._data,codeElement:this._elem,link:f,linkIsMouseOver:false,linkMouseOverCoords:null,linkOnClickCoords:null,linkOnClickHandler:null,linkOnMouseOverHandler:null,linkOnMouseOutHandler:null};h.link.onclick=function(j){j=j?j:a.event;h.linkOnClickCoords=c.getClass("Processors.Textarea.Utils").getEventPosition(j);h.bmBlock.updateIndex();if(h.linkOnClickHandler){h.linkOnClickHandler(h.linkOnClickCoords)}return false};h.link.onmouseover=function(j){j=j?j:a.event;h.linkIsMouseOver=true;h.linkMouseOverCoords=c.getClass("Processors.Textarea.Utils").getEventPosition(j);h.bmBlock.updateIndex();g._realSend(h);if(h.linkOnMouseOverHandler){h.linkOnMouseOverHandler(h.linkMouseOverCoords)}return false};h.link.onmouseout=function(j){j=j?j:a.event;h.linkIsMouseOver=false;if(h.linkOnMouseOutHandler){h.linkOnMouseOutHandler()}return false}},_realSend:function(g){if(g.requestIsSent){return}var f=this;f._sender.send(g.data,{getType:function(){return"event"},getLoadEvent:function(){return"mouse_action"},getEvent:function(){return f._event},getTextarea:function(){return g.codeElement},getCodeElement:function(){return g.codeElement},getLink:function(){return g.link},getLinkIsMouseOver:function(){return g.linkIsMouseOver},getLinkMouseOverCoords:function(){return g.linkMouseOverCoords},getLinkOnClickCoords:function(){return g.linkOnClickCoords},setLinkOnClickHandler:function(h){g.linkOnClickHandler=h},setLinkOnMouseOverHandler:function(h){g.linkOnMouseOverHandler=h},setLinkOnMouseOutHandler:function(h){g.linkOnMouseOutHandler=h},setOpenHandler:function(h){g.bmBlock.setOpenHandler(h)},setCloseHandler:function(h){g.bmBlock.setCloseHandler(h)},isActual:function(){return g.bmBlock.isActual()},activate:function(h,i){g.bmBlock.activate(h,i)},deactivate:function(){g.bmBlock.deactivate()},isActive:function(){return g.bmBlock.isActive()}});g.requestIsSent=true}});var d=function(h){var g=null;var f=0;while(f++<10&&h!=null){if(h.nextSibling){h=h.nextSibling}else{h=h.parentNode;continue}if(h!=null&&h.nodeType===1){g=h;break}}return g};return e});c.registerClass("Processors.Textarea.Event.AbstractProcessor",function(){var d=c.getClass("Processors.Textarea.Utils").getEventPosition;var e=c.getClass("Processors.Textarea.AbstractProcessor").extend({init:function(f){this._super(f);this._event=null;this._textareaName=null},_processSingleElement:function(f){var g=this._parser.parse(f);new (c.getClass("Processors.LoadEvent.MouseAction.Processor"))({sender:this._sender,elem:f,data:g,event:this._event}).process()}});return e});c.registerClass("Processors.Textarea.Event.Onclick.Processor",function(){var d=c.getClass("Processors.Textarea.Event.AbstractProcessor").extend({init:function(){this._super({codeType:"textarea_event_onclick"});this._textareaName="topadvert_request_onclick";this._event="click"}});return d});c.registerClass("Processors.Textarea.Event.Onmouseover.Processor",function(){var d=c.getClass("Processors.Textarea.Event.AbstractProcessor").extend({init:function(){this._super({codeType:"textarea_event_onmouseover"});this._textareaName="topadvert_request_onmouseover";this._event="mouseover"}});return d});c.registerClass("Processors.LoadEvent.PageLoad.Processor",function(){var d=c.getClass("Object").extend({init:function(e){this._sender=e.sender;this._elem=e.elem;this._data=e.data},process:function(){var f=this;var e={getType:function(){return"div"},getLoadEvent:function(){return"page_load"},getTextarea:function(){return f._elem},getCodeElement:function(){return f._elem},getDivId:function(){return null}};this._sender.send(this._data,e,function(){f._onRequestTimeout(f._elem)})}});return d});c.registerClass("Processors.Script.Processor",function(){var d=c.getClass("Processors.AbstractProcessor").extend({init:function(e){this._super({codeType:"script"});this._processedElements=[]},_getAllElements:function(){var e=[];var h=document.getElementsByTagName("script");for(var g=0;g<h.length;++g){var f=h[g];if(f&&f.type==="text/topadvert"){e.push(f)}}return e},_getElementsToProcess:function(){var m=this._getAllElements();var e=m.length;var f=[];for(var k=0;k<e;++k){var l=m[k];var h=false;for(var g=0;g<this._processedElements.length;++g){if(this._processedElements[g]===l){h=true;break}}if(!h){f.push(l);this._processedElements.push(l)}}return f},_processSingleElement:function(e){var g=c.getClass("Processors.Constant").getAllowedParamNames();var f=new (c.getClass("Parser"))(g).parse(e.innerHTML);if(f.load_event==="page_load"){new (c.getClass("Processors.LoadEvent.PageLoad.Processor"))({sender:this._sender,elem:e,data:f}).process()}else{if(f.load_event==="mouse_action"){new (c.getClass("Processors.LoadEvent.MouseAction.Processor"))({sender:this._sender,elem:e,data:f}).process()}}}});return d});c.registerClass("Loader",function(){var d=c.getClass("Object").extend({init:function(){var j=new (c.getClass("Processors.Textarea.Async.Processor"))();var g=new (c.getClass("Processors.Textarea.Sync.Processor"))();var e=new (c.getClass("Processors.Textarea.Old.Processor"))();var n=new (c.getClass("Processors.Textarea.Event.Old.Processor"))();var h=new (c.getClass("Processors.Textarea.Event.Onclick.Processor"))();var m=new (c.getClass("Processors.Textarea.Event.Onmouseover.Processor"))();var k=new (c.getClass("Processors.Script.Processor"))();var l=[j,g,e,n,h,m,k];var i=c.getClass("Browser").getInstance();var f;this._load=function(){var o=function(){var p=l.length;for(var q=0;q<p;++q){var r=l[q];r.process()}};o();f=setInterval(o,100);i.onLoad(function(){clearInterval(f);f=setInterval(o,500)})}},load:function(){this._load()}});return d});(function(){var d=new (c.getClass("Loader"))();d.load();a.topadvert={init:function(){}}})()})(window);