//<script language="JavaScript">

var usat = new clsUsat();
usat.init();

function clsUsat () {

	this.util = new clsUtil();
	this.init = fxInit;
	
	/*
		Members
	*/
	function fxInit () {   // member of clsUsat
		this.util.init();
	}   // fxInit

	function clsUtil () {   // member of clsUsat
		/*
			Class containing common utility functions such as 
			trimming a string
		*/
		this.init = fxInit;
		this.openBareWindow = fxOpenBareWindow;
		/*
			Members
		*/
		function fxInit () {   // member of clsUtil
			/*
				ok this is kind of funky.  String in JavaScript does not contain a
				trim function.  So during load, dynamically add this trim function
				to the prototype of String.  Now every string object has a trim
				function.
			*/
			String.prototype.trim = fxTrim;
		}  // fxInit

		function fxTrim (strInput) {   // member of clsUtil

			var strResult = null;
			if (strInput == null)
				strInput = this;
			if (strInput){
				strResult = new String(strInput);
				strResult = strResult.replace(/^\s+/, "");
				strResult = strResult.replace(/\s+$/, "");
			}
			return(strResult);
		}   // fxTrim

		function fxFormatPath(strPath,targetDirection){

			var RE;
			if (targetDirection == "/"){
				RE = /\\/g;
			} else {
				targetDirection = "\\";   // in case is null or is neither / nor \
				RE = /\//g;
			}//else
			strPath = strPath.replace(RE,targetDirection);
			return(strPath);
		} // fxFormatPath Function

		function fxOpenBareWindow(url, title, width, height){   // member of clsUtil
			/*
				Opens a window with the specified url, title, height, and width
				but with no decorations (scroll bar, toolbar, etc.)
			*/
			window.open(url, title, "scrollbars=no,menubar=no,toolbar=no,status=no,top=0,left=0,screenx=0,screeny=0,width=" + width + ",height=" + height + ",resizable=no");
		}   // fxOpenBareWindow


	}   // clsUtil
}   // clsUsat

var APlayerSrc = "";

function OpenAudio (url) {
	/*
		Comments
		Opens a window pointing to /audio/aplay1v*.htm
		* is 1 if the JavaScript version is >= 1.2, 2 otherwise
		the APlayerSrc variable is set so it can be referenced by the opened page
	*/
	APlayerSrc = url;
	var page = "/audio/aplay1v1.htm";
	if (_version < 12){
		page = "/audio/aplay1v2.htm";
	}   // if
	usat.util.openBareWindow(page, "RAPlayer", 390, 220);
}   // OpenAudio

var VPlayerSrc = "";

function OpenVideo (url) {
	/*
		Comments
		Opens a window pointing to /video/mplay5v*.htm
		* is 1 if the JavaScript version is >= 1.2, 2 otherwise
		the VPlayerSrc variable is set so it can be referenced by the opened page
	*/
	VPlayerSrc = url;
	var page = "/video/videoplayer.htm";
	if (_version < 12){
		page = "/video/videoplayer.htm";
	}   // if
	usat.util.openBareWindow(url, "RMPlayer", 369, 414);
}   // OpenVideo

function OpenVideobig (url) {
	/*
		Comments
		Identical to OpenVideo except the new window's height is larger
	*/
	VPlayerSrc = url;
	var page = "/video/mplay6v1.htm";
	if (_version < 12){
		page = "/video/mplay6v2.htm";
	}   // if
	usat.util.openBareWindow(page, "RMPlayer", 369, 414);
}   // OpenVideobig

function OpenVideoNoad (url) {
	/*
		Comments
		Opens a window pointing to /video/mplay_noad_*.htm
		* is 1 if the JavaScript version is >= 1.2, 2 otherwise
		the VPlayerSrc variable is set so it can be referenced by the opened page
	*/
	VPlayerSrc = url;
	var page = "/video/mplay_noad_1.htm";
	if (_version < 12){
		page = "/video/mplay_noad_2.htm";
	}   // if
	usat.util.openBareWindow(page, "RMPlayer", 369, 414);
}   // OpenVideo

var _version = 10;
detectJSVersion();
function detectJSVersion(){
	/*
		Comments
		_version is provided for backwards compatability with old scripts
		In order to detect different javascript versions, we need to have
		a seperate script tag for each version with only 1 line of code.  
		Instead of having to write x script tags on every page, if this 
		script is included all the necessary version detection tags will
		be written automatically.
	*/
	//document.write("<scr" + "ipt language=\"JavaScript1.1\">_version = 11;</S" + "CRIPT>");
	//document.write("<scr" + "ipt language=\"JavaScript1.2\">_version = 12;</S" + "CRIPT>");
}   // detectJSVersion


