

	//
	//	Global IFrame Resize Code
	//
	
		//
		//	Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
		//	Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
		//
		var iframeids=["WinBody"]
		
		//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
		var iframehide="no"
		
		//	Set this onload of Iframe if display is cut off bottom - ERA
		var iFrameExtra=0;
	

	//
	//	Global Flash Vars :: Defined by Adobe
	//
	var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
	var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers


	//
	//	Used for highlight functions
	//
	var HL = new Object;
	
	
	//
	//	Global Use for Mouse Positions
	//
	var GetMouseX = 0;
	var GetMouseY = 0;
		
	//
	//	Global for GalaxyNet Menus
	//
	GN_Menu 	 = new Object();		
	GN_Menu.Page = new Object();
	

	//
	//	Global  Used by Drag Drop Functions
	//
	var mouseover = true; 
	var DragDropObject;
	
	
	//
	//	Browser Check
	//
	var isIE 		= false;
	var isOpera 	= false;
	var isFirefox 	= false;
	var isChrome 	= false;
	var isSafari 	= false;
		
	DetectBrowserType = function() {
	
		isIE 		= (navigator.userAgent.indexOf("MSIE") != -1) ? true : false;
		isOpera 	= (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
		isChrome 	= (navigator.userAgent.indexOf("Chrome") != -1) ? true : false;
		if (!isChrome) {
			isSafari 	= (navigator.userAgent.indexOf("Apple") != -1) ? true : false;
			if (!isSafari && !isOpera && !isIE) {
				isFirefox =	true;
			}
		} 
		
	}	
	
	DetectBrowserType();
	
	
	//
	//	Get Object Value from an ID
	//
	function GetID(ObjStr, DefaultValue, Parent) {
		
		if (typeof(ObjStr) == 'object') {
			return 	ObjStr;
		}
		
		try {
			if (Parent != undefined) {
				Obj = Parent.document.getElementById(ObjStr);
			} else {
				Obj = document.getElementById(ObjStr);
			}
			if (Obj == null) {
				try {
					Obj = eval(ObjStr)
					
					if (Obj == null) {
						Obj = undefined;
					}
				} catch(e) {
					Obj = undefined;
				}
			}
			return Obj
		} catch(e) {
			
			try {
				return eval(ObjStr)
				if (Obj == null) {
					return DefaultValue;
				}
			
			} catch(e) {
				return DefaultValue;
			}
		}
	}


	//
	//	SafeSize Make value 0 if non zeroor neg
	//
	function SafeSize(IntValue) {
		
		if (parseInt(IntValue) < 0) {
			IntValue = 0;
		}
		
		return IntValue;
		
	}


	//
	//	Get Object Value from an ID
	//
	function IfVarExists(ObjStr) {
		
		try {
			var t = document.getElementById(ObjStr);
			return true;
		} catch(e) {
			return false;
		}
	}
	
		
	
	//
	//
	//
	var LastWaitDiv;
	var LastModalDiv;
	

	//
	//	Get Object Value from an ID
	//
	function GetNode(ParentObject, ObjStr) {
		
		return ParentObject.getAttributeNode(ObjStr);
		
	}

	


	function LTrim(s) {
		try {
	        return s.replace( /^\s*/, "" );
		} catch(e) {
			return s;
		}
    }

    function RTrim(s) {
		try {
	        return s.replace( /\s*$/, "" );
		} catch(e) {
			return s;
		}
    }

    function Trim(s){
        return RTrim(LTrim(s));
    }

	
	
	//_____________________________________________________________________________
	//
	//  GET TOKEN: Get a value in a delimited str
	//
	function GetToken(Str, Position, FindStr) {

		var	u 	= 0;
		var c   = 0;
		var s   = 0;
		var e   = 0;
		
		Str 	= String(Str);
		FindStr = String(FindStr);
		
		for (var t=0;t<Str.length;t++) {
			c++;
			u = Str.indexOf(FindStr, u + 1);
			if (u == -1) {	// EOL
				e = Str.length - u;
				if (c < Position) {
					Str = '';
					break;
				}
			} else {
				e = u - s;
			}
		
			if (c == Position) {
				Str  = Str.substr(s, e);
				break;
			}
			s = u + 1;
		}
		
		
		return String(Str);
	}
	
	
	//_____________________________________________________________________________
	//
	//	Return the Number Of Items in a String Listy
	//
	function ListLen(Str, DelStr) {
		if (Str==undefined) {
			return -1;
		}
		var c = Str.split(DelStr);
		return c.length;
	}


	
	function WriteHTML(WindowName, HTML) {
	
		GetID(WindowName).innerHTML = HTML;
	}
	
	
	//
	//
	//
	function LoadFlashMovieStr(WindowName, SWFFile, Width, Height, Version, Secure, SWFName, Transparent) {

		if (Width == undefined) {
			Width = '100%';
		}
		if (Height == undefined) {
			Height = '100%';
		}

		if (Version == undefined) {
			Version = '10';
		}
		
		if (Secure == undefined) {
			Secure = 's';
		}
		
		if (SWFName == undefined) {
			SWFName = 'ABC';
		}
		
		if (Transparent == undefined) {
			Transparent = 'transparent'
		}
		
		var Str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http' + Secure + '://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + Version + '"';
			Str = Str + '	width="' + Width + '" height="' + Height + '" id="' + SWFName + '">';
			Str = Str + '	<param name="movie" value="' + SWFFile + '">';
			Str = Str + '	<param name="quality" value="high">';
			Str = Str + '	<param name="wmode" value="' + Transparent + '">';
			Str = Str + '	<embed ';
			Str = Str + '		src="' + SWFFile + '" ';
			Str = Str + '		quality="high" ';
			Str = Str + '		pluginspage="http' + Secure + '://www.macromedia.com/go/getflashplayer" ';
			Str = Str + '		type="application/x-shockwave-flash" ';
			Str = Str + '		width="' + Width + '" ';
			Str = Str + '		height="' + Height + '"';
			Str = Str + '		wmode="' + Transparent + '">';
			Str = Str + '	</embed>';
			Str = Str + '</object>';
		
		return Str;

	}
	
	//
	//
	//
	function LoadFlashMovie(WindowName, SWFFile, Width, Height, Version, Secure, SWFName,Transparent) {

		WriteHTML(WindowName, LoadFlashMovieStr(WindowName, SWFFile, Width, Height, Version, Secure, SWFName,Transparent));
		
	}

	//
	//
	//
	function LoadPDFStr(PDFile, Width, Height, ID) {
		var Str = '<object classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" width="' + Width + '" height="' + Height + '" id="' + ID +'" >';
			Str = Str + '	<param name="SRC" value="' + PDFile + '">';
			Str = Str + '	<embed  ';
			Str = Str + '		id="' + ID + '" ';
			Str = Str + '		src="' + PDFile + '" ';
			Str = Str + '		width="' + Width + '" ';
			Str = Str + '		height="' + Height + '"';
			Str = Str + '		 >';
			Str = Str + '	</embed>';
			Str = Str + '</object>';
		
		return Str;
	}
	
	
		
	//
	//
	//
	function LoadPDF(WindowName, PDFile, Width, Height, ID) {
		WriteHTML(WindowName, LoadPDFStr(PDFile, Width, Height, ID));
	}


	//
	//
	//
	function LoadXLS(WindowName, File, Width, Height) {
		CreateIFrame(WindowName, 'Excel', File);
		//WriteHTML(WindowName, LoadXLSStr(File, Width, Height));
	}


	//
	//
	//
	function LoadDOC(WindowName, File, Width, Height) {
		CreateIFrame(WindowName, 'Doc', File);
		//WriteHTML(WindowName, LoadXLSStr(File, Width, Height));
	}


	//
	//	Create an HTML Element and Fetch a URL
	//
	function GetHTTPNewWindow(Owner, ElementID, ElementType, Style, HTTP, LoadingMSG ) {
		GetHTTP(CreateElement(Owner, ElementID, ElementType, Style), HTTP, LoadingMSG);
	}
	

	//
	//	Fetch a URL and Insert Content into Window Name
	//	If WindowName = '' Just Return Content
	//
	function GetHTTP(WindowName, HTTP, LoadingMSG, onComplete, Append) {

		var xmlhttp;

		if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
			try {
				xmlhttp = new XMLHttpRequest();
			}	 
			catch (e) {
				alert("Your browser is not supporting XMLHTTPRequest");
				return false;
			}
		} else {
			xmlhttp = (window.XMLHttpRequest)? new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
				//new ActiveXObject("Microsoft.XMLHTTP");
		}
	

		var request = xmlhttp;
		request.open("GET", HTTP); 
		
		request.onreadystatechange = function() {

			if(request.readyState == 1) {
				if (!Append) {
					if (LoadingMSG == undefined) {
						WindowName.innerHTML = 'Loading...';
					} else {
						WindowName.innerHTML = LoadingMSG;
					}
				}
			}
			if(request.readyState == 4) {
				if (request.status == 200) { 

					if (WindowName!='') {
						if (Append==true) {
							AppendHTML(WindowName, request.responseText);
						} else {
							WriteHTML(WindowName, request.responseText);
						}
					}

					if (onComplete!=undefined) {
						onComplete(request.responseText);
					} 
					
					request = undefined;
					
					//} else {
					///	var ret = request.status;
					//	request = undefined
					//	return ret;
					//}
				} else {
					alert('Background Load Error: ' + HTTP + ' [ ' + request.status +' ]');
				}
				request = undefined;
			}
			
		} 
		
		request.send(null); 
	}
	
	//
	//
	//
	CloneObject = function(what) {
		for (i in what) {
			this[i] = what[i];
		}
	}

	
	//
	//	Design to Support new way and old way
	//	-- For the New Way Pass Just An Object :: The Old Way Will Pass All Parameters	
	//
	GetHTTPAJAX = function(Parameters, HTTP, OnSuccess, Message, PostText) {
		
		
		if (Parameters==undefined) {
			alert('Developer: Your WindowName ID Object (' + String(Parameters)+ ') has not been Defined :: ' + 
				  window.location.hostname + window.location.pathname + window.location.search + ' :: Trying to call ' + HTTP);
			return false;
		}
		
		
		
		if (HTTP == undefined) { 

			Parameters.Fetch  = false;
			Parameters.URL	  = Parameters.HTTP;
			HG_AJAX(Parameters);
		} else {
		
			var	Parameter 				= {}
				Parameter.Container		= Parameters;
				Parameter.URL			= HTTP;
				Parameter.OnSuccess		= OnSuccess;
				Parameter.Message		= Message;
				Parameter.PostText		= PostText;
				Parameter.Fetch			= false;
			HG_AJAX(Parameter);
		}
		
		
		return;
		
		
		//	Create Object if Parameters Used
		if (HTTP != undefined) { 
			var WindowName 			= Parameters;
			Parameters 				= new Object();
			Parameters.Container	= WindowName;
			Parameters.HTTP			= HTTP;
			Parameters.OnSuccess	= OnSuccess;
			Parameters.Message		= Message;
			Parameters.PostText		= PostText;
			Parameters.Left			= 0;
			Parameters.Top			= 0;
		}
		
	
		if (Parameters.Message=='') {
			var myElement = '';
		} else {
			if (typeof(Parameters.Message) != 'string' && eval(Parameters.Message) == undefined) {
				Parameters.Message = 'Loading...';
			}
			var myElement = document.createElement('div');
			
			if (Parameters.Container == '') {
				Parameters.Container = myElement;
				var a = myElement;
				document.body.appendChild(myElement);
			} else {
				Parameters.Container = GetID(Parameters.Container);
				var a = Parameters.Container.insertBefore(myElement, Parameters.Container.firstChild); 
			}

 			
			a.innerHTML = '<div style="position:absolute; z-index:1000;">' + Parameters.Message + '</div>' +
						  '<div class="AJAXPleaseWait" style="position:absolute; background-color:FFFFFF; z-index:999; width:' + Parameters.Container.offsetWidth + 
						  'px; height:' + Parameters.Container.offsetHeight + 'px;" '+
						  'onclick="return false";>&nbsp;</div>';
		}
		
		
		Parameters.OnFailure = function (request) {
			try {
				document.body.removeChild(myElement);
			} catch(e){};
			alert('Background Load Error: ID > ' + Parameters.Container.id + '\n' + HTTP + ' \n[ ' + request.status +' ]');
		}

		
		Parameters.DoOnSuccess = function() {
			try {
				document.body.removeChild(myElement);
			} catch(e){};
			if (Parameters.OnSuccess != undefined) {
				Parameters.OnSuccess();
			}
		}
		
		
		var me = 'get';
		var ct = undefined;
		
		if (Parameters.PostText != undefined) {
			me = 'post';
			ct = 'application/x-www-form-urlencoded';
		}
		
		//
		//  Forces NO Caching
		//
		if (Parameters.HTTP.indexOf('?') > -1) {
			Parameters.HTTP += '&' + String(new Date());
		 } else {
			Parameters.HTTP += '?' + String(new Date());
		 }
		 
		 
		if (Parameters.OnSuccess != undefined) {
			new Ajax.Updater(Parameters.Container, 
							 Parameters.HTTP, 
							 {asynchronous	: true, 
							  evalScripts	: true, 
						   	  method		: me, 
							  onFailure		: Parameters.OnFailure, 
							  onComplete	: Parameters.DoOnSuccess, 
							  parameters	: Parameters.PostText, 
							  contentType	: ct
							 });
		} else {
			new Ajax.Updater(Parameters.Container, 
							 Parameters.HTTP, 
							 {asynchronous	: true, 
							  evalScripts	: true, 
						   	  method		: me, 
							  onFailure		: Parameters.OnFailure, 
							  parameters	: Parameters.PostText, 
							  contentType	: ct
							 });
		}
		
	}
	
	//
	//
	//
	function GetHTTPAJAXNewWindow(Owner, ElementID, ElementType, Style, HTTP, onAJaxSuccess, LoadingMSG) {
		
		GetHTTPAJAX(CreateElement(Owner, ElementID, ElementType, Style), HTTP, onAJaxSuccess, LoadingMSG);
		
	}

	
	
	//
	//
	//
	function ToggleDisplay(ObjID, Set) {
			
		if (typeof(ObjID) == 'string') {
			ObjID = GetID(ObjID);	
		}
		
		if (ObjID.style.display.toUpperCase() == 'NONE') {
			var NSet = '';
		} else {
			var NSet = 'none';
		}
		
		if (Set == undefined) {
			Set = NSet;	
		}
											
		ObjID.style.display = Set;
	}

	
	//
	//
	//
	function GetObject(Name) {
		return document.all? document.all[Name] : document.getElementById(Name);
	}

	//
	//	New Window
	//
	function NewWindow(Url, WindowName, w, h, WindowParams) {
		
		if (WindowParams==undefined) {
			WindowParams = 'resizable=1,menubar=0,scrollbars=1,toolbar=0';
		}
		
		cal = window.open(Url, WindowName, WindowParams);
		
		//cal.window.resizeTo(parent.document.body.clientWidth - 10, parent.document.body.clientHeight - 10);
		if (w!=undefined && h!= undefined) {
			cal.window.resizeTo(w, h);
		}
		
		cal.window.focus();
		
		if (cal != null) {
			if (cal.opener == null) {
				cal.opener = self;
			}
		}
		
		//cal.window.moveTo((cal.window.screen.availWidth / 2) - (cal.document.body.clientWidth / 2), (cal.window.screen.availHeight / 2) - (cal.document.body.clientHeight / 2));
	}
	
	//
	//	Resize Window - SELF
	//
	function ResizeThisWindow(w, h) {
		
		if (w.indexOf('%') > 0) {
			w = GetToken(w, 1, '%') * 0.01;
			w = self.window.screen.availWidth * w;
		}
		
		if (h.indexOf('%') > 0) {
			h = GetToken(h, 1, '%') * 0.01;
			h = self.window.screen.availHeight * h;
		}
		
		
		
		self.window.resizeTo(w, h);
		self.window.moveTo((self.window.screen.availWidth / 2) - (w / 2), (self.window.screen.availHeight / 2) - (h / 2));
		 
	}

	
	
	//
	// Retrive a specific URL parameter
	// else return all URL parameters
	//
	function GetURLParameterVal(param) {
		
		var val 	= "";
		var qs 		= window.location.search;
		var start 	= qs.indexOf(param);
		
		if (start != -1) {
			
			start += param.length + 1;
			var end = qs.indexOf("&", start);
			
			if (end == -1) {
				end = qs.length
			}
			val = qs.substring(start,end);
			
		}
		
		//alert(val);
		return val;
	}
	
	
	//
	// Retrive a specific COOKIE parameter
	// else return all COOKIE parameters
	//
	function GetCookieParameterVal(param) {
	
		var val = "";
		var qs = document.cookie;
		var start = qs.indexOf(param);
		
		if (start != -1) {
			
			start += param.length + 1;
			var end = qs.indexOf(";", start);
			if (end == -1) {
				end = qs.length
			}
			
			val = qs.substring(start,end);
		}
		
		//alert(val);
		return unescape(val);
	}
	

	
	//
	// This will check the size of the window and return
	// the width and height in a comma delimited value
	// which can then either be used with an Array or
	// GetToken(Str, POS, FindStr) which in this case is
	// GetToken(val, 1, ",") for width or
	// GetToken(val, 2, ",") for height
	//
	function GetWindowSize() {

		var myWidth = 0, myHeight = 0, val = '';
		if ( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		} else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		} else if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
		
		val = myWidth + "," + myHeight;
		return unescape(val);
	}
	


	function GetWindowHeight() {

		var myWidth = 0, myHeight = 0, val = '';
		if ( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		} else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		} else if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
		
		return unescape(myHeight);
	}

	function GetWindowWidth() {
		var myWidth = 0, myHeight = 0, val = '';
		if ( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		} else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		} else if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
		
		return unescape(myWidth);
	}
	
	
	function GetObjectHeight(Obj, OrHeight) {

	if (Obj.style.height!=undefined) {
			
			return Obj.style.height
			
		} else {
		
			return OrHeight;
			
		}
	}

	function GetObjectWidth(Obj, OrWidth) {
		
		if (Obj.style.width!=undefined) {
			
			return Obj.style.width
			
		} else {
		
			return OrWidth;
			
		}


	}
	

	

	
	//=====================================
	// REPLACE STR: Replace Str function
	//=====================================
	function ReplaceStr(Str, FindStr, ReStr) {

		if (Str == undefined) {
			return '';	
		}
		
		Str = String(Str);
		var UStr = String(Str).toUpperCase();
		var u = 0;
		
		FindStr = String(FindStr).toUpperCase();
		ReStr	= String(ReStr);
	
		u = 0;
		for (var t=0;t<Str.length;t++) {
			
			if (u==0) {
				u = UStr.indexOf(FindStr);
			} else {
				u = UStr.indexOf(FindStr, u - FindStr.length);
			}
			if (u == -1) {
				break;
			}
			UStr = UStr.substr(0, u) + ReStr + UStr.substr(u + FindStr.length, UStr.length);
			Str = Str.substr(0, u) + ReStr + Str.substr(u + FindStr.length, Str.length);
			t += ReStr.length;
		}
		return String(Str);
	}
	
	//===================================
	// This will encode or unencode HTML
	//===================================
	function EUhtml(type, str) {
		if (type == 'E') {
			return escape(str);
		}
		if (type == 'U') {
			return unescape(str);
		}
	}
	
	
	
	//
	//	Target Content
	//	Takes innerHTML Content from one ID to Another ID Tag
	//
	function TargetContent(FromID, ToID, Method) {
		var Str;

		Str = FromID.innerHTML;
		
		if (Method.toUpperCase()==undefined) {
			Method = "APPEND";
		}
		
		if (Method.toUpperCase()=="OVERWRITE") {
			FromID.innerHTML = '';
			try {
				FromID.style.display = 'none';
			} catch(e) {}
			ToID.innerHTML 	 = Str;
		}
		
		if (Method.toUpperCase()=="MOVE") {
			FromID.innerHTML = '';
			ToID.innerHTML 	 = Str;
		}
		
		if (Method.toUpperCase()=="OVERWRITEONLY") {
			ToID.innerHTML 	 = Str;
		}
		
		if (Method.toUpperCase()=="APPEND") {
			FromID.outerHTML = '';
			try {
				FromID.style.display = 'none';
			} catch(e) {}
			ToID.innerHTML 	 = ToID.innerHTML + Str;
		}
		
		if (Method.toUpperCase()=="APPENDOUT") {
			Str = FromID.outerHTML;
			FromID.outerHTML = '';
			try {
				FromID.style.display = 'none';
			} catch(e) {}
			ToID.innerHTML 	 = ToID.innerHTML + Str;
		}
		if (Method.toUpperCase()=="APPENDONLY") {
			ToID.innerHTML 	 = ToID.innerHTML + Str;
		}
		

	}
	
	
	

	function StripCharacter(words,character) {
		//documentation for this script at http://www.shawnolson.net/a/499/
		var spaces = words.length;
		for(var x = 1; x<spaces; ++x){
			words = words.replace(character, "");   
		}
		return words;
	}
	
	

	function ChangeClassValue(theClass,element,value) {
		var cssRules;
		
		if (document.all) {
			cssRules = 'rules';
		} else if (document.getElementById) {
			cssRules = 'cssRules';
		}
		for (var S = 0; S < document.styleSheets.length; S++){
			for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
				if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
					document.styleSheets[S][cssRules][R].style[element] = value;
				}
			}
		}	
	}



	function CheckUncheckAll(theElement) {
		var theForm = theElement.form, z = 0;
			for(z=0; z<the.length;z++){
				if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall') {
					theForm[z].checked = theElement.checked;
				}
			}
	}
	
	
	
	function checkUncheckSome(controller,theElements) {
	
		// theElements is an array of objects designated as a comma separated list of their IDs
		// If an element in theElements is not a checkbox, then it is assumed
		// that the function is recursive for that object and will check/uncheck
		// all checkboxes contained in that element
		
		
		var formElements = theElements.split(',');
		var theController = document.getElementById(controller);
		
		for(var z=0; z<formElements.length;z++){
			theItem = document.getElementById(formElements[z]);
			if(theItem){
				
				if(theItem.type){
					if(theItem.type == 'checkbox' && theItem.id != theController.id){
						theItem.checked = theController.checked;
					}
				} else {
					
					var nextArray = '';
					
					for(var x=0;x <theItem.childNodes.length;x++){
						if(theItem.childNodes[x]){
							if (theItem.childNodes[x].id){
						  		nextArray += theItem.childNodes[x].id+',';
							}
					  	}
					 }
					 
					 checkUncheckSome(controller,nextArray);
				}
			}
		}
	}

	
	
			
	//
	//
	//	
	function GetMouseCoords(e)	{
		
		 if (!e) e = window.event; // works on IE, but not NS (we rely on NS passing us the event)

		  if (e)
		  { 
			if (e.pageX || e.pageY)
			{ // this doesn't work on IE6!! (works on FF,Moz,Opera7)
			  GetMouseX = e.pageX;
			  GetMouseY = e.pageY;
			  algor = '[e.pageX]';
			
			  if (e.clientX || e.clientY) algor += ' [e.clientX] '
			}
			else if (e.clientX || e.clientY)
			{ // works on IE6,FF,Moz,Opera7
			  GetMouseX = e.clientX + document.body.scrollLeft;
			  GetMouseY = e.clientY + document.body.scrollTop;
			  algor = '[e.clientX]';
			  if (e.pageX || e.pageY) algor += ' [e.pageX] '
			}  
		  }

	}
	
	
	//
	//
	//
	MoveObjectToMouse = function(DivObj, BottomOffSet) {
			
		xHeightVal 			= GetWindowHeight();
		xDiffVal   			= xHeightVal - GetMouseY;
		DivObj.style.left	= GetMouseX;
		
		if (BottomOffSet==undefined) {
			BottomOffSet = 100;
		}
		
		if (xDiffVal <= BottomOffSet) {
			// This will move the popup div from disappearing off the page
			// The popup will appear above the mouse
			DivObj.style.top				= GetMouseY - BottomOffSet;
			
		} else {
			// The popup will appear below the mouse
			DivObj.style.top				= GetMouseY;
			
		}
		
	
	}
	
	
	
	
	
	
	
	DumpObject = function(Obj) {
		
		if (typeof(Obj) == 'string') {
			alert(Obj);
			return;
		}
		
		var gg = '';
		for (var i in Obj) {
			gg = gg + String(i) + ' | ';
		}
		alert(gg);
		
		return gg;
	}
	
	
	DumpObjectValue = function(Obj, HTML, ExcludeNull, ExcludeObject, ObjectsOnly, IncludeFunction) {
		var gg = '';

		for (var i in Obj) {
			var Show = true;
			try {
				if (eval('Obj.' + i)!='') {
				
					if (ExcludeNull!=undefined &&  eval('Obj.' + i) == null) {
						Show = false;
					}
					if (ExcludeObject!=undefined && typeof(eval('Obj.' + i)) == 'object') {
						Show = false;
					}
					if (HTML!=undefined && String(i) == 'innerHTML') {
						Show = false;
					}
					if (HTML!=undefined && String(i) == 'outerHTML') {
						Show = false;
					}
				
					if (ObjectsOnly==true && typeof(eval('Obj.' + i)) != 'object') {
						Show = false;
					}
					if (typeof(eval('Obj.' + i)) == 'function') {
						Show = IncludeFunction;
					}
					
					if (Show==true) {
						gg = gg + String(i) + '=' + eval('Obj.' + i) + ' | ';
					}
				} 
			} catch(e) {}
		}
		alert(gg);
		
		return gg;
	}
	
	
	_DumpCount     = 0;
	_DumpSameCount = 0;
	_MaxDump	   = 1000;
	_DumpLevel	   = 0;
	_DumpLevelMax  = 0;
	_LastDumpObj   = null;
	Dump = function(Obj, Alert, Target, cr, level, Sub, LastName) {

		if (Obj == _LastDumpObj) return '';

		_LastDumpObj = Obj;
		
		var gg = '\n';

		if (cr == undefined) {
			cr = '\n'; 
		}

		if (level == undefined) {
			level = ''; 
		} else {
			level += _DumpLevel + ' ';
		}
		
		_DumpLevel++;
			
		if (_DumpLevel > _DumpLevelMax) {
			_DumpLevelMax = _DumpLevel;
		}
		
		
		if (typeof(Obj) == 'string') {
			alert(Obj);
			return;
		} else {
		
			if (_DumpCount > _MaxDump) {
				_DumpLevel--;
				return '';
			}
			
			var count   = 0;
			var brCount = 0;
			var FirstValue = false;
			var Funcs = '';
			for (var i in Obj) {
				count ++;
				if (count>50) break;
				_DumpCount++;
				if (typeof(Obj[i]) != 'function') {
					if ((typeof(Obj[i]) == 'object' || typeof(Obj[i]) == 'array')
						&& i != 'parentNode' 
						&& i.indexOf('Sibling') == -1 
						&& i.indexOf('Child') == -1 
						&& i.indexOf('Nodes') == -1
						&& i.indexOf('owner') == -1
						) {
						
							if (gg.substring(gg.length-2, 2) != '\n') {
								gg = gg +  '\n';
							}
							gg = gg +  '[' + Trim(level) + ']   ' + String(i) + ': ' + typeof(Obj[i]);
												
							var NextLevel = Dump(Obj[i], undefined, Target, cr, level, 1, i);
							
							gg = gg + NextLevel;
							FirstValue = false;
							
						} else {
							
							if (!FirstValue || Target != undefined) {
								if (Target != undefined) {
									gg += '\n';
								} 
								gg = gg + '[' + Trim(level) + ']   ';

								FirstValue = true;
							}
								
							if (Obj[i] != '' || Number(Obj[i]) == 0) {
								gg = gg + String(i) + '=' + Obj[i] + ' | ';
							} else {
								gg = gg + String(i) + '= (blank)' + Obj[i] + ' | ';
							}
							
							
							
							if (brCount == 4) {
								brCount  = 0;
								gg = gg + cr + '[' + Trim(level) + ']   ';
							}
						}
		
					
			   } else {
				   //	Function
				  if (Target != undefined) {
					 Funcs += '\n[' + Trim(level) + ']  ';
				  }
				  Funcs = Funcs +  ' ' + String(i) + '() ';   
			   }
			}
			
			if (Funcs != '') {
				gg = gg + Funcs;
			}

			
			
			if (brCount > 0) {
				gg = gg + cr;
			}
	
	
			if (Alert != undefined) {
				gg = Alert + '\n' + gg;
			}
	
			/*
			if (Sub==undefined) {
				
				if (Target == undefined) {
					alert(gg);
				} else {
					gg = ReplaceStr(gg, '\n', '<br>');
					if (GetID(Target)) {
						GetID(Target).innerHTML = ReplaceStr(gg, ' ', '&nbsp;');
					}
				}
			}*/
		
		}
		
		_DumpLevel--;
			
		if (_DumpCount>1) {
			level = level.substring(0, (level.length-3));
		}
		
		if (_DumpLevel == 0) {
			if (Target == undefined) {
				alert(gg);
			} else {
				
				gg = ReplaceStr(gg, '[]', 				'   <hr size=\"1\">');
				gg = ReplaceStr(gg, '[1]', 				'\t');
				gg = ReplaceStr(gg, '[1 2]', 			'\t\t');
				gg = ReplaceStr(gg, '[1 2 3]', 			'\t\t\t');
				gg = ReplaceStr(gg, '[1 2 3 4]', 		'\t\t\t\t');
				gg = ReplaceStr(gg, '[1 2 3 4 5]', 		'\t\t\t\t\t');
				gg = ReplaceStr(gg, '[1 2 3 4 5 6]', 	'\t\t\t\t\t\t');
				
				GetID(Target).innerHTML = '<pre>' + gg;	
			}
			
			_DumpCount     = 0;
			_DumpSameCount = 0;
			_MaxDump	   = 1000;
			_DumpLevel	   = 0;
			_DumpLevelMax  = 0;
			_LastDumpObj   = null;
		}

		
		return gg;
	}
	
	Dump1 = function(Obj, Alert, Target, cr, level, Sub, LastName) {


		var gg = level==undefined ? '' : level;

		if (cr == undefined) {
			cr = '\n'; 
		}

		if (level == undefined) {
			level = ''; 
		} else {
			level += '   ';
		}
		
		if (typeof(Obj) == 'string') {
			alert(Obj);
			return;
		}
		
		if (_DumpCount > _MaxDump) {
			return '';
		}
		
		var count = 0;
		var brCount = 0;
		for (var i in Obj) {
			count ++;
			_DumpCount++;
			if (typeof(Obj[i]) != 'function') {
				try {
					if ((typeof(Obj[i]) == 'object' || typeof(Obj[i]) == 'array')
					    && i != 'parentNode' 
						&& i.indexOf('Sibling') == -1 
						&& i.indexOf('Child') == -1 
						&& i.indexOf('Nodes') == -1
						&& i.indexOf('owner') == -1
						) {
						
						
						if (count> 1) {
							//gg = gg + '\n';
						}
						gg = gg + level + String(i) + ': ' + typeof(Obj[i]) + '\n';

						
						
											
						var NextLevel = Dump(Obj[i], undefined, undefined, cr, level, 1, i);
						
						gg = gg + NextLevel;
						
						if (_DumpCount>1) {
							level = level.substring(0, (level.length-3));
						}
						
						if (_DumpCount > _MaxDump) {
							_DumpCount--;
							break;
						}
						
												
					} else {
						if (Obj[i] != '' || Number(Obj[i]) == 0) {
							gg = gg + String(i) + '=' + Obj[i] + ' | ';
						} else {
							gg = gg + String(i) + '= (blank)' + Obj[i] + ' | ';
						}
						if (brCount == 4) {
							brCount  = 0;
							gg = gg + cr + level;
						}
					}
	
				} catch(e) {
					gg = gg + String(i) + ' ! Error ' + e.message + ' | ';
				}
		   } else {
				gg = gg + '(' + String(i) + ') ';   
		   }
		}
		
		if (brCount > 0) {
			gg = gg + cr;
		}


		if (Alert != undefined) {
			gg = Alert + '\n' + gg;
		}

		
		if (Sub==undefined) {
			
			if (Target == undefined) {
				alert(gg);
			} else {
				gg = ReplaceStr(gg, '\n', '<br>');
				if (GetID(Target)) {
					GetID(Target).innerHTML = ReplaceStr(gg, ' ', '&nbsp;');
				}
			}
		}

		return gg;
	}
	
	
	MultiSelectToStringList = function(Obj, Field, Delimiter) {

		var gg = '';
		for (var i=0; i< Obj.options.length; i++) {
			gg = gg + Obj.options(i)[Field] + Delimiter;
		}
		
		gg = gg.substring(0, gg.length-1);
		
		return gg;
	}
	
	
	
		
	
	PrintHTML = function(DivObj, HTML) {

		DivObj.innerHTML = DivObj.innerHTML + '<iframe id="PRINTframe" style="position:absolute; left:-5000"></iframe>';
		PRINTframe.onload = function () {
											PRINTframe.document.body.innerHTML = HTML;
											PRINTframe.focus();
											PRINTframe.print();
										};
					
	}
	
	
	var vClockDiv;
	var vClockStyle;
	
	function StartClock(DivObj)	{
		
		if (DivObj != undefined) {
			vClockDiv = DivObj;
		}
		
		var today=new Date()
		var h=today.getHours()
		var m=today.getMinutes()
		var s=today.getSeconds()
		// add a zero in front of numbers<10
		//m=checkTime(m)
		//s=checkTime(s)
		//DivObj.innerHTML=h+":"+m+":"+s;
		vClockDiv.innerHTML=new Date();
		t=setTimeout('StartClock()',500)
	}
	
	//
	// Prefix 1-9 with a 0
	//
	function checkTime(i) {
		if (i < 10) { i = "0" + i }
		return i
	}
	
	// ************************************
	// This is similar ot he StartClock, only formatted
	// ds = Date Style, options are dfull, dshort, dshorter
	// ts = Time Style, options are t24 or t12
	// by: Jennifer Stephens, 1/31/2008
	// ************************************
	function StartClock2(DivObj, ds, ts)	{
		
		if (DivObj != undefined) {
			vClockDiv = DivObj;
		};
		
		
		if (ds == undefined) {
			vDateStyle = 'dfull';
		} else {
			vDateStyle = ds;
		};
		
		if (ts == undefined) {
			vTimeStyle = 't24';
		} else {
			vTimeStyle = ts;
		};
		
		var vClock = new Date();
		var s=vClock.getSeconds()
		
		vClockDiv.innerHTML = FormatDate(vClock, vDateStyle) + " " + FormatTime(vClock, vTimeStyle);
		t=setTimeout(
					 	function() {
								  		StartClock2(GetID(DivObj), ds, ts, 500);
								   }
					);
	}

	// ************************************
	// Date Properties
	// by: Jennifer Stephens, 1/31/2008
	// ************************************
	function FormatDate(ThisDate, DateStyle) {

		if (DateStyle == undefined) {
			DateStyle = 'dshorter';
		}
		
		wd = ShowDayOfWeekString(ThisDate.getDay());
		mv = ShowMonthAsString(ThisDate.getMonth());
		mn = ThisDate.getMonth() + 1
		mn = checkTime(mn);
		dv = ThisDate.getDate();
		dn = checkTime(dv);
		yv = ThisDate.getFullYear();
		
		if (DateStyle == 'dfull') {
			OutputVal = wd + ", " + mv + " " + ThisDate.getDate() + ", " + ThisDate.getFullYear();
		} else if (DateStyle == 'dshort') {
			OutputVal = wd.substring(0, 3) + ", " + mv.substring(0, 3) + " " + dv + ", " + yv;
		} else if (DateStyle == 'dshorter') {
			wd = ShowDayOfWeekString(ThisDate.getDay());
			OutputVal = mn + "/" + dn + "/" + yv;
		}
			
		
		return OutputVal;
	}
	
	// ************************************
	// Time Properties
	// by: Jennifer Stephens, 1/31/2008
	// ************************************
	function FormatTime(ThisDate, TimeStyle) {

		if (TimeStyle == undefined) {
			TimeStyle = 't24';
		}
		
		hv = checkTime(ThisDate.getHours());
		mv = checkTime(ThisDate.getMinutes());
		sv = checkTime(ThisDate.getSeconds());
		
		if (TimeStyle == 't24') {
			OutputVal = hv + ":" + mv + ":" + sv;
		} else {
			OutputVal = ShowTimeAs12(hv, mv, sv);
		}
		
		return OutputVal;
	}
	
	// ************************************
	// Convert the numeric value of the 
	// weekday to its string representation
	// by: Jennifer Stephens, 1/31/2008
	// ************************************
	function ShowDayOfWeekString(w) {
		if (w == 0) { w = 'Sunday'; } 
		else if (w == 1) { w = 'Monday'; } 
		else if (w == 2) { w = 'Tuesday'; } 
		else if (w == 3) { w = 'Wednesday'; } 
		else if (w == 4) { w = 'Thursday'; } 
		else if (w == 5) { w = 'Friday'; } 
		else if (w == 6) { w = 'Saturday'; }
		
		return w;
	}
	
	// ************************************
	// Convert the numeric value of the
	// month to its string representation
	// by: Jennifer Stephens, 1/31/2008
	// ************************************
	function ShowMonthAsString(m) {
		if (m == 0) { m = 'January'; }
		else if (m == 1) { m = 'February'; }
		else if (m == 2) { m = 'March'; }
		else if (m == 3) { m = 'April'; }
		else if (m == 4) { m = 'May'; }
		else if (m == 5) { m = 'June'; }
		else if (m == 6) { m = 'July'; }
		else if (m == 7) { m = 'August'; }
		else if (m == 8) { m = 'September'; }
		else if (m == 9) { m = 'October'; }
		else if (m == 10) { m = 'November'; }
		else if (m == 11) { m = 'December'; }
		
		return m;
	}
	
	// ************************************
	// This will take the 24 hour and make it 12
	// by: Jennifer Stephens, 1/31/2008
	// ************************************
	function ShowTimeAs12(h, m, s) {
		if (h <= 12) {
			t = 'AM';
		} else {
			t = 'PM';
			h = checkTime(h - 12);
		}
		
		return h + ":" + m + ":" + s + " " + t;
	}
	
	//
	//	Show / Hide Table Column
	//
	function ShowTableColumn(tableid, colno, show) {

		var stl;
		
		if (show) 
				stl = ''
		else    stl = 'none';
	
		var tbl  = document.getElementById(tableid);
		var rows = tbl.getElementsByTagName('tr');
	
		for (var row=0; row<rows.length;row++) {
		  var cels = rows[row].getElementsByTagName('td')
		  cels[colno].style.display=stl;
		}
		
	  }
	  
	 

	
	//________________________________________________________________________________
	//
	//	EXECUTE A FUNCTION AFTER MILISECS
	//
	function ExecuteFunctionAfter(func, timing, Param1, Param2, Param3, Param4) {
		Obj = new Object();
		Obj.Interval= setInterval(func, timing, Obj, Param1, Param2, Param3, Param4);
		return Obj;
	}
	
	
	
	//________________________________________________________________________________
	//
	//	EXECUTE A FUNCTION AFTER MILISECS
	//
	function ExecuteFunctionOnceAfterCall(func, Obj, Param1, Param2, Param3, Param4) {

		clearInterval(Obj.Interval);
		func(Param1, Param2, Param3, Param4);
		Obj = undefined;
	}
	
	
	
	//________________________________________________________________________________
	//
	//	EXECUTE A FUNCTION AFTER MILISECS
	//
	function ExecuteFunctionOnceAfter(func, timing, Param1, Param2, Param3, Param4) {
		var Obj = new Object();
		Obj.func   = func;
		Obj.Param1 = Param1;
		Obj.Param2 = Param2;
		Obj.Param3 = Param3;
		Obj.Param4 = Param4;
		

		var TempFunc = function() {
			ExecuteFunctionOnceAfterCall(Obj.func, Obj, Obj.Param1, Obj.Param2, Obj.Param3, Obj.Param4);
		}
		
		Obj.Interval = setInterval(TempFunc, timing);
		return Obj;
	}
	
	
	//________________________________________________________________________________
	//
	//	EXECUTE A FUNCTION AFTER MILISECS USING THE PASSED IN OBJ
	//
	function ExecuteFunctionOnceAfterUsing(Obj, func, timing, Param1, Param2, Param3, Param4) {
	
		if (Obj != undefined) {
			clearInterval(Obj.Interval);
		} else {
			Obj = new Object();
		}
		

		Obj.func   = func;
		Obj.Param1 = Param1;
		Obj.Param2 = Param2;
		Obj.Param3 = Param3;
		Obj.Param4 = Param4;
		

		var TempFunc = function() {
			ExecuteFunctionOnceAfterCall(Obj.func, Obj, Obj.Param1, Obj.Param2, Obj.Param3, Obj.Param4);
		}

		Obj.Interval = setInterval(TempFunc, timing);
		return Obj;
	}
	
	
	
	
	function DragDropCoordinates() {
		
		if (!DragDropObject) {
			return
		}

		
		if (event.srcElement==DragDropSelect)	{
			mouseover	 =true;
			DragDropLeft =DragDropObject.style.pixelLeft;
			DragDropTop	 =DragDropObject.style.pixelTop;
			DragDropX	 =event.clientX;
			DragDropY	 =event.clientY;
			//DragDropObject.style.filter = "alpha(opacity=20)";
			document.onmousemove=DragObject;
		}
	}
	
	function DragObject() {
		
		if (mouseover&&event.button==1)	{

			DragDropObject.style.pixelLeft	=DragDropLeft+event.clientX-DragDropX
			DragDropObject.style.pixelTop	=DragDropTop+event.clientY-DragDropY
			return false
		}
	}
	
	function StopDragDrop() {
	
		mouseover=false;
		document.onmousedown=function() {};
		//DragDropObject.style.filter = "";
	}

	function StartDragDrop(SelectObject, DragObject) {

		DragDropObject = DragObject;
		DragDropSelect = SelectObject;
		document.onmousedown=DragDropCoordinates;
		document.onmouseup=StopDragDrop;

	}

	
	
	function NumbersOnly(e)	{
		var keynum
		var keychar
		var numcheck
		if(window.event) { // IE	
			keynum = e.keyCode
		} else if(e.which) { // Netscape/Firefox/Opera
			keynum = e.which
		}
		keychar = String.fromCharCode(keynum)
		numcheck = /\d/;
		
		return numcheck.test(keychar)
	}
	
	
	
	function NumberTypes(e)	{
		var keynum
		var keychar
		var numcheck
		if(window.event) { // IE	
			keynum = e.keyCode
		} else if(e.which) { // Netscape/Firefox/Opera
			keynum = e.which
		}
		keychar = String.fromCharCode(keynum);
		
		var validletters = '0123456789%.$\/\\';
		//alert(validletters.indexOf(keychar) + " : " + keychar + " : " + keynum + " : " + e.type);
		return (validletters.indexOf(keychar) > -1)
	}
	
	//
	// This is different from above because this
	// allows for the num key pad to be used
	// where the above thinks the num key pad
	// is a lower case letter.
	// PrevNum is used to determine if someone has pressed the shift key
	//
	
	
	function AlwaysAllowed(e) {
		var keynum
		var RetVal = false;
		
		//which :: Netscape/Firefox/Opera
		//keyCode :: IE
		var keynum = (e.which) ? e.which : e.keyCode
		
		IsAllowed = IsAllowedWith(e);
		
		if (
			keynum == 13 ||		// enter
			keynum == 9 ||		// tab
			keynum == 8 ||		// backspace
			keynum == 46 || 	// delete
			keynum == 16 || 	// shift
			keynum == 17 || 	// ctrl
			keynum == 18 || 	// alt
			keynum == 45 || 	// insert
			keynum == 36 || 	// home
			keynum == 35 || 	// end
			keynum == 33 || 	// page up
			keynum == 34 || 	// page down
			keynum == 27 || 	// esc
			keynum == 20 || 	// caps lock
			keynum == 144 ||	// num lock
			(keynum >= 112 && keynum <= 123) ||	// F1-F12
			(keynum >= 37 && keynum <= 40) ||	// arrow keys
			(keynum == 65 && IsAllowed) ||	// select all CTRL A
			(keynum == 90 && IsAllowed) ||	// undo CTRL Z
			(keynum == 67 && IsAllowed) ||	// copy CTRL C
			(keynum == 86 && IsAllowed) ||	// paste CTRL V
			(keynum == 88 && IsAllowed) 	// cut CTRL X
		) {
			RetVal = true; 
		} else {
			RetVal = false; 
		}

		return RetVal;
		
	}
	
	//
	// These keys return false because they are not allowed to be true
	// when another key is pressed
	//
	function NotAllowedWith(e) {
		
		if (e.shiftKey || e.ctrlKey || e.altKey) {
			return false;
		} else {
			return true;
		}
	}
	
	//
	// These keys return true because they are allowed to be true
	// when another key is pressed
	//
	function IsAllowedWith(e) {
		
		if (e.shiftKey || e.ctrlKey || e.altKey) {
			return true;
		} else {
			return false;
		}
	}
	
	
	function CheckNumericOnly(e) { 
		var keynum
		var RetVal = false;
		
		
		//which :: Netscape/Firefox/Opera
		//keyCode :: IE
		var keynum = (e.which) ? e.which : e.keyCode
		
		IsNotAllowed = NotAllowedWith(e);
			
		// 48 - 57 are the number keys at the top of a keyboard
		// 96 - 105 are the numbers on the numpad
		if (
			((keynum >= 48 && keynum <= 57) && IsNotAllowed) || 
			(keynum >= 96 && keynum <= 105)
		) {
			RetVal = true; 
		} else { 
			RetVal = false; 
		}
		
		if (RetVal == false) {
			RetVal = AlwaysAllowed(e);
		}
		
		return RetVal; 
	}
	
//
	//	Letter, Numbers and Some Punctuation
	//
	function CheckAllowedPunctuation(e) { 
		var keynum
		var RetVal = false;
		
		
		//which :: Netscape/Firefox/Opera
		//keyCode :: IE
		var keynum = (e.which) ? e.which : e.keyCode
		
		var IsAllowed = IsAllowedWith(e);
			
		// 48 - 57 are the number keys at the top of a keyboard
		// 96 - 105 are the numbers on the numpad
		if (
			keynum == 190 || 	// .
			keynum == 188 ||	// , 
			keynum == 189 || 	//	- _	
			//keynum == 222 || 	// '
			(keynum == 57 && IsAllowed) || // (
			(keynum == 48 && IsAllowed)   // )

		) {
			RetVal = true; 
		} else { 
			RetVal = false; 
		}
		
		if (RetVal == false) {
			RetVal =  LettersAndNumberOnly(e);
		}
		
		if (RetVal == false) {
			RetVal = AlwaysAllowed(e);
		}
		
		return RetVal; 
	}
	
	function CheckLettersOnly(e) { 
		var keynum
		var RetVal = false;
		
		
		//which :: Netscape/Firefox/Opera
		//keyCode :: IE
		var keynum = (e.which) ? e.which : e.keyCode
		
			
		// 48 - 57 are the number keys at the top of a keyboard
		// 96 - 105 are the numbers on the numpad
		if (
			keynum >= 65 && keynum <= 90
		) {
			RetVal = true; 
		} else { 
			RetVal = false; 
		} 
		
		if (RetVal == false) {
			RetVal = AlwaysAllowed(e);
		}
		
		return RetVal; 
	}
	
	
	//
	//
	//
	function CheckNumericKeyInfo(e) { 
		var keynum
		var RetVal = false;
		
		
		//which :: Netscape/Firefox/Opera
		//keyCode :: IE
		var keynum = (e.which) ? e.which : e.keyCode
		
		IsNotAllowed = NotAllowedWith(e);
		IsNumericValue = CheckNumericOnly(e);
		
		// 190 is the . on the keyboard
		// 189 is the - on the keyboard
		// 109 is the - on the number pad
		// 110 is the . on the number pad
		
		if (
			IsNumericValue || 
			(keynum == 190 && IsNotAllowed) || 
			(keynum == 189 && IsNotAllowed)  ||
			keynum == 109 || keynum == 110
		) {
			RetVal = true; 
		} else { 
			RetVal = false; 
		} 
		
		if (RetVal == false) {
			RetVal = AlwaysAllowed(e);
		}
		
		return RetVal; 
	}
	
	
	//
	//
	//
	function CheckNumericMinMax(value, minval, maxval, id, allowblank) { 
		var keynum
		var RetVal = false;
		
		//alert(value + ' : ' + minval + ' : ' + maxval);
		
		//
		// Allow blank value
		// 
		if (allowblank && value == '') {
			return true
		}
		
		//
		// Blank value is not allowed
		// Evaluate number provided based on minval and maxval
		//
		if (minval == '' || minval == undefined) {
			RetVal = true;
		} else if (Number(value) < minval) {
			alert('Value provided is less than allowed min of ' + minval);
			if (id != undefined) {
				id.focus();
			}
			return false;
		}
		
		
		if (maxval == '' || maxval == undefined) {
			RetVal = true;
		} else if (Number(value) > maxval) {
			alert('Value provided is greater than allowed max of ' + maxval);
			if (id != undefined) {
				id.focus();
			}
			return false;
		}
		
		return RetVal; 
	}
	
	
	//
	// This allows A-Z, a-z and 0-9 and a space only
	//
	function LettersAndNumberOnly(e) { 
		var keynum
		var RetVal = false;
		
		
		//which :: Netscape/Firefox/Opera
		//keyCode :: IE
		var keynum = (e.which) ? e.which : e.keyCode
		
		IsNotAllowed = NotAllowedWith(e);
		IsNumericValue = CheckNumericOnly(e);
		IsAlphaValue = CheckLettersOnly(e);
		
		// 32 is the space bar on the keyboard

		
		if (
			IsNumericValue ||
			IsAlphaValue ||
			keynum == 32
		) {
			RetVal = true; 
		} else { 
			RetVal = false; 
		} 
		
		if (RetVal == false) {
			RetVal = AlwaysAllowed(e);
		}
		
		return RetVal; 
	} 
	
	
	//
	// This allows A-Z, a-z and 0-9 and a space only and $ and *
	//
	function AllowedClientGroupCode(e) { 
		var keynum
		var RetVal = false;
		
		
		//which :: Netscape/Firefox/Opera
		//keyCode :: IE
		var keynum = (e.which) ? e.which : e.keyCode
		
		IsNotAllowed = NotAllowedWith(e);
		IsNumericValue = CheckNumericOnly(e);
		IsAlphaValue = CheckLettersOnly(e);
		
		// 32 is the space bar on the keyboard

		
		if (
			IsNumericValue ||
			IsAlphaValue ||
			keynum == 32 ||	// space
			keynum == 56 ||	// *
			keynum == 52	// $
		) {
			RetVal = true; 
		} else { 
			RetVal = false; 
		} 
		
		if (RetVal == false) {
			RetVal = AlwaysAllowed(e);
		}
		
		return RetVal; 
	}
	
	//
	// Letters and Numbers only
	//
	function AlphaNumericOnly(e) { 
		var keynum
		var RetVal = false;
		
		
		//which :: Netscape/Firefox/Opera
		//keyCode :: IE
		var keynum = (e.which) ? e.which : e.keyCode
		
		IsNotAllowed = NotAllowedWith(e);
		IsNumericValue = CheckNumericOnly(e);
		IsAlphaValue = CheckLettersOnly(e);
		
		// 190 is the . on the keyboard
		// 189 is the - on the keyboard
		// 109 is the - on the number pad
		// 110 is the . on the number pad
		// 32 is space
		
		//alert(keynum);
		
		if (
			IsNumericValue ||
			IsAlphaValue ||
			(keynum == 190 && IsNotAllowed) || 
			(keynum == 189 && IsNotAllowed) ||
			keynum == 109 || 
			keynum == 110 ||
			keynum == 32
		) {
			RetVal = true; 
		} else { 
			RetVal = false;
		} 
		
		if (RetVal == false) {
			RetVal = AlwaysAllowed(e);
		}
		
		return RetVal; 
	} 

	
	//
	// HTML Color Key codes
	//
	function HexColor(e) {
		var keynum
		var RetVal = false;
		
		
		//which :: Netscape/Firefox/Opera
		//keyCode :: IE
		var keynum = (e.which) ? e.which : e.keyCode
		
		IsNumericValue = CheckNumericOnly(e);
		
		// 65 - 71 are upper case A-F
		
		if(
			IsNumericValue || 
			(keynum >= 65 && keynum <= 70)
		) {
			RetVal = true; 
		} else { 
			RetVal = false;
		} 
		
		if (RetVal == false) {
			RetVal = AlwaysAllowed(e);
		}
		
		
		return RetVal; 
	}

	
	//
	// Old Hex function
	//
	function HexOnly(e)	{
		var keynum
		var keychar
		var numcheck
		
		//which :: Netscape/Firefox/Opera
		//keyCode :: IE
		var keynum = (e.which) ? e.which : e.keyCode
		
		IsNotAllowed = NotAllowedWith(e);
		
		keychar = String.fromCharCode(keynum);
		var validletters = '0123456789ABCDEFabcdef';
		return (validletters.indexOf(keychar) > -1)
	}
	
	//
	//
	//
	function LettersAndNumber(e)	{
		var keynum
		var keychar
		var numcheck
		
		//which :: Netscape/Firefox/Opera
		//keyCode :: IE
		var keynum = (e.which) ? e.which : e.keyCode
		
		IsNotAllowed = NotAllowedWith(e);
		
		keychar = String.fromCharCode(keynum);
		var validletters = '0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ-.*() abcdefghijklmnopqrstuvwxyz';
		return (validletters.indexOf(keychar) > -1)
	}


	function GetPixelPosition(Obj, PosObj) {
		
		if (typeof Obj == 'String') {
			Obj = GetID(Obj);
		}
			
		//
		//	Recursive Function to Determine Left and Top Actual Position
		//
		
		if (PosObj == undefined) {
			PosObj 			= new Object;
			PosObj.Left 	= 0;
			PosObj.Top 		= 0;
			PosObj.Parents 	= 0;
		}
		
		var blw = 0;
		var btw = 0;
		var plw = 0;
		var ptw = 0;
		
		try {
			if (isNaN(parseInt(Obj.currentStyle.borderTopWidth)) == false) {
				btw = parseInt(Obj.currentStyle.borderTopWidth);
			}
		} catch(e) {}

		try {
			if (isNaN(parseInt(Obj.currentStyle.paddingTop)) == false) {
				ptw = parseInt(Obj.currentStyle.paddingTop);
			}
		} catch(e) {}


		try {
			if (isNaN(parseInt(Obj.currentStyle.borderLeftWidth)) == false) {
				blw = parseInt(Obj.currentStyle.borderLeftWidth);
			}
		} catch(e) {}


		try {
			if (isNaN(parseInt(Obj.currentStyle.paddingLeft)) == false) {
				plw = parseInt(Obj.currentStyle.paddingLeft);
			}
		} catch(e) {}

			
		PosObj.Left 	= PosObj.Left + Obj.offsetLeft + blw + plw;
		PosObj.Top 		= PosObj.Top  + Obj.offsetTop + btw + ptw;

		// Test for Parent
		try {
			var test = Obj.offsetParent;
			// If Still here Parent exist
			if (String(Obj.offsetParent) != null ) {
				PosObj.Parents	= PosObj.Parents + 1;
				PosObj = GetPixelPosition(Obj.offsetParent, PosObj);
			}
		} catch(e) {
		}
		
		return PosObj;
		
	}


	//
	//
	//	
	function ArrayAdd(TheArray, Value) {
		
		TheArray[TheArray.length ] = Value;
		
		return TheArray;
		
	}


	//
	//
	//
	function ArrayRemove(TheArray, Value) {
		
		var t;
		var NA = new Array();
		
		for (t=0;t<TheArray.length; t++) {
			if (TheArray[t] != Value) {
				NA[NA.length] = TheArray[t];
			}
		}
		
		return NA;
		
	}


	//
	//
	//
	function ShowPopup(TargetID, PopupDiv, Content, x, y, w, h)	{
		
		
		if (typeof(Content) == 'object') {
			var c = Content.innerHTML;
		} else {
			var c = Content;
		}
		
		var p		= window.createPopup();
		var pbody	= p.document.body;

		if (w==undefined) { w = 0 };
		if (h==undefined) { h = 0 };
		
		
		PopupDiv.innerHTML = c;		
	  	w  				   = PopupDiv.offsetWidth  + w;
		h  				   = PopupDiv.offsetHeight + h;

		
		var t = '<div style="font-family:arial; font-size:12px;padding:10; background-Color:lightyellow; border:solid #999999 1px; ' + 
					'border-Left:solid #CCCCCC 1px; border-Top:solid #CCCCCC 1px; ' +
					'filter:progid:DXImageTransform.Microsoft.Shadow(color=#BBBBBB, Direction=135, Strength=2); ' +
					'width:' + (w-2) +  ';' + 
					'height:' + (h-2) + 
					'">' + c + '</div>';

		pbody.innerHTML = t;

		p.show(x,y,w,h,TargetID);
		
		return pbody;
	}
	
	
	//
	//
	//
	function CreatePopup(x, y, w, h, Content, RelativeID)	{
		
		if (typeof(Content) == 'object') {
			var c = Content.innerHTML;
		} else {
			var c = Content;
		}
		

		var p		= window.createPopup();
		var pbody	= p.document.body;
		
		pbody.innerHTML = c;
		p.show(x,y,w,h, RelativeID);
		
		return pbody;
	}




	var Div_To_Refresh_Obj = new Object();
	
	RefreshDivAfterScroll = function(DivToRefresh) {
		Div_To_Refresh_Obj = ExecuteFunctionOnceAfterUsing(Div_To_Refresh_Obj,  
															function() { 
																DivToRefresh.style.visibility = 'hidden'; 
																ExecuteFunctionOnceAfter( function() { DivToRefresh.style.visibility = 'visible'; }, 100);
															},
															200);
	}
	
	
	
	
	function SelectAll(FieldName) {
		
	
		
		if (typeof(FieldName) == 'object') {
			var tempval = FieldName;	   
		} else {
			var tempval = GetID(FieldName);
		}
		
		try {
			ExecuteFunctionOnceAfter(
					function() {
						tempval.focus()
						tempval.select();
					},
					300);
			
		} catch(e){}
	}
	
	
	function UnSelectAll() {
		
		ExecuteFunctionOnceAfter(
				function() {
					try {
						document.selection.empty();
						
					} catch(e){}
					try {		
						window.getSelection().removeAllRanges();
						
					} catch(e){}
				},
				100
		)
	}
	
	
	LoadStyleSheet = function(DIV, URL) {
		document.body.innerHTML = document.body.innerHTML +  '<link rel=stylesheet href="' + URL + '">';
	}
	
	
	var PleaseWaitCounter;
	PleaseWaitCounter = 0;

	
	
	
	var StyleSheetCache = new Object;
	

	//
	//
	//
	GetStyleValue = function(StyleObj, Style) {
		StyleObj = GetID(StyleObj);
		
		if (StyleObj == undefined) {
			return 0;	
		}
		
		var Value = 0;
		
		//
		//	Use Inline Style If Found
		//
		if (GetID(StyleObj.style) != undefined) {
			try {
				var Value = ReplaceStr(StyleObj.style[Style], 'px', '');
			} catch(e) {
			}
		}
		
		
		
		//
		//	Use Style Sheet Value If Found :: ClassName Argument Must be Passed
		//
		if (StyleObj['className'] != '' && Value == 0) {

			var cssRules;
			
			if (document.all) {
				cssRules = 'rules';
			} else if (document.getElementById) {
				cssRules = 'cssRules';
			}


			//
			//	If Cached
			//

				if (StyleSheetCache[StyleObj.className] != undefined){
					Value = parseInt(StyleSheetCache[StyleObj.className][Style]);
					//DIV_RecentInfo.innerHTML += '**' + StyleObj.className +' '+Style + ' ' + Value + '<br>';
				}
				try{
			} catch(e){}
			
			if (Value == '') {

				for (var S = 0; S < document.styleSheets.length; S++){
					for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
					
						var ClassStr = ReplaceStr(document.styleSheets[S][cssRules][R].selectorText, '#', ' ');
						ClassStr = ReplaceStr(ClassStr, '.', ' ');
						ClassStr = ReplaceStr(ClassStr, ',', ' ');
						ClassStr = ' ' + ClassStr + ' ';
						if (ClassStr.indexOf(StyleObj.className) > -1  && document.styleSheets[S][cssRules][R]['style'] != undefined) {
							Value = Number(parseInt(document.styleSheets[S][cssRules][R].style[Style]));
							if (Value > 0) {
								StyleSheetCache[StyleObj.className] = document.styleSheets[S][cssRules][R].style;
								break;
							}
						}
					}

					if (Value > 0) {

						break;
					}
				}
			}
		}

	  
		if (Value > 0) {
			return Value;	
		} else {
			return 0;
		}

		
	}

	
	//
	//
	//
	GetWidth = function(ObjectID, Width) {
	
		ObjectID = GetID(ObjectID);
		
		var SizeObj = new Object();
		SizeObj.OffsetWidth  	= Number(ObjectID.offsetWidth);
				
			
		if (isIE || isChrome || isSafari) {
			
			return SizeObj.OffsetWidth;

		} else {
			
			SizeObj.Border	 		= Number(GetStyleValue(ObjectID, 'borderWidth'));
			SizeObj.BorderLeft 		= Number(GetStyleValue(ObjectID, 'borderLeftWidth'));
			SizeObj.BorderRight		= Number(GetStyleValue(ObjectID, 'borderRightWidth'));
			SizeObj.PaddingLeft		= Number(GetStyleValue(ObjectID, 'paddingLeft'));
			SizeObj.PaddingRight	= Number(GetStyleValue(ObjectID, 'paddingRight'));
			SizeObj.Padding			= Number(GetStyleValue(ObjectID, 'padding'));
			SizeObj.MarginLeft		= Number(GetStyleValue(ObjectID, 'marginLeft'));
			SizeObj.MarginRight		= Number(GetStyleValue(ObjectID, 'marginRight'));
			SizeObj.Margin			= Number(GetStyleValue(ObjectID, 'margin'));
			SizeObj.OutlineLeft		= Number(0);
			SizeObj.OutlineRight	= Number(0);
	
	
			if (SizeObj.Padding != 0) {
				if (SizeObj.PaddingRight==0) {
					SizeObj.PaddingRight = SizeObj.Padding;
				}
				if (SizeObj.PaddingLeft==0) {
					SizeObj.PaddingLeft = SizeObj.Padding;
				}
				
				//SizeObj.Padding = 0;
			}
			
			if (SizeObj.Border != 0) {
				if (SizeObj.BorderRight==0) {
					SizeObj.BorderRight = SizeObj.Border;
				}
				if (SizeObj.BorderLeft==0) {
					SizeObj.BorderLeft = SizeObj.Border;
				}
				//SizeObj.Border = 0;
			}
			
		
			SizeObj.OuterWidth 		= 	SizeObj.Border			+
										SizeObj.BorderLeft  	+	 
										SizeObj.BorderRight 	+
										SizeObj.PaddingLeft 	+ 
										SizeObj.PaddingRight 	+
										SizeObj.MarginLeft 		+ 
										SizeObj.MarginRight 	+ 
										SizeObj.OutlineLeft 	+ 
										SizeObj.OutlineRight; 
												
			if (Width == undefined) {
				Width = ObjectID.offsetWidth;	
			}
		

			return Width - SizeObj.OuterWidth;
		}
		
	}
		
	
	
	CreateUUID = function(len, radix) {
		 // Private array of chars to use
		var CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''); 
	
	 
		var chars = CHARS, uuid = [], rnd = Math.random;
		radix = radix || chars.length;
	
		if (len) {
		  // Compact form
		  for (var i = 0; i < len; i++) uuid[i] = chars[0 | rnd()*radix];
		} else {
		  // rfc4122, version 4 form
		  var r;
	
		  // rfc4122 requires these characters
		  uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
		  uuid[14] = '4';
	
		  // Fill in random data.  At i==19 set the high bits of clock sequence as
		  // per rfc4122, sec. 4.1.5
		  for (var i = 0; i < 36; i++) {
			if (!uuid[i]) {
			  r = 0 | rnd()*16;
			  uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r & 0xf];
			}
		  }
		}
	
		return uuid.join('');
	
	}

