/*
//LIST OF ALL THE FUNCTION AND THEIR ALLOWED PARAMETERS
function findDOM(objectId) {
function findParentDOM(objectId) {
function openWindow(theURL,winName,features) {
function GoTo(url) {
function createCookie(name,value,days)
function readCookie(name,getex)
function eraseCookie(name)
function numValidate(obj) {
function delConfirm(url) {
function getAJAXResult(url,name,apf)
function postAJAXResult(url,parms,name,apf)
function GetXmlHttpObject()
function stateChanged()
function QueryString(key) {
function adjust_popup() {
function textCounter(field, element, maxlimit) {
function WindowSize(dimension) {
function DocumentSize(dimension) {
function ScrollOffset(dimension) {
function getXfromLeft(imgID) {
function getYfromTop(imgID) {
function getRealLeft(imgElem) {
function getRealTop(imgElem) {
function eventTrigger(e) {
function insertAtCursor(myField, myValue) {
function LTrim(value) {
function RTrim(value) {
function trim(value) {
function Copy(obj) {
function Paste(obj) {
function replaceAll(value,oldStr,newStr,matchCase) {
function isEmpty(str) {
function isEqual(str1,str2,cs) {
function StringValidator(_string,_customlist) {
function toProperCase(str) {
function toCurrency(amount)
function ApplyStyles(obj,styles) {
function changeBGColor(obj,from,to) {
function RGB2HEX(rgb) {
function HEX2RGB(hex) {
function d2h(d) {
function h2d(h) {
function MM_preloadImages() {
function newImage(arg) {
function changeImages() {
function randomInt(lower,upper)	{
function addfav(url,favname) {
function ShowOrHideObject(obj) {
function alt(obj,txt) {
function SetParent(){
function fadeF(sr,sg,sb,er,eg,eb,step,obj,fstop,at) {
function fadeB(sr,sg,sb,er,eg,eb,step,obj,fstop,at) {
function Back() {
function Forward() {
function ValidateFormValues(required_fields_field) {
function GetAttributes(obj,delimiter) {
function GetSelectedOptionValues(obj) {
function GetCheckedRadioValue(obj) {
function printArticle() {
*/

//----------------------------------------------------------------
//***START*JAVSCRIPT*TOOLS****************************************
//----------------------------------------------------------------

//FINDS A NAMED OBJECT FOR ANY BROWSER, RETURNS THE OBJECT INSTANCE
	//FINDS THE OBJECT ON THE CURRENT PAGE
		function findDOM(objectId) {
			if (document.getElementById) {return (document.getElementById(objectId));}
			else if (document.all) {return (document.all[objectId]);}
			else if (document.layers) {return (document.layers[objectId]);}
			else {return (document.getElementById(objectId));}
			}

	//FINDS THE OBJECT ON THE OPENER PAGE
		function findParentDOM(objectId) {
			if (window.opener.document.getElementById) {return (window.opener.document.getElementById(objectId));}
			else if (window.opener.document.all) {return (window.opener.document.all[objectId]);}
			else if (window.opener.document.layers) {return (window.opener.document.layers[objectId]);}
			else {return (window.opener.document.getElementById(objectId));}
		}

	//RETURNS THE OBJ FOR THE PASSED IN STUFF. CAN PASS IN OBJECT OR ID.
	function $DOM(obj) {
		if (typeof(obj)=="string") obj=findDOM(obj);
		return obj;
	}
	
	function $Exists(obj) {
		if (typeof(obj)=="string") {
			if (!document.getElementById(obj)) return false;
		}
		return true;
	}
//END FIND A NAMED OBJECT


//EXTEND FIREFOX TO INCLUDE SOME IE COMPATABILITY
	if (navigator.userAgent.toLowerCase().indexOf("firefox") != -1) {
		HTMLElement.prototype.__defineGetter__("innerText", function () { return(this.textContent); });

		HTMLElement.prototype.__defineSetter__("innerText", function (txt) { this.textContent = txt; });

		//NOTE: "obj.children" in IE doesn't have text nodes.
		HTMLElement.prototype.__defineGetter__("children", function () { return(this.childNodes); });

		HTMLElement.prototype.attachEvent = function (eventName, functionHandler) {
			functionHandler._wrapHandler = function (e) {
				window.event = e;
				functionHandler();
				return (e.returnValue);
			};
			this.addEventListener(eventName.substr(2), functionHandler._wrapHandler, false);
		};

		HTMLElement.prototype.detachEvent = function (eventName, functionHandler) {
			if (functionHandler._wrapHandler != null)
				this.removeEventListener(eventName.substr(2), functionHandler._wrapHandler, false);
		};

		Event.prototype.__defineGetter__("srcElement", function () {
			var node = this.target;
			while (node.nodeType != 1)
				node = node.parentNode;
			if (node != this.target) alert("Unexpected event.target!")
				return node;
		});
	}
//END EXTEND FIREFOX ABILITIES



//FUNCTION TO OPEN A NEW WINDOW
	var _thepopupwindow;

	function openWindow(theURL,winName,features) {
	//FEATURE LIST:
	//alwaysLowered,alwaysRaised,dependent,directories,height,hotkeys,
	//innerHeight,innerWidth,location,menubar,outerHeight,outerWidth,resizable,
	//screenX,screenY,scrollbars,status,titlebar,toolbar,width,z-lock

		_thepopupwindow = window.open(theURL,winName,features);

		setTimeout("TestTheNewPopupWindow()",1000);
	}

	function TestTheNewPopupWindow() {
		if (!_thepopupwindow || !_thepopupwindow.top) {
			alert("An ATM popup window has been blocked by your popup blocker." +
				  "\n\nThe window is not an advertisement. It was being opened in response " +
				  "\nto an item you clicked. Try pressing the 'Ctrl' key when clicking " +
				  "\nor disable your popup blocker. Thank you.");
		}
	}
//END OPEN NEW WINDOW

//JUMPS TO THE URL
	function GoTo(url) {
		window.location.href=url;
	}
//END GOTO

//JAVASCRIPT COOKIE FUNCTIONS - CREATE, READ, ERASE
//**********************************************
	function createCookie(name,value,days)
	{
		if (days)
		{
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}

	function readCookie(name,getex)
	{
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		if (getex=="yes") {return document.cookie;}
		else
		{
			for(var i=0;i < ca.length;i++)
			{
				var c = ca[i];
				while (c.charAt(0)==' ') c = c.substring(1,c.length);
				if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
			}
		}
		return "";
	}

	function eraseCookie(name)
	{
		createCookie(name,"",-1);
	}
//*********************************************


//CHECKS AN OBJECTS VALUE TO SEE IF ITS A VALID NUMBER, PRODUCES AN ERROR IF NOT
    function numValidate(obj) {
	var num;
	num = findDOM(obj);
        if (isNaN(num.value) == true) {
            num.value="";
			if (!isEmpty(num.name))
				alert("The value of "+num.name+" is not a valid number.")
			else
				alert("The value of "+num.id+" is not a valid number.");
        }
    }

//MAKES SURE THE USER WANTS TO DELETE A RECORD AND REDIRECTS TO A URL IF SO
	function delConfirm(url) {
		var answer;
		answer = confirm ("Delete this record?")
		if (answer)
		window.location.href=url
	}

//AJAX FUNCTIONS
//*************************************
	var _xmlHttp,_ajaxResultsObj,_afterAJAXPostFunction, _ajaxResultToVar;

	//pass in the url to get the info from, and the object name of where to output results
	// also you can pass in the 'After Post Function', which runs after the get completes
	function getAJAXResult(url,resObj,apf,resultToVariable) {
		if (resultToVariable) {
			_ajaxResultToVar = true
		} else  {
			if (typeof(resObj)=="string") resObj=findDOM(resObj);
			_ajaxResultToVar = false;
		}
		_ajaxResultsObj = resObj;
		if (!isEmpty(apf)) _afterAJAXPostFunction=apf;

		_xmlHttp=GetXmlHttpObject();
		if (_xmlHttp==null) {
			alert("Your browser does not support this action.\nIf using IE, ActiveX Objects may not be allowed.");
			return;
		}
		
		_xmlHttp.onreadystatechange=stateChanged;
		_xmlHttp.open("GET",url,true);
		_xmlHttp.send(null);
	}

	function postAJAXResult(url,parms,name,apf,resultToVariable) {
		if (resultToVariable) {
			_ajaxResultToVar = true
		} else  {
			if (typeof(name)=="string") name=findDOM(name);
			_ajaxResultToVar = false;
		}
		_ajaxResultsObj = name;
		if (!isEmpty(apf)) _afterAJAXPostFunction=apf;

		_xmlHttp=GetXmlHttpObject();
		if (_xmlHttp==null) {
			alert("Your browser does not support this action.\nIf using IE, ActiveX Objects may not be allowed.");
			return;
		}
			
		_xmlHttp.onreadystatechange=stateChanged;
		_xmlHttp.open("POST", url, true);
		_xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		_xmlHttp.setRequestHeader("Content-length", parms.length);
		_xmlHttp.setRequestHeader("Connection", "close");
		_xmlHttp.send(parms);
	}

	function GetXmlHttpObject() {
		var objXMLHttp=null
		try {// Firefox, Opera 8.0+, Safari
			objXMLHttp=new XMLHttpRequest();
		}
		catch (e) {// Internet Explorer
			try {
				objXMLHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e) {
				try {
					objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e) {
					return null;
				}
			}
		}
		return objXMLHttp;
	}

	function stateChanged() {
		if (_xmlHttp.readyState==4 || _xmlHttp.readyState=="complete") {
			if (!_ajaxResultToVar) {
				_ajaxResultsObj.innerHTML="";
				_ajaxResultsObj.innerHTML=_xmlHttp.responseText;
			} else {
				eval(_ajaxResultsObj + " = \"" + _xmlHttp.responseText.replaceAll("\"", "\\\"") + "\"");
			}

			if (!isEmpty(_afterAJAXPostFunction)) eval(_afterAJAXPostFunction);
		}
	}

	//TAKES A DELIMITED LIST OF OBJECT NAMES AND RETURNS A QUERYSTRING OF THOSE OBJECT VALUES
	function BuildParamString(objList,delimiter) {
		var poststr = "";
		if (typeof(objList)=="string") {
			if (!delimiter)
				objList = objList.split(",")
			else
				objList = objList.split(delimiter);
		}

		for (var i=0;i<objList.length;i++) {
			objList[i] = trim(objList[i]);
 			poststr += objList[i] + "=" + encodeURIComponent($Value(objList[i])) + "&";
		}

		return poststr;
	}
//END AJAX FUNCTIONS*****************


//THIS FUNCTIONS RETURNS THE VALUE OF THE PASSED IN KEY
	function QueryString(key,url) {
		if (url)
			var mainHREF = url.substring(url.indexOf("?")+1,url.length);
		else
			var mainHREF = self.location.href.substring(self.location.href.indexOf("?")+1,self.location.href.length);

		if (mainHREF.length>1) {
			var sets = mainHREF.split("&");
			for (x=0;x<sets.length;x++) {
				if (sets[x].indexOf(key+"=")==0) {
					var pair = sets[x].split("=");
					var str = "";
					for (z=1;z<pair.length;z++) {
						if (str=="") {str = pair[z];}
						else {str += "=" + pair[z];}
					}
					return unescape(str);
				}
			}
		}
		return false;
	}
//END QUERYSTRING


//RESIZES A POPUP WINDOW TO THE SIZE OF THE IMAGE
	function adjust_popup() {
        	var w, h, fixedW, fixedH, diffW, diffH;
        	if (document.documentElement && document.body.clientHeight==0) {     // Catches IE6 and FF in DOCMODE
                	fixedW = document.documentElement.clientWidth;
                	fixedH = document.documentElement.clientHeight;
                	window.resizeTo(fixedW, fixedH);
                	diffW = fixedW - document.documentElement.clientWidth;
                	diffH = fixedH - document.documentElement.clientHeight;
                	w = fixedW + diffW + 16; // Vert Scrollbar Always On in DOCMODE.
                	h = fixedH + diffH;
                	if (w >= screen.availWidth) h += 16;
        	} else if (document.all) {
                	fixedW = document.body.clientWidth;
                	fixedH = document.body.clientHeight;
                	window.resizeTo(fixedW, fixedH);
                	diffW = fixedW - document.body.clientWidth;
                	diffH = fixedH - document.body.clientHeight;
                	w = fixedW + diffW;
                	h = fixedH + diffH;
                	if (h >= screen.availHeight) w += 16;
                	if (w >= screen.availWidth)  h += 16;
        	} else {
                	fixedW = window.innerWidth;
                	fixedH = window.innerHeight;
                	window.resizeTo(fixedW, fixedH);
                	diffW = fixedW - window.innerWidth;
                	diffH = fixedH - window.innerHeight;
                	w = fixedW + diffW;
                	h = fixedH + diffH;
                	if (w >= screen.availWidth)  h += 16;
                	if (h >= screen.availHeight) w += 16;
        	}
        	w = Math.min(w,screen.availWidth);
        	h = Math.min(h,screen.availHeight);
        	window.resizeTo(w,h);
        	window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);
	}
//END RESIZE POPUP WINDOW


//COUNTS THE NUMBER OF CHARACTERS IN A FIELD, AND SHORTENS IT IF IT IS TOO LONG
//  RETURNS THE NUMBER OF CHARACTERS REMAINING TO A SPECIFIED OBJECT.
// YOU PASS IN THE 'field' YOU WANT TO COUNT, THE 'element' TO PASS THE NUMBER
//  OF CHARS LEFT, AND THE 'maxlimit' NUMBER OF CHARACTERS ALOWED.
//THIS FUNCTION CAN BE ASSIGNED TO A ONKEYUP OBJECT EVENT AND/OR ONBLUR
	function textCounter(field, element, maxlimit) {
		if (typeof(field)=="string") field = findDOM(field);
		if (typeof(element)=="string") element = findDOM(element);

  		if (field.value.length > maxlimit)
    		field.value = field.value.substring(0, maxlimit);
  		else
    		element.innerHTML = maxlimit - field.value.length;
	}
//END TEXT COUNTER


//RETURNS THE HEIGHT OR WIDTH OF THE BROWSER WINDOW
	function WindowSize(dimension) {
		var x,y;

		if (self.innerHeight) { // all except Explorer
			x = self.innerWidth;
			y = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) {// Explorer 6 Strict Mode
			x = document.documentElement.clientWidth;
			y = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			x = document.body.clientWidth;
			y = document.body.clientHeight;
		}

		if ((dimension.toUpperCase()=="W")||(dimension.toUpperCase()=="WIDTH")) {
			return x;
		} else if ((dimension.toUpperCase()=="H")||(dimension.toUpperCase()=="HEIGHT")) {
			return y;
		}
	}

	function WindowSizeHeight() { return WindowSize("h")}

	function WindowSizeWidth() { return WindowSize("w")}
	
	function CenterScreen() {
		this.top = parseInt(WindowSizeHeight() / 2) + "px";
		this.left = parseInt(WindowSizeWidth() / 2) + "px";
		
		this.offsetLeft = function(offset) {
			offset = parseInt(parseInt(offset) / 2);
			return (parseInt(this.left)-offset) + "px";
		};
		
		this.offsetTop = function(offset) {
			offset = parseInt(parseInt(offset) / 2);
			return (parseInt(this.top)-offset) + "px";
		};
	}
//END WINDOW HEIGHT


//RETURNS THE HEIGHT OR WIDTH OF THE BROWSER DOCUMENT
	function DocumentSize(dimension) {
		var x,y;
		var test1 = document.body.scrollHeight;
		var test2 = document.body.offsetHeight
		if (test1 > test2) {// all but Explorer Mac
			x = document.body.scrollWidth;
			y = document.body.scrollHeight;
		} else {// Explorer Mac, would also work in Explorer 6 Strict, Mozilla and Safari
			x = document.body.offsetWidth;
			y = document.body.offsetHeight;
		}

		if ((dimension.toUpperCase()=="W")||(dimension.toUpperCase()=="WIDTH")) {
			return x;
		} else if ((dimension.toUpperCase()=="H")||(dimension.toUpperCase()=="HEIGHT")) {
			return y;
		}
	}

	function DocumentSizeHeight() { return DocumentSize("h")}

	function DocumentSizeWidth() { return DocumentSize("w")}
//END DOCUMENT HEIGHT

//RETURNS HOW MUCH THE PAGE HAS SCROLLED
	function ScrollOffset(dimension) {
		var x,y;
		if (self.pageYOffset) {// all except Explorer
			x = self.pageXOffset;
			y = self.pageYOffset;
		} else if (document.documentElement && document.documentElement.scrollTop) {// Explorer 6 Strict
			x = document.documentElement.scrollLeft;
			y = document.documentElement.scrollTop;
		} else if (document.body) {// all other Explorers
			x = document.body.scrollLeft;
			y = document.body.scrollTop;
		}

		if ((dimension.toUpperCase()=="L")||(dimension.toUpperCase()=="LEFT")) {
			return x;
		} else if ((dimension.toUpperCase()=="T")||(dimension.toUpperCase()=="TOP")) {
			return y;
		}
	}
	
	function SetScrollPosition(val, LeftToRight) {
		val = val * 1;
		if (self.pageYOffset) {// all except Explorer
			if (LeftToRight) self.pageXOffset = val
			else self.pageYOffset = val;
		} else if (document.documentElement && document.documentElement.scrollTop) {// Explorer 6 Strict
			if (LeftToRight) document.documentElement.scrollLeft = val
			else document.documentElement.scrollTop = val;
		} else if (document.body) {// all other Explorers
			if (LeftToRight) document.body.scrollLeft = val
			else document.body.scrollTop = val;
		}
	}
//END SCROLL OFFSET

//FUNCTIONS FOR GETTING AN ELEMENTS X/Y COORDINATES
	function getXfromLeft(imgID) {
		var useX = (navigator.userAgent.toLowerCase().indexOf("firefox") == -1 && navigator.userAgent.toLowerCase().indexOf("msie") == -1);
		if (useX) 
			return document.getElementById(imgID).x;
		else 
			return getRealLeft(imgID);//else, using Internet explorer
	}

	function getYfromTop(imgID) {
		var useY = (navigator.userAgent.toLowerCase().indexOf("firefox") == -1 && navigator.userAgent.toLowerCase().indexOf("msie") == -1);
  		if (useY) 
			return document.getElementById(imgID).y;
  		else 
			return getRealTop(imgID);
	}

	function getRealLeft(imgElem) {
    	xPos = document.getElementById(imgElem).offsetLeft;
    	tempEl = document.getElementById(imgElem).offsetParent;
      	while (tempEl != null) {
          	xPos += tempEl.offsetLeft;
          	tempEl = tempEl.offsetParent;
      	}
    	return xPos;
	}

	function getRealTop(imgElem) {//
    	yPos = document.getElementById(imgElem).offsetTop;
    	tempEl = document.getElementById(imgElem).offsetParent;
    	while (tempEl != null) {
          	yPos += tempEl.offsetTop;
          	tempEl = tempEl.offsetParent;
      	}
    	return yPos;
	}
//END X/Y COORDINATES FUNCTIONS


//FUNCTION RETURNS THE ID OR NAME OF THE OBJECT THAT LAST TRIGGERED A DOCUMENT EVENT
	function eventTrigger(e) {
		//get the element that triggered the event
		var targ;
		if (!e) var e = window.event;
		if (e.target) targ = e.target;
		else if (e.srcElement) targ = e.srcElement;
		if (targ.nodeType == 3) // workaround Safari bug
			targ = targ.parentNode;
		//end get element

		if ((!targ.id) || (isEmpty(targ.id)))
			return targ.name
		else
			return targ.id;
	}
//END EVENT TRIGGER


//STRING RELATED FUNCTIONS
	//THIS FUNCTIONS ADDS TEXT INTO A FIELD WHERE THE CURSOR IS
		//insertAtCursor("fieldName", "some string");
		function insertAtCursor(myField, myValue) {
			var obj = findDOM(myField);
			if (document.selection) {	//IE support
				obj.focus();
				var sel = document.selection.createRange();
				sel.text = myValue;
			}
			else if (obj.selectionStart || obj.selectionStart == "0") {	//MOZILLA/NETSCAPE support
				var startPos = obj.selectionStart;
				var endPos = obj.selectionEnd;
				obj.value = obj.value.substring(0, startPos) + myValue + obj.value.substring(endPos, obj.value.length);
			} else {
				myField.value += myValue;
			}
		}
	//end insert at cursor


	//TRIM FUNTIONS
		// Removes leading whitespaces
		function LTrim(value) {
			var re = /\s*((\S+\s*)*)/;
			return value.replace(re, "$1");
		}

		// Removes ending whitespaces
		function RTrim(value) {
			var re = /((\s*\S+)*)\s*/;
			return value.replace(re, "$1");
		}

		// Removes leading and ending whitespaces
		function trim(value) {
			if (value)
				return LTrim(RTrim(value))
			else
				return "";
		}
	//END TRIM FUNCTIONS


	//COPY AND PASTE FUNCTIONS
		function Copy(obj) {
			var _t = findDOM(obj);
			var Copied = _t.createTextRange();
			Copied.execCommand("Copy");
		}

		function Paste(obj) {
			var _m = findDOM(obj);
			_m.value = "";
   			_m.focus();
   			var PastedText = _m.createTextRange();
   			PastedText.execCommand("Paste");
		}
	//END COPY AND PASTE FUNCTIONS


	//REPLACES ALL OCCURANCES OF A STRING WITHIN A STRING WITH A STRING
		function replaceAll(value,oldStr,newStr,matchCase) {
			var options = "g";
			if (matchCase) options+="i";
			var val = new RegExp(oldStr, options);
			return value.replace(val,newStr);
		}
	//END REPLACE ALL


	//SIMPLY RETURNS TRUE IF STRING IS = "" or is just spaces
		function isEmpty(str) {
			str = trim(str);
			if ((!str) || (str=="") || (str=="undefined")) return true
			else return false;
		}
	//END EMPTY TEST


	//COMPARES TWO STRINGS TO SEE IF THEY ARE EQUAL, THE ADVANTAGE
	// TO THIS FUNCTION IS THE CASE SENSITIVITY FLAG.
		function isEqual(str1,str2,cs) {
			if (cs) {
				if (str1==str2) return true
				else return false;
			} else {
				if (str1.toUpperCase()==str2.toUpperCase()) return true
				else return false;
			}
		}
	//END ISEQUAL


	//START: CREATE A NEW OBJECT FOR STRING VALIDATION
		//OBJECT REQUIRES A STRING. ALSO ACCEPTS OPTIONAL CUSTOM LIST AS A STRING OR AN ARRAY OF VALUES
		function StringValidator(_string,_customlist) {

			this.string = (_string)?_string:"";
			this.customlist = _customlist;

			//CHECK TO SEE IF THE STRING CONTAINS ONLY LETTERS, WHITESPACE IS OK, SEE 'nospace' PROPERTY
			this.lettersonly = TestLettersOnly(this.string);
			this.lettersonlyError = TestLettersOnly(this.string,true);

			//CHECK TO SEE IF THE STRING CONTAINS ONLY LETTERS AND NUMBERS
			this.textonly = TestTextOnly(this.string);
			this.textonlyError = TestTextOnly(this.string,true);

			//CHECK TO SEE IF THE STRING WOULD QUALIFY AS A VALID EMAIL ADDRESS
			this.email = TestIfEmail(this.string);
			this.emailError = TestIfEmail(this.string,true);

			//AN ARRAY OF VALUES OR A STRING OF CHARACTERS CAN BE PASSED IN FOR THIS CHECK
			//IF NOTHING IS PASSED IN, THE VALUE IS FALSE AND THE ERROR IS BLANK
			if (this.customlist) {
				this.custom = TestCustom(this.string,this.customlist);
				this.customError = TestCustom(this.string,this.customlist,true);;
			} else {
				this.custom = false;
				this.customError = "";
			}

			//CHECK TO SEE IF THE STRING CONTAINS A SPACE
			if (this.string!="")this.nospace = (_string.indexOf(" ")==-1)
			else this.nospace = true;

			//CHECK TO SEE IF THE STRING IS ONLY NUMBERS
			this.numbersonly = (!isNaN(_string));

			//CREATE LENGTH PROPERTY
			if (this.string!="")this.length = this.string.length
			else this.length = 0;
		}

		function TestLettersOnly(str,err) {
			if(str==""){return (err)?"Value is empty":false;}
			else{var list = "`~!@#$%^&*()-_+=\\\t\"';:<,>.?/[{]}|0123456789";for(i=0;i<list.length;i++)
			{if(str.indexOf(list.charAt(i))>-1){return (err)?"Value contains the invaild character \""+list.charAt(i)+"\"":false;}}}
			return (err)?"":true;
		}

		function TestTextOnly(str,err) {
			if(str==""){return (err)?"Value is empty":false;}
			else{var list="\\\t\"<>";for(i=0;i<list.length;i++){if (str.indexOf(list.charAt(i))>-1)
			{return (err)?"Value contains the invaild character \""+list.charAt(i)+"\"":false;}}}
			return (err)?"":true;
		}

		function TestIfEmail(str,err) {
			if(str==""){return (err)?"Value is empty":false;
			}else{
				var list = " `~!#$%^&*()+=\\\t\"';:<,>?/[{]}|";
				var _arr = str.split("@");
				if(str.length<6){return (err)?"Invalid email: not long enough.":false;}
				if(_arr.length!=2){return (err)?"Invalid email address.":false;}
				if((_arr[0].length<2)||(_arr[1].length<4)||
				   	(_arr[1].indexOf(".")==-1)||(_arr[1].indexOf(".")>=(_arr[1].length-2)))
					{return (err)?"Invalid email address.":false;}
				for(i=0;i<list.length;i++) {if (str.indexOf(list.charAt(i))>-1){return (err)?"Value contains the invaild character \""+list.charAt(i)+"\"":false;}}
			}
			return (err)?"":true;
		}

		function TestCustom(str,list,err) {
			if(str==""){return (err)?"Value is empty":false;
			}else{
				if(isArray(list)){for (i=0;i<list.length;i++) {if(str.indexOf(list[i])>-1){return (err)?"Contains an invaild character => "+list[i]+" <=":false;}}
				}else{for (i=0;i<list.length;i++) {if (str.indexOf(list.charAt(i))>-1) {return (err)?"Contains an invaild character => "+list.charAt(i)+" <=":false;}}}
			}
			return (err)?"":true;
		}

		function isArray(obj) {
			return (obj.constructor.toString().toLowerCase().indexOf("array")==-1)?false:true;
		}
	//END: CREATE A NEW OBJECT FOR STRING VALIDATION

	//FOMATS A STRING IN PROPER CASE
	function toProperCase(str) {
		if (!isEmpty(str)) {
			var i;
			var s = trim(str).split(" ");
			str = "";

			for (i=0;i<s.length;i++) {
				if (s[i].length==0) {
					str += " ";
				} else if (s[i].length==1) {
					str += s[i].toUpperCase() + " ";
				} else {
					str += s[i].charAt(0).toUpperCase();
					str += s[i].substring(1,s[i].length).toLowerCase() + " ";
				}
			}
		}

		return str;
	}

	//FORMATS A STRING TO CURRENCY
	function toCurrency(amount)
	{
		var i = parseFloat(amount);
		if(isNaN(i)) { i = 0.00; }
		var minus = '';
		if(i < 0) { minus = '-'; }
		i = Math.abs(i);
		i = parseInt((i + .005) * 100);
		i = i / 100;
		s = new String(i);
		if(s.indexOf('.') < 0) { s += '.00'; }
		if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
		s = minus + s;
		return s;
	}

	//THIS EXTENDS THE STRING CLASS TO INCLUDE A replaceAll METHOD
	String.prototype.replaceAll=function(s1, s2) {return this.split(s1).join(s2)}

	//THIS EXTENDS THE STRING CLASS TO INCLUDE A SIMPLER UPPER CASE METHOD
	String.prototype.UCase=function() {return this.toUpperCase()}

	//THIS EXTENDS THE STRING CLASS TO INCLUDE A SIMPLER LOWER CASE METHOD
	String.prototype.LCase=function() {return this.toLowerCase()}

	//THIS EXTENDS THE STRING CLASS TO INCLUDE A SIMPLER TRIM METHOD
	String.prototype.trim = function() {return (this.replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, ""))}

	//THIS EXTENDS THE STRING CLASS TO INCLUDE A FUNCTION THAT RETURNS WHETHER A STRING CONTAINS ANOTHER STRING
	String.prototype.contains=function(s1) {return this.toString().indexOf(s1)>-1}

	//THIS EXTENDS THE STRING CLASS TO INCLUDE A FUNCTION THAT RETURNS WHETHER A STRING CONTAINS ANOTHER STRING
	String.prototype.empty=function() {return isEmpty(this)}
	
	String.prototype.equals=function(str) {return (this==str)}
	
	String.prototype.charIsUpper=function(index) {return (this.charCodeAt(index)>=65 && this.charCodeAt(index)<=90)}

	String.prototype.charIsLower=function(index) {return (this.charCodeAt(index)>=97 && this.charCodeAt(index)<=122)}
	
	String.prototype.containsUpper=function() {
		for (var i=0;i<this.length;i++) {
			if (this.charIsUpper(i)) return true;
		}
		return false;
	}
	
	String.prototype.containsLower=function() {
		for (var i=0;i<this.length;i++) {
			if (this.charIsLower(i)) return true;
		}
		return false;
	}

	//THIS EXTENDS THE STRING CLASS TO INCLUDE A FUNCTION THAT RETURNS WHETHER A STRING CONTAINS ANOTHER STRING
	String.prototype.insertAfterIndex=function(index,txt) {
		return this.substring(0,index+1) + txt + this.substring(index+1,this.length);
	}
	
	String.prototype.startsWith = function(str) {return (this.indexOf(str)==0)}
	
	String.prototype.endsWith = function(str) {return (this.indexOf(str,this.length-str.length)==(this.length-str.length))}
	
	String.prototype.splitTrim = function(delimiter) {
		var arr = this.split(delimiter);
		for (var i=0;i<arr.length;i++) arr[i] = arr[i].trim();
		return arr;
	}
	
	String.prototype.countOccurances = function(str) {
		var x = 0, i = 0;
		while (this.indexOf(str, i)>=0) {
			x++;
			i = this.indexOf(str, i) + str.length;
		}
		return x;
	}

//END STRING RELATED FUNCTIONS


//PARSES A STRING WITH STYLE INFO AND APPLIES THE STYLES TO THE OBJECT PASSED IN
	function ApplyStyles(obj,styles) {
		var x=0, pv;
		if (typeof(obj)=="string") obj = findDOM(obj);
		var sty = styles.split(";");

		for (x=0;x<sty.length;x++) {
			if (trim(sty[x])!="") {
				pv = sty[x].split(":");
				eval("obj.style."+JStyle(trim(pv[0]))+" = \""+trim(pv[1])+"\"");
			}
		}
	}

	//JScript is picky about the names of its style properties
	function JStyle(attr) {
		while (attr.indexOf("-") > 0) {
			attr = attr.substring(0,attr.indexOf("-")) +
			 	   attr.charAt(attr.indexOf("-")+1).toUpperCase() +
				   attr.substring(attr.indexOf("-")+2,attr.length);
		}
		return attr;
	}
	
	function HTMLStyle(attr) {
		if (!attr.contains("-")) {
			if (attr.containsUpper()) {
				for (var i=0;i<attr.length;i++) {
					if (attr.charIsUpper(i)) {
						attr = attr.substring(0,i) + "-" +
						       attr.charAt(i).LCase() + 
							   attr.substring(i+1,attr.length);
						i = attr.indexOf("-") + 2;
					}
				}
			}
		}
		
		return attr.LCase();
	}
//END APPLY STYLES FUNCTIONS

//CHANGE THE BACKGROUND COLOR FUNCTION
	function changeBGColor(obj,from,to) {
		if (typeof(obj)=="string") obj = findDOM(obj);
		if (obj.style) {
			var bgc = obj.style.backgroundColor.replace("#","").toUpperCase();
			if (bgc.indexOf("RGB")>=0) {
				if (RGB2HEX(bgc)==RGB2HEX(from)) {
					obj.style.backgroundColor=HEX2RGB(to);
				} else {
					obj.style.backgroundColor=HEX2RGB(from);
				}
			} else {
				if (RGB2HEX(bgc)==RGB2HEX(from)) {
					obj.style.backgroundColor=RGB2HEX(to);
				} else {
					obj.style.backgroundColor=RGB2HEX(from);
				}
			}
		}
	}
//END CHANGE BACKGROUND COLOR FUNCTION

//HEX TO RGB AND RGB TO HEX COLOR CONVERSIONS
	//NOTE: these 2 functions will convert whatever you give to the specified value
	//      ie., if you input a HEX value into the rgb2hex it will return what you passed in.
	//      if you send a RGB then it will be converted.
	//      its helpful if you don't know which value your getting from the browser, and saves time
	//      trying to determine which one it is.

	function RGB2HEX(rgb) {
		if (rgb.toUpperCase().indexOf("RGB")>=0) {
			var c = rgb.split(",");
			return d2h(parseInt(trim(c[0].replace("RGB(","")))).toString() + d2h(parseInt(c[1])).toString() + d2h(parseInt(c[2])).toString();
		} else {
			return rgb.replace("#","");
		}
	}

	function HEX2RGB(hex) {
		var c = hex.replace("#","");
		if (c.toUpperCase().indexOf("RGB")>=0) {
			return c;
		} else {
			if (hex.length==3) {
				var c1 = c.substring(0,1);
				var c2 = c.substring(1,1);
				var c3 = c.substring(2,1);
			} else {
				var c1 = c.substring(0,2);
				var c2 = c.substring(2,4);
				var c3 = c.substring(4,6);
			}
			return "RGB(" + h2d(c1) + "," + h2d(c2) + "," + h2d(c3) + ")";
		}
	}

	function d2h(d) {return d.toString(16).toUpperCase();}

	function h2d(h) {return parseInt(trim(h),16);}
//END H2D & D2H CONVERSIONS

//HANDY IMAGE FUNCTIONS
	//pass in as long an image list as you want, they will be preloaded into var plImg0-(argument list length-1)
	var _preloadImgFlag = false;
	function MM_preloadImages() {
		if (document.images) {
			for (var i=0; i<MM_preloadImages.arguments.length; i++) {
				eval("var plImg"+i+" = newImage(\""+MM_preloadImages.arguments[i]+"\")");
			}
			_preloadImgFlag = true;
		}
	}

	function newImage(arg) {
		if (document.images) {
			rslt = new Image();
			rslt.src = arg;
			return rslt;
		}
	}

	//SWITCHES THE IMAGES, 1 WITH 2, 3 WITH 4, 5 WITH 6, ETC.
	function changeImages() {
		if (document.images && (_preloadImgFlag == true)) {
			for (var i=0; i<changeImages.arguments.length; i+=2) {
				document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
			}
		}
	}
//END HANDY IMAGE FUNCTIONS

//RANDOM NUMBER GENERATOR
	function randomInt(lower,upper)	{
		if (upper) {
    		var ranNum= Math.floor((Math.random()*(upper-lower))+lower);
		} else {
			var ranNum= Math.floor(Math.random()*lower);
		}
    	return ranNum;
	}
//END RANDOM NUMBER GENERATOR

//ADD A LINK TO YOUR FAVORITES
	//Adds the current page to your favorites. If no values are passed in,
	// the current location is used.
	function addfav(url,favname) {
		if (document.all){
			if (isEmpty(url)) url=window.location.href;
			if (url.toLowerCase().indexOf("http://")==-1) url = "http://" + url;
			if (isEmpty(favname)) favname=window.location.href;

			window.external.AddFavorite(url,favname);
		}else{
			alert("Your browser may not support this operation.");
		}
	}
//END FAVORITES

//DISPLAYS OR HIDES THE OBJECT PASSED IN
	function ShowOrHideObject(obj,onoff) {
		if (!onoff) var onoff="";
		obj=$DOM(obj);
		if (onoff=="on") {
			obj.style.visibility="visible";
			obj.style.display="block";
		} else if (onoff=="off") {
			obj.style.visibility="hidden";
			obj.style.display="none";
		} else {
			if ((obj.style.display.toLowerCase()=="none") || (obj.style.visibility.toLowerCase()=="hidden")) {
				obj.style.visibility="visible";
				obj.style.display="block";
			} else {
				obj.style.visibility="hidden";
				obj.style.display="none";
			}
		}
	}

	function ShowObject(obj) {ShowOrHideObject(obj,"on");}

	function HideObject(obj) {ShowOrHideObject(obj,"off");}
	
	function isHidden(obj) {
		obj = $DOM(obj);
		if (obj.style) {
			if (obj.style.display.LCase().contains("none") || obj.style.visibility.LCase().contains("hidden")) {
				return true;
			} 
		}
		return false;
	}
//END ShowOrHideObject

//SHOWS AN ALT MESSAGE FOR ANY DOCUMENT ELEMENT
	function alt(obj,txt,offsetX,offsetY) {
		if (!txt) var txt="";
		if (!offsetX) var offsetX=20;
		if (!offsetY) var offsetY=12;

		if (!document.getElementById("alt_div")) {
			var nme = document.createElement("div");
  			nme.setAttribute("id","alt_div");
  			document.body.appendChild(nme);
  			var styles="position:absolute;width:8px;height:16px;display:none;visibility:hidden;" +
  						   "top:0px;left:0px;z-index:100;background-color:#FFFFE1;border:black 1px solid;" +
  						   "text-align:center;font-family:arial;font-size:11px;color:black;font-weight:400;"
  			ApplyStyles(nme,styles);
		}

		if(!nme)var nme = findDOM("alt_div");

		if (nme.style.display=="none") {
			nme.style.width=((txt.length*7)+4) + "px";
			nme.style.left=(getXfromLeft(obj)+offsetX) + "px";
			nme.style.top=(getYfromTop(obj)+offsetY) + "px";
			nme.innerHTML=txt;
			nme.style.display="block";
			nme.style.visibility="visible";
		} else {
			nme.style.display="none";
			nme.style.visibility="hidden";
		}
	}
//END ALT MESSAGE

//SETS THE CURRENT FRAME TO BE THE TOP FRAME
	function SetParent(){
		if(top.location!=location)top.location.href=document.location.href;
	}
//END SETPARENT

//FADE AN OBJECTS COLOR FROM ONE TO THE OTHER
//START RGB => sr,sg,sb : END RGB => er,eg,eb : # OF STEPS => step : OBJECT ID => obj : DOES OR DOESN'T CYCLE => fstop;
	var _fadeForward;

	//fade the foreground color
	function fadeF(sr,sg,sb,er,eg,eb,step,obj,fstop,at) {
		if (!at) var at = 1;
		if (!fstop) var fstop = false;
		if (at==1) _fadeForward = true;
		if (at==step) _fadeForward = false;

		findDOM(obj).style.color = "#" +
					ConvertHex(Math.floor(sr * ((step-at)/step)  + er * (at/step)))+
					ConvertHex(Math.floor(sg * ((step-at)/step) +  eg * (at/step)))+
					ConvertHex(Math.floor(sb * ((step-at)/step) +  eb * (at/step)));

		if ((at==step)&&(fstop)) {
			//stop fading
		} else {
			if (_fadeForward) {
				at++;
				setTimeout("fadeF("+sr+","+sg+","+sb+","+er+","+eg+","+eb+","+step+",\""+obj+"\","+fstop+","+at+")",1);
			} else {
				at--;
				setTimeout("fadeF("+sr+","+sg+","+sb+","+er+","+eg+","+eb+","+step+",\""+obj+"\","+fstop+","+at+")",1);
			}
		}
	}

	//fade the background color
	function fadeB(sr,sg,sb,er,eg,eb,step,obj,fstop,at) {
		if (!at) var at = 1;
		if (!fstop) var fstop = false;
		if (at==1) _fadeForward = true;
		if (at==step) _fadeForward = false;

		findDOM(obj).style.backgroundColor = "#" +
					ConvertHex(Math.floor(sr * ((step-at)/step)  + er * (at/step)))+
					ConvertHex(Math.floor(sg * ((step-at)/step) +  eg * (at/step)))+
					ConvertHex(Math.floor(sb * ((step-at)/step) +  eb * (at/step)));

		if ((at==step)&&(fstop)) {
			//stop fading
		} else {
			if (_fadeForward) {
				at++;
				setTimeout("fadeB("+sr+","+sg+","+sb+","+er+","+eg+","+eb+","+step+",\""+obj+"\","+fstop+","+at+")",1);
			} else {
				at--;
				setTimeout("fadeB("+sr+","+sg+","+sb+","+er+","+eg+","+eb+","+step+",\""+obj+"\","+fstop+","+at+")",1);
			}
		}
	}

	function ConvertHex(i) {
		if (i < 0) return "00";
		else if (i > 255) return "ff";
		else return "" + d2h(Math.floor(i/16)) + d2h(i%16);
	}
//END OBJECT COLOR FADER

//HISTORY CONTROLS
	function Back() {
		history.back();
	}

	function Forward() {
		history.forward();
	}
//END HISTORY

//TAKES AS PASSED IN FIELD WITH A LIST OF FIELDS THAT REQUIRE A VALUE
// RETURNS TRUE IF THE LIST FIELD IS EMPTY OR IF ALL FIELDS IN THE REQUIRED
// LIST CONTAINS A VALUE. RETURNS FALSE IF ONE OF THE REQUIRED FIELDS IS EMPTY.
	function ValidateFormValues(required_fields_field) {
		var i;

		if (!required_fields_field) var fld = "required"
		else var fld = required_fields_field;


		if (document.getElementById(fld)) {
			if (!isEmpty(trim(findDOM(fld).value))) {
				var val = findDOM(fld).value;

				if (val.indexOf(",")!=-1) {
					var items = trim(val).split(",");

					for (i=0;i<items.length;i++) {
						items[i] = trim(items[i]);
						if (items[i]!="") {
							if (document.getElementById(items[i])) {
								if (getNodeName(findDOM(items[i]))=="input") {
									if (getInputType(findDOM(items[i]))=="checkbox") {
										if (!findDOM(items[i]).checked) {
											alert("Checkbox \"" + items[i] + "\" must be checked to continue.");
											return false;
										}
									} else if (getInputType(findDOM(items[i]))=="radio") {
										if (isEmpty(GetCheckedRadioValue(items[i]))) {
											alert("An option for radio button group \"" + items[i] + "\" must be checked to continue.");
											return false;
										}
									} else {
										if (trim(findDOM(items[i]).value)=="") {
											alert("Field \"" + items[i] + "\" cannot be empty.");
											return false;
										}
									}
								} else {
									if (findDOM(items[i]).nodeName.toLowerCase()=="select") {
										if (GetSelectedOptionValues(items[i])=="") {
											alert("Option select \"" + items[i] + "\" must have an option selected.");
											return false;
										}
									} else if (findDOM(items[i]).nodeName.toLowerCase()=="textarea") {
										if (trim(findDOM(items[i]).value)=="") {
											alert("Field \"" + items[i] + "\" cannot be empty.");
											return false;
										}
									} else {
										if (trim(findDOM(items[i]).innerHTML)=="") {
											alert("Field \"" + items[i] + "\" cannot be empty.");
											return false;
										}
									}
								}
							}
						}
					}
				} else {
					var item = trim(val);

					if (document.getElementById(item)) {
						if (findDOM(item).nodeName.toLowerCase()=="input") {
							if (findDOM(item).type=="checkbox") {
								if (findDOM(item).checked) {
									alert("Checkbox \"" + item + "\" must be checked to continue.");
									return false;
								}
							} else if (findDOM(item).type=="radio") {
								radio_checked = false;
								radio_objs = document.getElementsByName(item);

								for (x=0;x<radio_objs.length;x++) {if (radio_objs[x].checked) radio_checked=true;}

								if (!radio_checked) {
									alert("An option for radio button group \"" + items[i] + "\" must be checked to continue.");
									return false;
								}
							} else {
								if (trim(findDOM(item).value)=="") {
									alert("Field " + item + " cannot be empty.");
									return false;
								}
							}
						} else {
							if (findDOM(item).nodeName.toLowerCase()=="select") {
								if (GetSelectedOptionValues(item)=="") {
									alert("Option select \"" + item + "\" must have an option selected.");
									return false;
								}
							} else if (findDOM(item).nodeName.toLowerCase()=="textarea") {
								if (trim(findDOM(item).value)=="") {
									alert("Field " + item + " cannot be empty.");
									return false;
								}
							} else {
								if (trim(findDOM(item).innerHTML)=="") {
									alert("Field " + item + " cannot be empty.");
									return false;
								}
							}
						}
					}
				}
			}
		}
		return true;
	}
//END VALIDATE FORM VALUES


//OTHER HELPFUL DOM FUNCTIONS
	//A COUPLE OF FUNCTIONS TO GET VALUES FROM OBJECTS
		function $Value(obj) {
			return getDOMValue(obj);
		}
		
		function $SetValue(obj,value,UseIndexListForOptionSelect) {
			setDOMValue(obj,value,UseIndexListForOptionSelect);
		}
		
		function getDOMValue(obj) {
			if (typeof(obj)=="string") 
				var valid = $Exists(obj)
			else
				var valid = true;

			if (valid) {
				obj = $DOM(obj);
				
				if (getNodeName(obj)=="input") {
					if (getInputType(obj)=="checkbox") {
						if (!obj.checked) {
							return false;
						} else {
							if (!isEmpty(obj.value))
								return obj.value
							else
								return true;
						}
					} else if (getInputType(obj)=="radio") {
						return GetCheckedRadioValue(obj);
					} else {
						return obj.value;
					}
				} else {
					if (getNodeName(obj)=="select") {
						return GetSelectedOptionValues(obj);
					} else if (getNodeName(obj)=="textarea") {
						return obj.value;
					} else {
						if (obj.innerHTML)
							return obj.innerHTML
						else if (obj.innerText)
							return obj.innerText
						else if (obj.textContent)
							return obj.textContent
						else
							return "";
					}
				}
			}

			return "";
		}
		
		function setDOMValue(obj,value,UseIndexListForOptionSelect) {
			if (typeof(obj)=="string") 
				var valid = $Exists(obj)
			else
				var valid = true;

			if (valid) {
				obj = $DOM(obj);
				
				if (getNodeName(obj)=="input") {
					if (getInputType(obj)=="checkbox") {
						if (value.toString().LCase()=="checked" || value.toString().LCase()=="selected" || 
						   value==true || value.toString().LCase()=="on") {
							obj.checked = true;
						} else {
							obj.checked = false;
						}
					} else if (getInputType(obj)=="radio") {
						SetCheckedRadioValue(obj,value);
					} else {
						obj.value = value;
					}
				} else {
					if (getNodeName(obj)=="select") {
						if (!UseIndexListForOptionSelect) {
							value = GetOptionIndexByValue(obj,value);
						}
						SetSelectedOptionValues(obj,value);
					} else if (getNodeName(obj)=="textarea") {
						obj.value = value;
					} else {
						obj.innerHTML = value;
						
						if (obj.innerHTML.empty() && !value.empty()) {
							obj.innerText = value;
						}
					}
				}
			}
		}


		//RETURNS THE VALUE SELECTED IN A SELECT OBJECT. SUPPORTS MULTI-SELECTS
		//RETURNS COMMA DELIMITED FOR MULTI-SELECTS. GETS INNERTEXT IF VALUE NOT AVAILABLE.
		function GetSelectedOptionValues(obj) {
			obj=$DOM(obj);
			var s = "";

			if (obj.nodeName.toLowerCase()=="select") {
				for (var i=0;i<obj.options.length;i++) {
					if (obj.options[i].selected) {
						if (obj.options[i].value.toString()!="")
							s+=obj.options[i].value+","
						else 
							s+=obj.options[i].innerText+",";
					}
				}
				if(s.charAt(s.length-1)==",")s=s.substring(0,s.length-1);
			}

			return s;
		}
		
		function GetOptionIndexByValue(obj,value) {
			obj=$DOM(obj);

			if (obj.nodeName.LCase()=="select") {
				for (var i=0;i<obj.options.length;i++) {
					if (obj.options[i].value==value || obj.options[i].innerText==value) {
						return i;
					}
				}
			}
			
			return -1
		}
		
		function SetSelectedOptionValues(obj,CommaSepIndices) {
			obj=$DOM(obj);
			var s = CommaSepIndices.toString().split(",");
			var l = obj.options.length-1;

			if (obj.nodeName.LCase()=="select") {
				for (var i=0;i<s.length;i++) {
					s[i] = s[i].trim();
					if (!s[i].empty()) {
						if (!isNaN(s[i])) {
							if ((s[i].trim()*1)>-1 && (s[i].trim()*1)<=l) {
								obj.options[s[i]*1].selected = true;
							}
						}
					}
				}
			}
		}
		//END OptionSelectValues

		//GET THE VALUE OF THE SELECTED RADIO BUTTON FROM A RADIO GROUP. IF THE VALUE
		// IS NOT AVAILABLE, IT GETS THE INDEX OF THE SELECTED BUTTON. OTHERWISE IT
		// RETURNS AN EMPTY STRING.
		function GetCheckedRadioValue(obj) {
			var radio_group, radio_checked, x;
			var val = "";

			if(typeof(obj)!="string") {
				(obj.name=="")?obj=obj.id:obj=obj.name;
			}

			if (!isEmpty(obj)) {
				radio_checked = false;
				radio_group = document.getElementsByName(obj);

				for (x=0;x<radio_group.length;x++) {
					if (radio_group[x].checked) {
						val = radio_group[x].value;
						if(isEmpty(val))val=x*1;
					}
				}
			}

			return val;
		}
		
		function SetCheckedRadioValue(obj,value) {
			obj = getObjName(obj);
			var els = document.getElementsByName(obj);
			for (var e=0;e<els.length;e++) {
				if (els[e].value==value) els[e].checked = true;
			}
		}
		
		function ClearRadioGroup(group_name) {
			var radio_group = document.getElementsByName(group_name);
			for (var x=0;x<radio_group.length;x++) {
				radio_group[x].checked = false;
			}
		}
	//END GET OBJECT VALUES FUNCTION


	function getNodeName(obj) {
		if (typeof(obj)=="string") obj = findDOM(obj);
		if (!obj.nodeName)
			return ""
		else
			return obj.nodeName.toLowerCase();
	}

	function getInputType(obj) {
		if (typeof(obj)=="string") obj = findDOM(obj);
		if (!obj.type)
			return ""
		else
			return obj.type.toLowerCase();
	}

	function getObjName(obj) {
		if (typeof(obj)=="string") {
			return obj;
		}

		if (obj.id) {
			if (trim(obj.id)!="") return obj.id;
		}

		if (obj.name) {
			if (trim(obj.name)!="") return obj.name;
		}

		return "";
	}

	function ApplyClassName(obj,clsNm) {
		if (document.createTextNode) {
  			$DOM(obj).className=clsNm;
		}
	}
	
	//DOM STUFF, THESE ADD AND REMOVE ITEMS FROM A OPTION SELECT
		//before is the index number of the option the new one will preceed
		function appendOption(obj,txt,val,before) {
			if (!val) var val = txt;
			if (!before) var before = null;

	  		var elSel = document.getElementById(obj);

	  		var elOptNew = document.createElement('option');
	  		elOptNew.text = txt;
	  		elOptNew.value = val;

			if (isNaN(before) || (before>=elSel.options.length) || (before<0))
				before = null
			else
				before = elSel.options[before];

	  		try {
	    		elSel.add(elOptNew, before); // standards compliant; doesn't work in IE
	  		}
	  		catch(ex) {
				if (before==null)
	    			elSel.add(elOptNew) // IE only
				else
	    			elSel.add(elOptNew, before); // IE only
	  		}
		}

		//index is the index number of the one to remove, if index is -1, it removes all
		//removes the last one by default
		function removeOption(obj,index) {
	  		var elSel = $DOM(obj);

			if (typeof(index)=="undefined") var index = elSel.options.length-1;

	  		for (var i = elSel.options.length - 1; i>=0; i--) {
				if ((i==index) || (index==-1)) {
	      			elSel.remove(i);
	    		}
	  		}
		}
		
		function removeAllOptions(obj) {
			obj = $DOM(obj);
			
			if (obj.options) {
				for (var i = obj.options.length - 1; i>=0; i--) {
					removeOption(obj,i);
				}
			}
		}
		
		function selectAllOptions(obj) {
			obj = $DOM(obj);
			for (var i=0;i<obj.options.length;i++) obj.options[i].selected=true;
		}
		
		function deselectAllOptions(obj) {
			obj = $DOM(obj);
			for (var i=0;i<obj.options.length;i++) obj.options[i].selected=false;
		}
	//END DOM OPTION SELECT FUNCTIONS
	
	function isElement(obj,ElementType) {
		obj = $DOM(obj);
		var type = getNodeName(obj).toString().LCase();
		
		if (type==ElementType.toString().LCase()) {
			return true;
		} else if (type=="input") {
			type = obj.type;
			return (type==ElementType.LCase())
		} else {
			return false;
		}
	}
//END OTHER HELPFUL DOM FUNCTIONS


//GETS ALL ATTRIBUTES OF A GIVEN OBJECT
	function GetAttributes(obj,delimiter) {
		obj = $DOM(obj);
		var res = "";
		if (!delimiter) var delimiter = "\n";

		for (var i=0;i<obj.attributes.length;i++) {
			res += obj.attributes[i].name + "=" + obj.attributes[i].value + delimiter;
		}

		return res;
	}
//END GET ALL ATTRIBUTES


//PRINTS THE CURRENT PAGE
	function PrintThisPage() {printArticle();}
	
	function printArticle() {
		if (window.printPreview) {
			setTimeout('window.printPreview();',200);
		} else if (window.print) {
			setTimeout('window.print();',200);
		} else {
			alert("Print function not working. Click file, Print.")
		}
	}
//END PRINT PAGE


//PASS IN A NUMBER OF ARGUMENTS, THIS LOOPS THROUGH AND ALERTS THE VALUE
	function aE() {
		var str = "";
		for (var i=0;i<aE.arguments.length;i++) {
			str += "<" + aE.arguments[i] + ">\n";
		}
		alert(str)
	}
//END aE()


//CHECKS THE URL OF THE PAGE TO SEE IF IT IS THE PASSED IN ONE
function isPage(page,useCase) {
	var url = window.location.href;
	if (!useCase) {
		page = page.LCase();
		url = url.LCase();
	}

	return (url.contains(page));
}
//END CHECK PAGE

//MAKES THE BORDER OF AN OBJECT OR ITS PARENT BLINK
var BorderBlink_border_settings = [];
var BorderBlink_Save_The_Border_Info = true;
function BorderBlink(obj, count, speed, BlinkParent) {
//SPEED := fast, medium, slow
	var t,el;
	if (!BlinkParent) BlinkParent=false;
	
	if (BlinkParent) el = $DOM(obj).parentNode
	else el = $DOM(obj);
	
	if (BorderBlink_Save_The_Border_Info) {
		BorderBlink_border_settings[0] = el.style.borderBottomColor;
		BorderBlink_border_settings[1] = el.style.borderBottomStyle;
		BorderBlink_border_settings[2] = el.style.borderBottomWidth;
		BorderBlink_border_settings[3] = el.style.borderLeftColor;
		BorderBlink_border_settings[4] = el.style.borderLeftStyle;
		BorderBlink_border_settings[5] = el.style.borderLeftWidth;
		BorderBlink_border_settings[6] = el.style.borderRightColor;
		BorderBlink_border_settings[7] = el.style.borderRightStyle;
		BorderBlink_border_settings[8] = el.style.borderRightWidth;
		BorderBlink_border_settings[9] = el.style.borderTopColor;
		BorderBlink_border_settings[10] = el.style.borderTopStyle;
		BorderBlink_border_settings[11] = el.style.borderTopWidth;
		
		BorderBlink_Save_The_Border_Info = false;
	}
	
	switch (speed.LCase()) {
		case "slow":
			t=750;
			break;
		case "medium":
			t=500;
			break;
		case "fast":
			t=100;
	}
	
	if (count == 0) {
		el.style.borderBottomColor = BorderBlink_border_settings[0];
		el.style.borderBottomStyle = BorderBlink_border_settings[1];
		el.style.borderBottomWidth = BorderBlink_border_settings[2];
		el.style.borderLeftColor = BorderBlink_border_settings[3];
		el.style.borderLeftStyle = BorderBlink_border_settings[4];
		el.style.borderLeftWidth = BorderBlink_border_settings[5];
		el.style.borderRightColor = BorderBlink_border_settings[6];
		el.style.borderRightStyle = BorderBlink_border_settings[7];
		el.style.borderRightWidth = BorderBlink_border_settings[8];
		el.style.borderTopColor = BorderBlink_border_settings[9];
		el.style.borderTopStyle = BorderBlink_border_settings[10];
		el.style.borderTopWidth = BorderBlink_border_settings[11];
		
		BorderBlink_Save_The_Border_Info = true;
		
	} else if ((count % 2) == 0) {
		count--;
		
		el.style.borderWidth="2px";
		el.style.borderColor="red";
		el.style.borderStyle="solid";
		
		setTimeout("BorderBlink(\"" + obj + "\"," + count + ",\"" + speed + "\"," +BlinkParent + ")",t);
		
	} else {
		count--;		
		el.style.borderWidth="0px";
		el.style.borderColor="red";
		el.style.borderStyle="solid";
		
		setTimeout("BorderBlink(\"" + obj + "\"," + count + ",\"" + speed + "\"," +BlinkParent + ")",t);
	}
}

function getTagTextByID(id) {
	var obj = $DOM(id);
	var txt = obj.parentNode.innerHTML.LCase();
	var nn = obj.nodeName.LCase();
	var start, end;
	
	if (typeof(id)!="string") id = (id.id)?id.id:id.name;
	id = id.LCase();
	
	start = txt.indexOf("id=\""+id);
	if (start==-1) start = txt.indexOf("id='"+id);
	if (start==-1) start = txt.indexOf("id="+id);
	if (start==-1) start = txt.indexOf("name=\""+id);
	if (start==-1) start = txt.indexOf("name='"+id);
	if (start==-1) start = txt.indexOf("name="+id);
	
	end = txt.indexOf(">",start) + 1;
	start = txt.lastIndexOf("<"+nn, start);
	
	return obj.parentNode.innerHTML.substring(start, end);
}

function getPropertyTextFromTagText(tt, property) {
	var stopAt;
	property = property.LCase();
	
	if (tt.LCase().indexOf(property+"=")==-1) {
		return "";
	} else {
		tt = tt.substring(tt.LCase().indexOf(property+"=")+property.length+1);
		
		if (tt.charAt(0)!="\"" && tt.charAt(0)!="'") {
			stopAt = tt.indexOf(" ");
			
			if (stopAt==0) stopAt = tt.indexOf(">")
			else if (tt.indexOf(">") < stopAt) stopAt = tt.indexOf(">");
			
			if (stopAt==0) stopAt = tt.indexOf("/")
			else if (tt.indexOf("/") < stopAt) stopAt = tt.indexOf("/");
			
			delimiter = tt.charAt(stopAt);
			tt = " "+tt;
		}
		else delimiter = tt.charAt(0);
		
		return tt.substring(1, tt.indexOf(delimiter, 1)).trim();
	}
}

//RETURNS THE DOCUMENT OBJ OF SOURCE OF AN IFRAME - CROSS BROWSER
function IFrameDocument(name) {
	var frm = document.getElementById(name);
	var doc = (frm.contentWindow || frm.contentDocument);
	if (doc.document) doc = doc.document;
	return doc;
}

//ADDS A NEW SCRIPT SOURCE TO THE HEADER OF AN HTML DOCUMENT
function AddJSLibrary(fname) {
	var th = document.getElementsByTagName('head')[0];
	var s = document.createElement('script');
	s.setAttribute('type','text/javascript');
	s.setAttribute('src',fname);
	head.appendChild(s);
}

function HasScriptLibrary(filename) {
	var HasLib = false;
	var scrs = document.getElementsByTagName('script');
	var i = 0;
	while (!HasLib && i < scrs.length) {
		HasLib = (scrs[i].src.toString().toLowerCase().indexOf(filename)!=-1);
		i++;
	}
	return HasLib;
}


//A JAVASCRIPT COLLECTION
	function Collection() {
		this.items = [];
		this.keys = [];
	}

	Collection.prototype.add = function(item, key) {
		this.items.push(item);
		this.keys.push(key);
	}

	Collection.prototype.count = function() {
		return items.length - 1;
	}

	Collection.prototype.item = function(index) {
		if (typeof index=="integer") {
			return items[index];
		} else {
			for (var i=0; i<this.keys.length; i++) {
				if (this.keys[i]==index.toString()) return this.items[i];
			}
		}
		return null;
	}
//END COLLECTION