function Banner(width, height, altText, start){
	this.objName = "bannerAd" + (Banner.count++);
	eval(this.objName + "=this");
	this.altText = altText;
	this.ads = [];
	if (!width) this.width = 425; else this.width = width;
	if (!height) this.height = 119; else this.height = height;
	if (start) this.currentAd = start-1; else start = null;
	this.mySize = 0;

	this.Ad = function(src, href, target, time) {
		var tempImage = new Image();
		tempImage.src = src;
		this.ads[this.mySize] = new Object();
		var ad = this.ads[this.mySize];
		ad.src = src;
		if (typeof(target) == "undefined" || target == null) ad.target = "_self"; else ad.target = target;
		ad.href = href;
		ad.refreshTime = time*1000;
		this.mySize++;
	}

	this.link = function(){
		var	ad = this.ads[this.currentAd];
		if (ad.target == "_self"){
			if (ad.href != null && ad.href != "")
				location.href = ad.href;
			else
				location.href = "#";
		}
		else if (ad.target == "_blank" || ad.target == "_new"){
			if (ad.href != null && ad.href != "")
				open(ad.href,this.objName + "Win");
		}
		else top.frames[ad.target].location.href = ad.href;
	}

	this.showStatus = function(){
		var ad = this.ads[this.currentAd];
		if (ad.mouseover) status = ad.mouseover;
		else status = ad.href;
	}

	this.output = function(){
		var tempCode = "";
		if (this.mySize > 0){
			if (this.currentAd >= this.mySize) this.currentAd = this.mySize - 1;
			tempCode = '<a href="javascript:'+this.objName+'.link();"';
			tempCode += ' onMouseOver="' + this.objName + '.showStatus(); return true"';
			tempCode += ' onMouseOut="status=\'\';return true">';
			tempCode += '<img src="' + this.ads[this.currentAd].src + '" width="' + this.width;
			tempCode += '" name="' + this.objName + 'Img" height="' + this.height + '" ';
			if (this.altText) tempCode += 'alt="'+this.altText + '" ';
			tempCode += 'border="0" style="margin:0px; padding:0px;" /></a>';
			document.write(tempCode);
			this.nextAd();
		} //else document.write("Error: almost one banner must be defined for the script to work.");
	}
	
	this.newAd = function(){	
		this.currentAd++;
		if (this.currentAd >= this.mySize)
			this.currentAd = 0;
		this.nextAd();
	}

	this.nextAd = function(){
		document.images[this.objName+ 'Img'].src = this.ads[this.currentAd].src;
		setTimeout(this.objName+'.newAd()',this.ads[this.currentAd].refreshTime)
	}
}
Banner.count = 0;
