function adriver(e,a,d){if(this instanceof adriver){var c=this,b=e;if(typeof(b)=="string"){b=document.getElementById(e)}else{e=b.id}if(!b){if(!adriver.isDomReady){adriver.onDomReady(function(){new adriver(e,a,d)})}return null}if(adriver.items[e]){return adriver.items[e]}c.p=b;c.defer=d;c.prm=adriver.extend(a,{ph:e});c.loadCompleteQueue=new adriver.queue();c.domReadyQueue=new adriver.queue(adriver.isDomReady);adriver.initQueue.push(function(){c.init()});return adriver.items[e]=c}else{return arguments.length?adriver.items[e]:adriver.items}}adriver.prototype={isLoading:0,init:function(){},loadComplete:function(){},domReady:function(){},onLoadComplete:function(a){var b=this;b.loadCompleteQueue.push(function(){a.call(b)});return b},onDomReady:function(a){this.domReadyQueue.push(a);return this},reset:function(){this.loadCompleteQueue.flush();this.domReadyQueue.flush(adriver.isDomReady);return this}};adriver.extend=function(){for(var b=arguments[0],d=1,a=arguments.length,e,c;d<a;d++){e=arguments[d];for(c in e){if(e.hasOwnProperty(c)){if(e[c] instanceof Function){b[c]=e[c]}else{if(e[c] instanceof Object){if(b[c]){adriver.extend(b[c],e[c])}else{b[c]=adriver.extend(e[c] instanceof Array?[]:{},e[c])}}else{b[c]=e[c]}}}}}return b};adriver.extend(adriver,{version:"2.3.2",defaults:{tail256:escape(document.referrer||"unknown")},items:{},options:{},plugins:{},pluginPath:{},redirectHost:"//ua.adriver.ru",defaultMirror:"//ua-content.adriver.ru",loadScript:function(c){try{var a=document.getElementsByTagName("head")[0],b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","windows-1251");b.setAttribute("src",c.split("![rnd]").join(Math.round(Math.random()*9999999)));b.onreadystatechange=function(){if(/loaded|complete/.test(this.readyState)){a.removeChild(b)}};b.onload=function(){a.removeChild(b)};a.insertBefore(b,a.firstChild)}catch(d){}},isDomReady:false,onDomReady:function(a){adriver.domReadyQueue.push(a)},onBeforeDomReady:function(a){adriver.domReadyQueue.unshift(a)},domReady:function(){adriver.isDomReady=true;adriver.domReadyQueue.execute()},checkDomReady:function(b){try{var g=document,a=window.onload;if(/WebKit/i.test(navigator.userAgent)){(function(){/loaded|complete/.test(g.readyState)?b():setTimeout(arguments.callee,100)})()}else{if(g.addEventListener){g.addEventListener("DOMContentLoaded",b,false)}else{if(!!window.ActiveXObject){document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");document.getElementById("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){b()}}}}}window.onload=function(){if(a){a()}b()}}catch(c){}},onLoadComplete:function(a){adriver.loadCompleteQueue.push(a);return adriver},loadComplete:function(){adriver.loadCompleteQueue.execute();return adriver},setDefaults:function(a){adriver.extend(adriver.defaults,a)},setOptions:function(a){adriver.extend(adriver.options,a)},setPluginPath:function(a){adriver.extend(adriver.pluginPath,a)},queue:function(a){this.q=[];this.flag=a?true:false},Plugin:function(a){if(this instanceof adriver.Plugin){if(a&&!adriver.plugins[a]){this.id=a;this.q=new adriver.queue();adriver.plugins[a]=this}}return adriver.plugins[a]}});adriver.queue.prototype={push:function(a){this.flag?a():this.q.push(a)},unshift:function(a){this.flag?a():this.q.unshift(a)},execute:function(a){var b;var c;while(b=this.q.shift()){b()}if(a==c){a=true}this.flag=a?true:false},flush:function(a){this.q.length=0;this.flag=a?true:false}};adriver.Plugin.prototype={loadingStatus:0,load:function(){this.loadingStatus=1;adriver.loadScript((adriver.pluginPath[this.id.split(".").pop()]||(adriver.defaultMirror+"/plugins/"))+this.id+".js")},loadComplete:function(){this.loadingStatus=2;this.q.execute();return this},onLoadComplete:function(a){this.q.push(a);return this}};adriver.Plugin.require=function(){var e=this,b=0;e.q=new adriver.queue();for(var c=0,a=arguments.length,d;c<a;c++){d=new adriver.Plugin(arguments[c]);if(d.loadingStatus!=2){b++;d.onLoadComplete(function(){if(b--==1){e.q.execute()}});if(!d.loadingStatus){d.load()}}}if(!b){e.q.execute()}};adriver.Plugin.require.prototype.onLoadComplete=function(a){this.q.push(a);return this};adriver.domReadyQueue=new adriver.queue();adriver.loadCompleteQueue=new adriver.queue();adriver.initQueue=new adriver.queue();adriver.checkDomReady(adriver.domReady);new adriver.Plugin.require("autoUpdate.adriver").onLoadComplete(function(){adriver.initQueue.execute()});
