<!--

//User defined variables - change these variables to alter the behaviour of the script
var ImageFolder_prom = "/bn/img/bannerderecho/banner_1/"; //Folder name containing the images
var ImageFileNames_prom = new Array('bder_servibancalda.jpg',	
									'bder_promoservibancalda.jpg',
									'bder_servelec2010.jpg',
									'bder_viajesudafricabn.gif',									
									'bder_horcajeros.jpg',																		
									'bder_calen2010.jpg',
									'bder_ganbnsorteos.gif'); //List of images to use

//var imgref -- definida en configbanner
var ImageURLs_prom = new Array('BN/index.asp?c=home',
							   'BN/downloads/BNCR - Reglamento promocion BN Liga.pdf',
							   'BN/downloads/BNCR - Reglamento BN Especiales Servicios Electronicos.pdf',
							   'BN/downloads/BNCR - Reglamento SudAfrica 2010.pdf',							   
							   'BN/index.asp?c=home',							   
							   'BN/downloads/BNCR - Detalle Patrimonios del Calendario 2010.pdf',	
							   'BN/downloads/BNCR - Ganadores BN Sorteos Electronicos.pdf'); //List of hyperlinks associated with the list of images

var DefaultURL_prom = 'http://www.bncr.fi.cr/BN/index.asp?c=home'; //Default hyperlink for the Banner Ad
var DisplayInterval_prom = 4; //Number of seconds to wait before the next image is displayed
var TargetFrame_prom = ""; //Name of the frame to open the hyperlink into

//Internal variables (do not change these unless you know what you are doing)
var IsValidBrowser_prom = false;
var BannerdoCode = 0;
var BannerdoImages = new Array(NumberOfImages_prom);
var DisplayInterval_prom = DisplayInterval_prom * 1000;
var NumberOfImages_prom = ImageFileNames_prom.length;

//A dd a trailing forward slash to the ImageFolder_prom variable if it does not already have one
if (ImageFolder_prom.substr(ImageFolder_prom.length - 1, ImageFolder_prom.length) != "/" && ImageFolder_prom != "") { ImageFolder_prom += "/";
}

if (TargetFrame_prom == '') {
var FramesObject_prom = null;
} else {
var FramesObject_prom = eval('parent.' + TargetFrame_prom);
}

//Function runs when this page has been loaded and does the following:
//1. Determine the browser name and version
// (since the script will only work on Netscape 3+ and Internet Explorer 4+).
//2. Start the timer object that will periodically change the image displayed
// by the Banner Ad.
//3. Preload the images used by the Banner Ad rotator script
function InitialiseBannerDoRotator_prom() {

//Determine the browser name and version
//The script will only work on Netscape 3+ and Internet Explorer 4+
var BrowserType_prom = navigator.appName;
var BrowserVersion_prom = parseInt(navigator.appVersion);

if (BrowserType_prom == "Netscape" && (BrowserVersion_prom >= 3)) {
IsValidBrowser_prom = true;
}

if (BrowserType_prom == "Microsoft Internet Explorer" && (BrowserVersion_prom >= 4)) {
IsValidBrowser_prom = true;
}

if (IsValidBrowser_prom) {
TimerObject_prom = setTimeout("ChangeImage_prom()", DisplayInterval_prom);
BannerdoCode = 0;

for (i = 0; i < NumberOfImages_prom; i++) {
BannerdoImages[i] = new Image();
BannerdoImages[i].src = ' ' + ImageFolder_prom + ImageFileNames_prom[i];
}

}

}

//Function to change the src of the Banner Ad image
function ChangeImage_prom() {

if (IsValidBrowser_prom) {
BannerdoCode = BannerdoCode + 1;

if ( BannerdoCode == NumberOfImages_prom) {
BannerdoCode = 0;
}

window.document.bannerdo.src = BannerdoImages[BannerdoCode].src;
TimerObject_prom = setTimeout("ChangeImage_prom()", DisplayInterval_prom);
}
}

//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_prom is displayed
function ChangePage_prom() {

if (IsValidBrowser_prom) {

if (TargetFrame_prom != '' && (FramesObject_prom)) {
FramesObject_prom.location.href = imgref + ImageURLs_prom[BannerdoCode]; // dirección server + archivo descarga
} else {
document.location = imgref + ImageURLs_prom[BannerdoCode];
}

} else if (!IsValidBrowser_prom) {
document.location = DefaultURL_prom;
}

}
