// 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 cFolder = "./filebank/imagebank/"; //Folder name containing the images
var cFileNames = new Array('InvestmentsServicesUnit.jpg'); //List of images to use
var cURLs = new Array('http://www.apsbank.com.mt/page.asp?p=17730&l=1'); //List of hyperlinks associated with the list of images
var cDefault = 'page.asp?p=17730&l=1'; //Default hyperlink for the Bann_er Ad
var cInterval = 4; //Number of seconds to wait before the next image is displayed
var cFrame = ""; //Name of the frame to open the hyperlink into

//Internal variables (do not change these unless you know what you are doing)
var cIsValidBrowser = false;
var cBannerCode = 0;
var cBannerImages = new Array(cNumberOfImages);
var cInterval = cInterval * 1000;
var cNumberOfImages = cFileNames.length;

//A dd a trailing forward slash to the Folder variable if it does not already have one
if (cFolder.substr(cFolder.length - 1, cFolder.length) != "/" && cFolder != "") 
{ 
cFolder += "/";
}

if (cFrame == '') {
var cFramesObject = null;
} 
else 
{
var cFramesObject = eval('parent.' + cFrame);
}

function InitialiseCompetitionRotator() {

//The script will only work on Netscape 3+ and Internet Explorer 4+
var cBrowserType = navigator.appName;
var cBrowserVersion = parseInt(navigator.appVersion);

if (cBrowserType == "Netscape" && (cBrowserVersion >= 3)) {
cIsValidBrowser = true;
}

if (cBrowserType == "Microsoft Internet Explorer" && (cBrowserVersion >= 4)) {
cIsValidBrowser = true;
}

if (cIsValidBrowser) {
cTimerObject = setTimeout("ChangeInvestImage()", cInterval);
cBannerCode = 0;

for (i = 0; i < cNumberOfImages; i++) {
cBannerImages[i] = new Image();
cBannerImages[i].src = ' ' + cFolder + cFileNames[i];
}

}

}


//Function to change the src of the Banner Ad image
function ChangeInvestImage() {

if (cIsValidBrowser) {
cBannerCode = cBannerCode + 1;

if (cBannerCode == cNumberOfImages) {
cBannerCode = 0;
}

window.document.bannerCompetition.src = cBannerImages[cBannerCode].src;
cTimerObject = setTimeout("ChangeInvestImage()", cInterval);
}
}

//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 ChangeInvestPage() {

if (cIsValidBrowser) {

if (cFrame != '' && (cFramesObject)) {
	cFramesObject.location.href = cURLs[cBannerCode];
} else {
	document.location = cURLs[cBannerCode];
}

} else if (!cIsValidBrowser) {
	document.location = cDefaultURL;
}

}

