var Publicidad = {
	
	slots: [],
	intervalTime: 5000,
	
	
	addPublicidad : function(slotNum, path){
	
		slots = this.slots;
	
		if(!slots[slotNum]){
			slots[slotNum] = new Array();
		}
		
		slots[slotNum].push(path);
	},
	
	run : function(){
		for (slotIx in this.slots){
		
			var imagesToShow = this.slots[slotIx];
			document.getElementById('pub'+slotIx).imagesToShow = imagesToShow;
			document.getElementById('pub'+slotIx).showing = 0;
			
			//Load First Image
			document.getElementById('pub'+slotIx).src = imagesToShow[0][0];
			
			document.getElementById('pub'+slotIx).nextPic = function(){
				this.showing++;
				if(! (this.showing<this.imagesToShow.length)){
					this.showing = 0;
				}
				this.src = this.imagesToShow[this.showing][0];
				this.parentNode.href= this.imagesToShow[this.showing][1];
			}

			setInterval("Publicidad.actualizar('" + 'pub'+slotIx + "')",this.intervalTime);

		}
	},
	
	actualizar : function(imageID){
		document.getElementById(imageID).nextPic();
	}, setTime: function(msec){ this.intervalTime = msec; 	} }