// ProActiv JavaScript library

// Preload all images for navigation buttons and create objects for rollovers		
//   Build image objects for nav graphics
function buildNavRollovers(navNames,navPath,imgPrefix,current,onSuffix,offSuffix,currentOnSuffix,currentOffSuffix) {
	for (var i = 0; i < navNames.length; i++) {
		// Create Image objects for navigation
		eval(navNames[i] + "On = new Image()");
		eval(navNames[i] + "Off = new Image()");
		
		// Build name of img and path to graphics
		var imgPath = navPath + imgPrefix + navNames[i];
		
		// Init src attributes for image objects
		if (navNames[i] != current) {
			eval(navNames[i] + "On.src = \"" + imgPath + onSuffix + "\"");
			eval(navNames[i] + "Off.src = \"" + imgPath + offSuffix + "\"");
		} else {
			eval(navNames[i] + "On.src = \"" + imgPath + currentOnSuffix + "\"");
			eval(navNames[i] + "Off.src = \"" + imgPath + currentOffSuffix + "\"");
		}
	}
}
		
// Function to activate rollover
function imgOn (imgName) {
   if (document.images) {
   	document.images[imgName].src = eval(imgName + "On.src");
   }
}
  
// Function to deactivate rollover
function imgOff (imgName) {
   if (document.images) {
   	document.images[imgName].src = eval(imgName + "Off.src");
   }
}

// Spawn new window
function openWindow(url,name,winW,winH) {
	var newWindow = window.open(url, name,'width='+winW+',height='+winH+',scrollbars=yes');
	newWindow.focus();
}

// Spawn a popup window
function openPopup(url,name,w,h) {
	var newWindow = window.open(url, name,'width=' + w + ',height=' + h + ',toolbars=no,scrollbars=yes');
	newWindow.focus();
}

// Reload current page with another URL
function openURL(url) {
	window.document.location.href = url;
	return true;
}

// jumpToPage method for select menus
function selectJump(selectForm) {
	var index = selectForm.country.selectedIndex;
	if (index > 0) {
		var URL = selectForm.country[index].value;
		window.location.href = URL;
	}
}

// random number generator
// Returns a random number whose value is between 0 and maxVal
function getRandom(maxVal) {
	var n = Math.random() * maxVal;
	return Math.floor(n);
}

