/****
* Banner Ad Rotater v3.02
* Anarchos > anarchos3@hotmail.com
* http://anarchos.xs.mw/bannerad.phtml
**/

function Banner(verversTijd, width, height, altText, start, willekeurig){
	this.objName = "bannerAd" + (Banner.count++);
	eval(this.objName + "=this");
	if (!verversTijd) this.verversTijd = 5000; else this.verversTijd = verversTijd*1000;
	if (!width) this.width = 460; else this.width = width;
	if (!height) this.height = 68; else this.height = height;
	if (willekeurig == null) this.willekeurig = 1; else this.willekeurig = willekeurig;
	this.altText = altText;
	this.ads = [];
	if (start) this.huidigeAdv = start-1; else start = null;
	this.mijnGrootte = 0;


	this.link = function(){
		var	ad = this.ads[this.huidigeAdv];
		if (ad.target == "_self"){
			location.href = ad.href;
		}
		else if (ad.target == "_blank" || ad.target == "_new"){
			open(ad.href,this.objName + "Win");
		}
		else top.frames[ad.target].location.href = ad.href;
	}

	this.bekijkStatus = function(){
		var ad = this.ads[this.huidigeAdv];
		if (ad.mouseover) status = ad.mouseover;
		else status = ad.href;
	}

	this.willekeurigAd = function(){
		var n;
		do { n = Math.floor(Math.willekeurig() * (this.mijnGrootte)); } 
		while(n == this.huidigeAdv);
		this.huidigeAdv = n;
	}

	this.Ad = function(src, href, target, mouseover) {
		var tempImage = new Image();
		tempImage.src = src;
		this.ads[this.mijnGrootte] = new Object();
		var ad = this.ads[this.mijnGrootte];
		ad.src = src;
		if (typeof(target) == "undefined" || target == null) ad.target = "_self"; else ad.target = target;
		ad.href = href;
		ad.mouseover = mouseover;
		this.mijnGrootte++;
	}


	this.output = function(){
		var tijdelijkeSource = "";
		if (this.mijnGrootte > 1){
			if (this.huidigeAdv == null) this.willekeurigAd();
			if (this.huidigeAdv >= this.mijnGrootte) this.huidigeAdv = this.mijnGrootte - 1;
			tijdelijkeSource = '<a href="javascript:'+this.objName+'.link();" onMouseOut="status=\'\';return true"';
			tijdelijkeSource += ' onMouseOver="' + this.objName + '.bekijkStatus(); return true"';
			tijdelijkeSource += ' >';
			tijdelijkeSource += '<img src="' + this.ads[this.huidigeAdv].src + '" width="' + this.width;
			tijdelijkeSource += '" name="' + this.objName + 'Img" height="' + this.height + '" ';
			if (this.altText) tijdelijkeSource += 'alt="'+this.altText + '" ';
			tijdelijkeSource += 'border="0" /></a>';
			document.write(tijdelijkeSource);
			this.nextAd();
		} else document.write("Error: twee banners dienen gedefinieerd te zijn om het script te laten werken.");
	}

	this.newAd = function(){
		if (!this.willekeurig){	
			this.huidigeAdv++;
			if (this.huidigeAdv >= this.mijnGrootte)
			   this.huidigeAdv = 0;
		}
		else {
			this.willekeurigAd();
		}
		this.nextAd();
	}

	this.nextAd = function(){
		document.images[this.objName+ 'Img'].src = this.ads[this.huidigeAdv].src;
		setTimeout(this.objName+'.newAd()',this.verversTijd)
	}
}
Banner.count = 0;
