// Banner Ad Rotation Script/*Allows you to rotate multiple banner ads on your page and change them after a certain time. It's object-oriented so you don't need to mess with the code; it should be easy for you to set it up. To include the banner ad script you'll need to put this into the <head>: <script type="text/javascript" src="ad-rotator.js"></script> Here's a quick syntax guide for the new version: <script type="text/javascript"><!--myAd = new Banner( 5, 175, 41, "click here", 1, 0 );myAd.Ad( "images/logo3.gif", "http://www.lycos.com", null, "Testing baby." );myAd.Ad( "images/pixel_black.gif", "http://www.google.com", null, "Another test" );myAd.Ad( "images/pixel_grey.gif", "#superblah", "_blank", "Yet another test" );myAd.output();// --></script> The parameters for Banner() are: time between rotations (seconds), width of banners, height of banners, alt text, starting banner, and random (0 means it iterates through banners, 1 means it randomly picks the next banner). The parameters for Ad() are: path to image, url, target (use "_blank" to open in a new window), and mouseover message. For most of these parameters, a null tells the script to use the default value. Note: if you want to have multiple banner ad rotators on the same page, don't use myAd as the variable name for each one. You'll need a different name each rotator.*/function Banner(refreshTime, width, height, altText, start, random){	this.objName = "bannerAd" + (Banner.count++);	eval(this.objName + "=this");	if (!refreshTime) this.refreshTime = 5000; else this.refreshTime = refreshTime*1000;	if (!width) this.width = 460; else this.width = width;	if (!height) this.height = 68; else this.height = height;	if (random == null) this.random = 1; else this.random = random;	this.altText = altText;	this.ads = [];	if (start) this.currentAd = start-1; else start = null;	this.mySize = 0;	this.Ad = function(src, href, target, mouseover) {		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.mouseover = mouseover;		this.mySize++;	}	this.link = function(){		var	ad = this.ads[this.currentAd];		if (ad.target == "_self"){			location.href = ad.href;		}		else if (ad.target == "_blank" || ad.target == "_new"){			open(ad.href,this.objName + "Win");		}		else top.location.href = ad.href;	}	this.showStatus = function(){		var ad = this.ads[this.currentAd];		if (ad.mouseover) status = ad.mouseover;		else status = ad.href;	}	this.randomAd = function(){		var n;		do { n = Math.floor(Math.random() * (this.mySize)); } 		while(n == this.currentAd);		this.currentAd = n;	}	this.output = function(){		var tempCode = "";		if (this.mySize > 1){			if (this.currentAd == null) this.randomAd();			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" /></a>';			document.write(tempCode);			this.nextAd();		} else document.write("Error: two banners must be defined for the script to work.");	}	this.newAd = function(){		if (!this.random){				this.currentAd++;			if (this.currentAd >= this.mySize)			   this.currentAd = 0;		}		else {			this.randomAd();		}		this.nextAd();	}	this.nextAd = function(){		document.images[this.objName+ 'Img'].src = this.ads[this.currentAd].src;		setTimeout(this.objName+'.newAd()',this.refreshTime)	}}Banner.count = 0;
