var counters = [];

function bannerShow(timeinterval)
{
	this.pictures;
	this.hyperlinks;
	this.durations;
	this.links;
	this.width = 100;
	this.height = 61;
	this.timeinterval = timeinterval;
	this.styleclass = '';

	this.id = Math.ceil(Math.random()*99999999);

	this.getHtml = function()
	{
		return '<div id="bannershowtext'+this.id+'"></div><a href="" target=_blank id="bannershowlink'+this.id+'"><img src="" id="bannershow'+this.id+'" style="width:'+this.width+'px; height:'+this.height+'px;" border="0"></a>';
	}

	this.setPictures = function(arrPictures) { this.pictures = arrPictures; }
	this.setHyperlinks = function(arrHyperlinks) { this.hyperlinks = arrHyperlinks; }
	this.setDurations = function(arrDurations) { this.durations = arrDurations; }

	this.run = function()
	{
		this.counter = 0;
		  
		counters[this.id] = this;
		setTimeout('counters['+this.id+'].update()', this.timeinterval);
	
	}

	this.update = function()
	{
		document.getElementById('bannershow'+this.id).src = this.pictures[this.counter%this.pictures.length];
		document.getElementById('bannershowlink'+this.id).href = this.hyperlinks[this.counter%this.pictures.length];
		setTimeout('counters['+this.id+'].update()',this.durations[this.counter%this.pictures.length]);

		//document.getElementById('bannershowtext'+this.id).innerHTML = this.pictures[this.counter%this.pictures.length];		//document.write(this.durations[this.counter%this.pictures.length]);

		this.counter++;
	}

	this.writeHtml = function()
	{
		document.write(this.getHtml());
	}


}
