/////////////////////////////////////////////////////////////////////////
//	
//	THIS FILE REQUIRES:
//		1)	objects.js
//
//	THE FILE(S) SPECIFIED ABOVE MUST BE INCLUDED AS AN EXTERNAL JS REFERENCE
//	IN THE HTML DOCUMENTS, IN THE ORDER SPECIFIED.
//


/////////////////////////////////////////////////////////////////////////////
//	PROGRAMMER:		Mark Herbert
//	DESCRIPTION:	Returns the domain in the address bar
//
function GetDomain() {
	var href = top.location.href;
	var root = 'kwhydro';

	if (href.indexOf('.on.') > 0) {
	    domain = '.on.ca';
	}
	else if (href.indexOf('.ca') > 0) {
	    domain = '.ca';
	}
	else if (href.indexOf('.com') > 0) {
	    domain = '.com';
	}
	else {
	    domain = '.on.ca';
	}
    	
	return root + domain;
}

//////////////////////////////////////////////////////////////////////
//
// PROGRAMMER:	?
// VERSION:	?
// FUNCTION:	Reloads the window if Nav4 resized
// USAGE:	
//
//
function MM_reloadPage(init) {  //reloads the window if Nav4 resized	
	if (init) {
		with (oNav) {
			if ((appName == "Netscape") && (parseInt(appVersion) == 4)) {
				oDoc.MM_pgW = innerWidth;
				oDoc.MM_pgH = innerHeight;
				onresize = MM_reloadPage;
			}
		}
	}
	else if (innerWidth != oDoc.MM_pgW || innerHeight != oDoc.MM_pgH) {
		location.reload();
	}
}


//////////////////////////////////////////////////////////////////////
//
// PROGRAMMER:	HVMenu Author
// VERSION:	?
// FUNCTION:	Called when the menu is in frames
// USAGE:	Gets called from the menu_engine.js
//
//
function Go() {
	return;
}


//////////////////////////////////////////////////////////////////////
//
// PROGRAMMER:	Mark Herbert
// VERSION:	
// FUNCTION:    Sets that text in the status bar
// USAGE:       pass the text you want in the status bar.  If you want
//              to clear the status bar pass it an empty string 
//
//
function SetStatusText(text) {
	oWin.status = text;
}


//////////////////////////////////////////////////////////////////////////////
//	PROGRAMMER:		Mark Herbert
//	DESCRIPTION:	Returns a random number for a range
//	PARAMETERS:		Range:	Max number in your range 
//								(i.e. if I have 1-10 that I want to randomize, range would be 10)
//
function GetRandomNumber(Range) {
	var ran_num = Math.floor((Math.random() * Range));	
	return ran_num;
}



////////////////////////////////////////////////////////////////////////
//
//	PROGRAMMER:	Mark Herbert
//	DESCRIPTION:	Opens the specified url in the specified target
//	PARAMETERS:	url	= Url to load
//			target	= Where to load the url
//
function LoadURL(url, target) {
	if (target == '_self') {
		top.location.href = url;
	} else if (target == '_blank') {
		oWin.open(url);
	} else {
		target.top.location.href = url;
	}
}

function OpenWindow(url, width, height) {
	var cwidth = screen.width;
	var cheight = screen.height;
	var nleft = (cwidth - width) / 2;
	var ntop = (cheight - height) / 2;	
	var hWnd = window.open(url, '', 'width=' + width + 'height=' + height + '');
	hWnd.moveTo(nleft, ntop);
}
