//		*****************************************************
//		File Name:		infRollover.js
//		Description:	Rollover Page
//						Infolibria
//		Date:			8/12/00
//		Author:			Nathan Hodson
//		=====================================================
//		Change History
//		==============
//		Date	Author		Description
//		=====================================================
//
//		***************************************************** 

// Number of Tabs
// ==============
var intCount
intCount=0;
var intSelectedButton
intSelectedButton = 1
// Tab Arrays
// ==============
var strButtonNames = new Array(10);
var strButtonAction = new Array(10);
var strButtonOffImage = new Array(10);
var strButtonOnImage = new Array(10);
var strButtonOverImage= new Array(10);

// ===============================
// Generate Button
// ===============
// Build a button layer
// ===============================
function GenerateButton(strButtonName, intTop, intLeft, intWidth, intHeight, strOffImageURL, strOverImageURL, strOnImageURL, strAction) {
	intCount++;
	strButtonNames[intCount] = strButtonName;
	strButtonAction[intCount] = strAction;
	strButtonOffImage[intCount] = strOffImageURL;
	strButtonOverImage[intCount] = strOverImageURL;
	strButtonOnImage[intCount] = strOnImageURL;

	var sContent;
	sContent=	'<p align=right>';
	sContent+=	'<a href="#" onMouseUp="ButtonClick('+intCount+')" onMouseOver="ButtonOver('+intCount+')" onMouseOut="ButtonOut('+intCount+')">';
	sContent+=	'<img name="img'+ strButtonName +'" id="img'+ strButtonName +'" src="'+strOffImageURL+'" width="'+intWidth+'" height="'+intHeight+'" border="0" alt=""></p>';
	GenerateSimplePopup(strButtonName, null, intTop,intLeft, intWidth, intHeight, sContent, 'visible',iZTop);
}

// ===============================
// Button Click
// ============
// Deselect all buttons
// Select Correct Button
// Perform Action
// ===============================
function ButtonClick(intNumber) {
	// Check it is valid
	if (intNumber <= intCount) {
		DeselectAllButtons();
		SelectButton(intNumber);
		ActionButton(intNumber);
	}
}

// ===============================
// Deselect All
// ============
// Deselect all buttons
// ===============================
function DeselectAllButtons() {
	var Name;
	var imgid;
	var Command;
	for(i=1; i <= intCount; i++){
		Name = strButtonOffImage[i];
		imgid = "img" + strButtonNames[i];
		Command = 'document.all.' + imgid +'.src= "' + Name + '";';
		eval(Command);
	}
}

// ===============================
// Select Button
// ===============================
function SelectButton(intNumber) {
	intSelectedButton = intNumber;
	var Name = strButtonOnImage[intNumber];
	var imgid = "img" + strButtonNames[intNumber];
	var Command = 'document.all.' + imgid +'.src= "' + Name +'";';
	eval(Command);
}

// ===============================
// Action Button
// ===============================
function ActionButton(intNumber) {
	eval(strButtonAction[intNumber]);
}

// ===============================
// Button Over
// ===============================
function ButtonOver(intNumber) {
	if (intSelectedButton != intNumber) {
		var Name = strButtonOverImage[intNumber];
		var imgid = "img" + strButtonNames[intNumber];
		var Command = 'document.all.' + imgid +'.src= "' + Name +'";';
		eval(Command);
	}
}

// ===============================
// Button Out
// ===============================
function ButtonOut(intNumber) {
	if (intSelectedButton != intNumber) {
		var Name = strButtonOffImage[intNumber];
		var imgid = "img" + strButtonNames[intNumber];
		var Command = 'document.all.' + imgid +'.src= "' + Name +'";';
		eval(Command);
	}
}
