/*****************************************/
/***       General Display Setup       ***/
/*****************************************/
window.top.document.title = window.document.title;
window.defaultStatus = window.document.title;

/*****************************************/
/***      Determine Browser Setup      ***/
/*****************************************/
var BrowserName = navigator.appName;
var BrowserVer = parseInt(navigator.appVersion);
var BrowserNick = "";
if ((BrowserName == "Netscape") && (BrowserVer < 4)) { BrowserNick = "NS3"; }
else if ((BrowserName == "Netscape") && (BrowserVer >= 4)) { BrowserNick = "NS4"; }
else if ((BrowserName == "Microsoft Internet Explorer") && (BrowserVer < 4)) { BrowserNick = "IE3"; }
else if ((BrowserName == "Microsoft Internet Explorer") && (BrowserVer >= 4)) { BrowserNick = "IE4"; }
else { BrowserNick = "UNK"; }

/*****************************************/
/***   Write The Last-Modified Date    ***/
/*****************************************/
function insertDateModified()
{
	var tmpPointer = null;
	if (document.lastModified)
	{
		MonthNameArray = new Array("January","February","March","April","May","June","July","August","September","October","November","December")
		var dlm = new Date(document.lastModified);
		var mnt = MonthNameArray[dlm.getMonth()];
		tmpPointer = mnt + " " + dlm.getDate()
		if (BrowserNick == "IE4") { tmpPointer += ", " + dlm.getYear(); }
		document.write(tmpPointer);
	}
}

/*****************************************/
/***   Change Visibility Of A Layer    ***/
/*****************************************/
function PopupLayer(ieobjectid, nsobjectid, current)
{
	if (BrowserName == 'Netscape')
	{
		var tmpPointer = null;
		if (nsobjectid != null) { tmpPointer = nsobjectid; } else { tmpPointer = ieobjectid; }
		if (current != null) { current.visibility = 'hide'; };
		if (tmpPointer != null) { current = eval(tmpPointer); current.visibility = 'show'; }
	}
	else
	{
		if (current != null) { current.style.visibility = 'hidden'; };
		if (ieobjectid != null) { current = eval(ieobjectid); current.style.visibility = 'visible'; }
	}
	return current;
}

/*****************************************/
/***            Move Layer             ***/
/*****************************************/
function MoveLayer(ieobjectid, nsobjectid, coordleft, coordtop)
{
	var tmpPointer = null;
	if ((BrowserName != 'Netscape') || (nsobjectid == null)) { tmpPointer = ieobjectid; } else { tmpPointer = nsobjectid; }
	coordcount = arguments.length;
	if (coordcount > 1) { eval(tmpPointer + '.' + ((BrowserName != 'Netscape') ? 'style.pixelLeft' : 'left') + ' = coordleft;'); }
	if (coordcount > 2) { eval(tmpPointer + '.' + ((BrowserName != 'Netscape') ? 'style.pixelTop' : 'Top') + ' = coordtop;'); }
}

/*****************************************/
/***  Constructor For An Image Array   ***/
/*****************************************/
function ImageArray() /* Accepts image path names as arguments */
{
	this.length = ImageArray.arguments.length;
	var ti = new Image();
	ti.src = ImageArray.arguments[0];
	for (var i = 1; i < this.length; i++) { this[i] = ti; ti = new Image(); ti.src = ImageArray.arguments[i]; }
	this[i] = ti;
	return this;
}

/*****************************************/
/** Preloads images files into the cache */
/*****************************************/
function PreloadImages()
{
	if (document.images)
	{
		var imgFiles = PreloadImages.arguments;
		var preloadArray = new Array();
		for (var i=0; i<imgFiles.length; i++)
		{
			preloadArray[i] = new Image;
			preloadArray[i].src = imgFiles[i];
		}
	}
}

/*****************************************/
/*** Change Images To Simulate Buttons ***/
/*****************************************/
function ChangeImage(ieobjectid, nsobjectid, imagesrc)
{
	var tmpPointer = null;
	if ((BrowserName != 'Netscape') || (nsobjectid == null)) { tmpPointer = ieobjectid; } else { tmpPointer = nsobjectid; }
	eval(tmpPointer + '.src = imagesrc.src;')
}

/*****************************************/
/** Format a decimal number to currency **/
/*****************************************/
function FormatCurrency(price)
{
	var tempstr = "" + price;
	var decat = tempstr.indexOf('.');
	var length = tempstr.length - tempstr.indexOf('.');
	// If no decimal then add on '.00'.
	if (decat == -1) return tempstr + '.00';
	// If decimal is no places then add '00'.
	if (length == 1) return tempstr + '00';
	// If decimal is one places then add '0'.
	if (length == 2) return tempstr + '0';
	// If decimal is longer than two places then truncate.
	if (length > 3) return tempstr.substring(0, tempstr.length - length + 3);
	// Simple return the string because it is already formatted.
	return tempstr;
}