function active_ad(){
	
	var reference; /*vers le nom de l'objet */
	
	var tableau_prim;
	var longueur_prim;
	
	var tableau_sec;
	var longueur_sec;
	
	var position;
	var tick;
	var temps;
	
	var html;
	var pic;
	
	var lien;
	
	var mode;

	this.setSequencePrim=function(s){
		var reg=new RegExp("[$]+", "g");
		this.tableau_prim=s.split(reg);
		this.longueur_prim=this.tableau_prim.length;
		
		if(  (this.longueur_prim/2) != Math.round( (this.longueur_prim/2) )){ 
			this.longueur_prim-=1;
		}
		
	}
	
	this.setSequenceSec=function(s){
		var reg=new RegExp("[$]+", "g");
		this.tableau_sec=s.split(reg);
		this.longueur_sec=this.tableau_sec.length;	
		
		if(  (this.longueur_sec/2) != Math.round( (this.longueur_sec/2) )){ 
			this.longueur_sec-=1;
		}
	}
	
	this.init=function(h,o){
		this.reference=o;
		this.mode="p";
		this.position=0;
		this.html=document.getElementById(h);
		this.tick=0;
		this.html.innerHTML="<img onclick='"+this.reference+".go()' id='"+h+"pic'/>"
		this.pic=document.getElementById(h+"pic");
		nom=this.tableau_prim[this.position];
		this.pic.src="annonces/"+nom;
		this.temps=this.tableau_prim[this.position+1];
		this.lien=this.tableau_prim[this.position+2];
	}
	
	this.strobe=function(){
		this.tick+=1;
		if(this.tick==this.temps){
			this.tick=0;
			this.position+=3;
			if(this.mode=="p"){
				if(this.position==this.longueur_prim){
					this.position=0;
					this.mode="s";
				}
			}
			else{
				if(this.position==this.longueur_sec){
					this.position=0;
				}
			}
			if(this.mode=="p"){
				nom=this.tableau_prim[this.position];
				this.temps=this.tableau_prim[this.position+1];
				this.lien=this.tableau_prim[this.position+2];
			}
			else{
				nom=this.tableau_sec[this.position];
				this.temps=this.tableau_sec[this.position+1];
				this.lien=this.tableau_sec[this.position+2];
			}
			this.pic.src="annonces/"+nom;
		}
	}
	
	this.go=function(){
		window.location.replace(this.lien);
	}
}
