// JavaScript Document

//JavaScript Banner Ad Rotator version 2.1 - last modified 16 November 2000
//Obtained from http://www.brettb.com/js_banner_ad_rotator.asp
//Email comments or suggestions using the form at http://www.brettb.com/Contact.asp
//If you want a version of this script that will open links in a new browser window
//then please visit http://www.winnershtriangle.com/w/Products.JavaScriptBannerAdRotator.asp

//User defined variables - change these variables to alter the behaviour of the script
var Folder = "./filebank/imagebank/"; //Folder name containing the images
var FileNames = new Array('firstcoin.jpg', 'teen_plus.jpg'); //List of images to use
var URLs = new Array('page.asp?p=17832&l=1', 'page.asp?p=17833&l=1'); //List of hyperlinks associated with the list of images
var Default = 'page.asp?p=17832&l=1'; //Default hyperlink for the Bann_er Ad
var Interval = 4; //Number of seconds to wait before the next image is displayed
var Frame = ""; //Name of the frame to open the hyperlink into

//Internal variables (do not change these unless you know what you are doing)
var IsValidBrowser = false;
var BannerCode = 0;
var BannerImages = new Array(NumberOfImages);
var Interval = Interval * 1000;
var NumberOfImages = FileNames.length;

//A dd a trailing forward slash to the Folder variable if it does not already have one
if (Folder.substr(Folder.length - 1, Folder.length) != "/" && Folder != "") 
{ 
Folder += "/";
}

if (Frame == '') {
var FramesObject = null;
} 
else 
{
var FramesObject = eval('parent.' + Frame);
}

function InitialiseAdRotator() {

//Determine the browser name and version
//The script will only work on Netscape 3+ and Internet Explorer 4+
var BrowserType = navigator.appName;
var BrowserVersion = parseInt(navigator.appVersion);

if (BrowserType == "Netscape" && (BrowserVersion >= 3)) {
IsValidBrowser = true;
}

if (BrowserType == "Microsoft Internet Explorer" && (BrowserVersion >= 4)) {
IsValidBrowser = true;
}

if (IsValidBrowser) {
TimerObject = setTimeout("ChangeAdImage()", Interval);
BannerCode = 0;

for (i = 0; i < NumberOfImages; i++) {
BannerImages[i] = new Image();
BannerImages[i].src = ' ' + Folder + FileNames[i];
}

}

}


//Function to change the src of the Banner Ad image
function ChangeAdImage() {

if (IsValidBrowser) {
BannerCode = BannerCode + 1;

if (BannerCode == NumberOfImages) {
BannerCode = 0;
}

window.document.bannerMain.src = BannerImages[BannerCode].src;
TimerObject = setTimeout("ChangeAdImage()", Interval);
}
}

//Function to redirect the browser window/frame to a new location,
//depending on which image is currently being displayed by the Banner Ad.
//If Banner Ad is being displayed on an old browser then the DefaultURL is displayed
function ChangeAdPage() {

if (IsValidBrowser) {

if (Frame != '' && (FramesObject)) {
	FramesObject.location.href = URLs[BannerCode];
} else {
	document.location = URLs[BannerCode];
}

} else if (!IsValidBrowser) {
	document.location = DefaultURL;
}

}
