// This code is based on various pieces of code
// found around the Web. Thanx a lot to Mplungjan
// from E-E for the function to set HomePage in
// Navigator & IE! :)
//
// Browser Multiplexer
// - by dZ

	navName     = navigator.appName;
	navUA       = navigator.userAgent;
	navVersion  = navigator.appVersion;
	win_spawn   = null;

function is_MacIE() {
	return ( navigator.userAgent.toLowerCase().indexOf("mac") != -1 );
}

function is_IE() {
	return ( navUA.indexOf("MSIE") != -1 );
}

function is_Netscape() {
	return (navigator.appName == "Netscape") 
}


function get_IEversion() {
	IEPos = navVersion.indexOf('MSIE');
	return parseInt( navVersion.substring(IEPos + 5, navVersion.indexOf(';', IEPos)) );
}

function get_NNversion() {
	return parseFloat(navVersion);
}

// open_win function
// INPUT:	stringURL : the URL to open
//		winW      : Width of window
//		winH      : Height of window
// OUTPUT:	Will open a new browser window
//		with the strinURL location.
// AUTHOR:	dZ <dz@caribe.net>

function open_win(stringURL, winW, winH) {

	// Arbitrary "MAGIC" values have been restored.
	// It just works better this way, in every browser
	//     -dZ.
	//
	BorderSize   = 4;  // 4px wide
	TitleBarIE   = 14; // 14px per IE toolbar
	TitleBarNN   = 20; // 20px per NN toolbar
	ToolBar      = 'yes'; // Karen wants this
	StatBar      = 'yes';
	MenuBar      = 'yes'; // and this...
	Sizable      = 'yes';

	if (winW && winH) {
		ToolBar      = 'no';
		StatBar      = 'no';
		MenuBar      = 'no';
		Sizable      = 'no';
		winX = ((screen.width  / 2) - (winW / 2));
		winY = ((screen.height / 2) - (winH / 2));

	} else {
		if ( is_IE() ) {
			winX = window.screenLeft - BorderSize;
			winX = (winX <= 0) ? 1 : (winX);

			// Don't ask me... THEY WORK! fuckit!
			winY = window.screenTop - (TitleBarIE * 7) - 1;
			winW = document.body.offsetWidth - BorderSize;
			winH = document.body.offsetHeight - TitleBarIE - BorderSize;

		} else {
			winX = window.screenX;
			winY = window.screenY + TitleBarNN + BorderSize - 1;
			winW = window.outerWidth - (BorderSize * 3);

			// Same here... oh well!
			winH = window.outerHeight - (TitleBarNN * 7) + BorderSize + 1;
		}
	}

	var win_args=	"scrollbars"+
					",toolbar="+ToolBar+
					",status="+StatBar+
					",menubar="+MenuBar+
					",resizable="+Sizable+
					",location=no"+
					",width="+winW+
					",height="+winH+
					",left="+winX+
					",top="+winY+
					",screenX="+winX+
					",screenY="+winY;

	win_spawn = window.open( stringURL, "winSpawnie", win_args );
	win_spawn.opener = self;

	if (navigator.appName == 'Netscape') {
		win_spawn.focus();
	}
}

function SubmitForm(theForm, winW, winH) {
	if ( is_IE() && get_IEversion() < 5 ) {
		theForm.target = "_blank";
		return;
	}
	open_win('/misc/blank.html', winW, winH);
	theForm.target = "winSpawnie";
}

function CreateArray() {
	this.length = CreateArray.arguments.length;
	for (var i = 0; i < this.length; i++)
		this[i] = CreateArray.arguments[i];
}

function BannerJump(LinkIndex) {
	open_win(linkRef[LinkIndex]);
}

function preloadImages(the_images_array, the_sources_array) {
	for(loop = 0; loop < the_sources_array.length; loop++) {
		the_images_array[loop] = new Image;
		the_images_array[loop].src = the_sources_array[loop];
	}
}

function swapImages(theImage, ImageIndex) {
	theImage.src = onImgArray[ImageIndex].src;
}

function revertImages(theImage, ImageIndex) {
	theImage.src = offImgArray[ImageIndex].src;
}

function GetTodaysDate(){
	var dayarray=new Array('Sunday',
							'Monday',
							'Tuesday',
							'Wednesday',
							'Thursday',
							'Friday',
							'Saturday');
	var montharray=new Array('January',
							'February',
							'March',
							'April',
							'May',
							'June',
							'July',
							'August',
							'September',
							'October',
							'November',
							'December');

	var mydate=new Date();
	var year=mydate.getFullYear();
	var day=mydate.getDay();
	var month=mydate.getMonth();
	var daym=mydate.getDate();
	if (daym<10)
	daym="0"+daym

	var TodaysDate = '<I>' + dayarray[day] + '</I>, ' +
					montharray[month] + ' ' +
					daym + ', ' + year;
	return TodaysDate;
}

