
if(!false)
    document.write('</div></div>');
    
function advstZv(){};

Function.prototype.advstBind=function(object){var __method=this;return function(){return __method.apply(object,arguments);}};
advstZv.prototype={
    ini:function(p){
        this.doc=document;
        this.id=p[0];
        this.zid=p[6];
        this.dom=p[2];
        this.w=p[3];this.h=p[4];
        this.bw = this.w;
        this.bh = this.h-47;
        this.autoStart=p[5];
        //this.autoStart=false;
        this.duree=10;
        this.nbSec=this.duree;
        this.key=null;
        this.keyZ=null;
        this.type=1;
        this.z=null;
        this.bg=p[7];
        this.tcolor=p[8];
        this.text1=p[9];
        this.text2='Cliquez ici pour voir la video';
        this.border=p[10];
        this.border2=this.border;
        this.getBuffer();
        this.img=p[11];
        this.player=p[12];
        this.keep_image_ratio=p[13];
        this.js_callback=p[14];
        this.textHaut = "PUBLICITE";
        this.textAdvert = "Votre publicit&eacute; ici";
        this.linkAdvert = "http://"+this.dom+".advertstream.com/adpar.php?z="+p[6];
    },
    getElt:function(n){
        if(!this[n]){this[n]=this.doc.getElementById(this.id+n)}
        return this[n];
    },
    getBuffer:function(){
        this.buffer=this.getChild(this.getElt(''));
        this.getElt('').innerHTML='';
    },
    getChild:function(e){
    
        this.domToString = function (a) {
        
            var html = '';
            for (var i=0; i<a.childNodes.length; i++) {
            
                var b = a.childNodes[i];
                if ((b.nodeType != 3) && (b.tagName.toLowerCase() != 'script')) {
                    
                    html += '<' + b.tagName;
                    
                    for (var j=0; j<b.attributes.length; j++) {
                    
                        var c = b.attributes[j];
                        
                        if ((c.nodeValue != null) && (c.nodeValue != '')) {
                        
                            html += ' ' + c.nodeName + '=' + '"' + c.nodeValue + '"';
                        }
                    }
                    html += '>';
                    
                    if (b.childNodes.length > 0) {
                    
                        html += this.domToString(b);
                    }
                    html += '</' + b.tagName + '>';
                }
            }
            return html;
        };
        this.buffer = this.domToString(e);
        return this.buffer;
    },
    buildPlayer:function(){
    
        this.getElt('').style.visibility='visible';
        
    	if (this.autoStart) {
    		
    		this.buildHtml();
    	}
    	else {
	    	
	        var vars = 'ad_menuolor=212699&ad_animnum=1&ad_function=void(null;&amp;ad_bg='+this.bg+'&amp;ad_tcolor='+this.tcolor+'&amp;ad_text1='+this.text1+'&amp;ad_text2='+this.text2+'&amp;ad_load=0&amp;ad_textHaut='+this.textHaut+'&amp;ad_textAdvert='+this.textAdvert+'&amp;linkAdvert='+this.linkAdvert+'&amp;ad_border='+this.border+'&amp;ad_img='+this.img+'&amp;ad_keep_image_ratio='+this.keep_image_ratio;
	        var url2 = 'http://'+this.dom+'.advertstream.com/banners/general/' + this.player;
	        
	        html='<object type="application/x-shockwave-flash" data="'+url2+'" width="'+this.w+'" height="'+this.h+'">';
	        html+='<param name="movie" value="'+url2+'">';
	        html+='<param name="quality" value="high">';
	        html+='<param name="AllowScriptAccess" value="always">';
	        html+='<param name="FlashVars" value="'+vars+'&ad_largeur='+this.w+'&ad_hauteur='+this.h+'">';
	        html+='</object>';
	        
	        this.getElt('').innerHTML = html;
	        this.getElt('').style.visibility='visible';
	        
	        window['advst_flash2js'+this.id] = function(id, largeur, hauteur){
	            window['advst_flash2js_obj'+id].load.advstBind(window['advst_flash2js_obj'+id])(largeur, hauteur);
	        }
	        window['advst_flash2js_obj'+this.id] = this;
    	}
    	
    },
    loadAdvstZ:function(){
        s=document.createElement('SCRIPT');
        s.type='text/javascript';
        s.src='http://'+this.dom+'.advertstream.com/advst_p2.php?m=dom';
        this.doc.getElementsByTagName('HEAD')[0].appendChild(s);
        this.intChkLoad=setInterval(this.checkLoadAdvstZ.advstBind(this),10);
    },
    checkLoadAdvstZ:function(){
        if(typeof(advstZ)!='undefined'){
            clearInterval(this.intChkLoad);
            this.buildZone();
            
            this.z.putDiv();
            this.z.load();
        }
    },
    buildZone:function(){
        this.z=new advstZ(this.zid,this.bw,this.bh,[],'dom',{});
        this.z.setParentNode(this.getElt('P'));
        this.z.type=this.type;
        this.z.setPos(1);
        if(this.key!=null){ this.z.key=this.keyZ; }
        if(this.key!=null){ this.z.key2=this.key; }
    },
    
    buildHtml:function () {
        
        this.randVal = parseInt(Math.random() * 10000);
        this.end = false;
        
        html =
          '<table style="height:'+this.h+'px;width:'+this.w+'px" id="tbl_' + this.randVal + '" width="' + this.w + '" cellspacing="0" cellpadding="0">' +
          
          '<tr>' +
          '<td style="background-color:#' + this.border + ';color:#' + this.tcolor + ';height:17px;text-align:center;text-transform:uppercase;font-family:arial;font-size:11px;font-weight:bold;font-size:14px" colspan="2">' +
          '<div style="height:17px;overflow:hidden">publicit&eacute;</div>' +
          
          '<tr>' +
          '<td style="background-color:#' + this.bg + ';color:#' + this.tcolor + ';height:' + this.bh + 'px" colspan="2" align="center">' +
          
          '<div id="div_' + this.randVal + '" style="position:absolute"></div>' +
          
          '<div id="' + this.id + 'P" name="' + this.id + 'P" style="position:relative;">' +
          '</div>' +
          
          '<tr>' +
          '<td style="background-color:#' + this.border + ';color:#' + this.tcolor + ';height:13px;font-family:arial;font-size:11px;text-align:center" colspan="2"><center><i style="visibility:visible" id="' + this.id + 'H" name="' + this.id + 'H">' +
          '<div style="height:13px;overflow:hidden"></div>' +
          '</i></center>' +
          
          '<tr>' +
          '<td style="background-color:#' + this.border + ';color:#' + this.tcolor + ';height:17px;font-family:arial;font-size:11px;text-align:left"><span id="' + this.id + 'TimeLine" name="' + this.id + 'TimeLine">' +
          '<div style="height:17px;overflow:hidden">Votre contenu dans <span id="' + this.id + 'T" name="' + this.id + 'T">' + this.nbSec + ' secondes</span></div>' +
          
          '<td style="background-color:#' + this.border + ';color:#' + this.tcolor + ';height:17px;font-family:arial;font-size:11px;text-align:right"><a href="' + this.linkAdvert + '" target="_blank" style="color:#' + this.tcolor + '">' +
          '<div style="height:17px;overflow:hidden">Votre publicit&eacute; ici</div>' +
          '</a>' +
          
          '</table>';
          
        if (this.img !== '') {
        
            this.background = {
                src: this.img
            };
            
            if (((typeof largeur) !== 'undefined') && ((typeof hauteur) !== 'undefined')) {
                this.background.height = hauteur;
                this.background.width = largeur;
            }
            else {
                this.background.height = this.h;
                this.background.width = this.w;
            }
            this.showBackground();
            
            function advstAddEvent(obj, type, fn) {
                if (obj.addEventListener) {
                    obj.addEventListener(type, fn, false);
                }
                else {
                    obj.attachEvent('on' + type, fn);
                }
            }
            
            advstAddEvent(window, 'resize', function () {
	               if (!this.end) {
	                    this.showBackground();
	                }
                }.advstBind(this)
            );
        }
        this.getElt('').innerHTML = html;
        this.is_builded = true;
    },
    
    load: function (largeur, hauteur) {
    
        if (typeof this.is_builded == 'undefined') {
        	
            this.buildHtml();
        }
        this.loadAdvstZ();
    },
    
    showBackground: function () {
    
        setInterval(
            function () {
            
                if (!this.end) {
                    function findPos(obj) {
                        var curleft = curtop = 0;
                        if (obj.offsetParent) {
                            curleft = obj.offsetLeft;
                            curtop = obj.offsetTop;
                            while (obj = obj.offsetParent) {
                                curleft += obj.offsetLeft;
                                curtop += obj.offsetTop;
                            }
                        }
                        return [curleft, curtop];
                    }
                    
                    // resize
                    var ratio1 = this.w / this.background.width;
                    var ratio2 = this.h / this.background.height;
                    
                    if (ratio1 < ratio2) {
                        this.background.height = parseInt(this.background.height * ratio1);
                        this.background.width = parseInt(this.background.width * ratio1);
                    }
                    else {
                        this.background.height = parseInt(this.background.height * ratio2);
                        this.background.width = parseInt(this.background.width * ratio2);
                    }
                    
                    this.background.clip = {
                        t: 0,
                        r: this.background.width,
                        b: this.background.height,
                        l: 0
                    };
                    
                    var pos = findPos(document.getElementById('tbl_' + this.randVal));
                    
                    this.background.posX = pos[0];
                    this.background.posY = pos[1];
                    
                    var offsetTop = parseInt((this.h - this.background.height) / 2);
                    var offsetLeft = parseInt((this.w - this.background.width) / 2);
                    
                    this.background.posY = this.background.posY + offsetTop;
                    this.background.posX = this.background.posX + offsetLeft;
                    
                    // clip
                    var offsetBottom = this.h - (offsetTop + this.background.height);
                    
                    if (offsetTop < 17) {
                        this.background.clip.t = 17 - offsetTop;
                    }
                    
                    if (offsetBottom < 30) {
                        this.background.clip.b = this.h - (offsetTop + 30);
                    }
                    
                    var obj = document.getElementById('div_' + this.randVal);
                    obj.style.clip = 'rect(' + this.background.clip.t + 'px, ' + this.background.clip.r + 'px, ' + this.background.clip.b + 'px, ' + this.background.clip.l + 'px)';
                    obj.style.height = this.background.height + 'px';
                    obj.style.width = this.background.width + 'px';
                    obj.style.left = this.background.posX + 'px';
                    obj.style.top = this.background.posY + 'px';
                    
                    if (typeof this.firstBg == 'undefined') {
                        obj.innerHTML = '<img src="' + this.background.src + '" alt="" height="' + this.background.height + '" width="' + this.background.width + '">';
                        this.firstBg = true;
                    }
                }
            }.advstBind(this), 100
        );
    },
    
    
    
    startTime:function(t){
        this.duree = t;
        this.nbSec=this.duree;
        this.getElt('T').innerHTML='<b>'+this.nbSec+'</b> secondes';
        this.inter=setTimeout(this.showContent.advstBind(this),(this.duree*1000));
        this.interTime=setInterval(this.actuTime.advstBind(this),1000);
        this.showClicInfo();
    },
    showSeeAd:function(){
    
        var url2 = 'http://' + this.dom + '.advertstream.com/banners/general/' + this.player;
        var params = [['ad_menucolor' , '212699'], ['ad_animnum' , '1'], ['ad_function' , 'parent.advst_flash2js' + this.id + '(\'' + this.id + '\''], ['ad_bg' , this.bg], ['ad_tcolor' , this.tcolor], ['ad_text1' , this.text1], ['ad_text2' , this.text2], ['ad_load' , '1'], ['ad_textHaut' , this.textHaut], ['ad_textAdvert', this.textAdvert], ['linkAdvert' , this.linkAdvert], ['ad_border' , this.border], ['ad_img' , this.img], ['ad_keep_image_ratio', this.keep_image_ratio]];
        
        var vars = '';
        for (var i=0,len=params.length; i<len; i++) {
            vars = vars + params[i][0] + '=' + params[i][1] + '&';
        }
        vars = vars.substring(0, vars.length - 1);
        
        html =
          '<object type="application/x-shockwave-flash" data="' + url2 + '" width="' + this.w + '" height="' + this.h + '">' +
          '<param name="movie" value="' + url2 + '">' +
          '<param name="quality" value="high">' +
          '<param name="AllowScriptAccess" value="always">' +
          '<param name="FlashVars" value="'+vars+'&ad_largeur='+this.w+'&ad_hauteur='+this.h+'">' +
          '</object>';
        
        this.getElt('').innerHTML = html;
    },
    showContent:function(){
        clearTimeout(this.inter);
        clearTimeout(this.interTime);
        this.end = true;
        this.getElt('').innerHTML = this.buffer;
        
        if (this.js_callback && this.js_callback != '') {
            window[this.js_callback]();
        }
    },
    showClicInfo:function(){
        this.getElt('H').style.visibility='visible';
    },
    actuTime:function(){
        this.nbSec--;
        if(this.nbSec > 1)
            this.getElt('T').innerHTML='<b style="font-size:12px">'+this.nbSec+'</b> secondes';
        else
            this.getElt('T').innerHTML='<b style="font-size:12px">'+this.nbSec+'</b> seconde';
    },
    buildEnd:function(){
        if(this.z)
        {
            this.z.key=this.keyZ;
            this.z.key2=this.key;
        }
        
        if(this.autoStart){
            this.load();
        }else{
            this.showSeeAd();
        }
    }
}

try{
tmp=advstTzvid[advstTzvid.length-1];
adZ=new advstZv();
adZ.ini(advstZV[tmp]);
adZ.buildPlayer();

if(typeof(window.advstZvs) == 'undefined') window.advstZvs=[];
window.advstZvs.push(adZ);
}catch(ex){};
