//<!--
//<Script language="javascript" type="text/javascript">

	//somehow this (and the one below) function mysteriously disappeared from here. AlexK 04/23/2002
	function returnAllAlphaNumericsString()
	{
		return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
	}

	function validateExclusiveStringInput(strInput, strOnlyCharactersAllowed)
	{
		var strCurChar = "";

		if (strOnlyCharactersAllowed == "")
		{
			return false;
		}

		for (var i = 0; i < strInput.length; ++i)
		{
			strCurChar = strInput.substring(i, i + 1);
			if (strOnlyCharactersAllowed.indexOf(strCurChar) == -1)
			{
				return false;
			}
		}

		// if we made it this far, all characters in strInput
		// where present in strOnlyCharactersAllowed
		return true;
	}

	function rTrimJS(str)
	{
		if (str.charAt(str.length - 1) == " ")
		{
			// trim the right-most character - it is a space
			return str.substring(0, str.length - 1);
		}
		else
		{
			// just return the original value
			return str;
		}
	}

	// return the substring numbered intSubStrNum from the entire string,
	// where all substrings are demarcated by the given delimiter char -
	function getNthSubStrFromStrJS(strEntire, chrDelimiter, intSubStrNum)
	{
		var intPos = 0;
		var intEndingDelimiterPos;
		var strWorking;

		// prepare a working string from the given entire string,
		// ensuring that it starts and ends with the given delimiter char
		strWorking = strEntire;

		if (strWorking.charAt(0) != chrDelimiter)
		{
			strWorking = "" + chrDelimiter + strWorking;
		}
		if (strWorking.charAt(strWorking.length - 1) != chrDelimiter)
		{
			strWorking = strWorking + chrDelimiter;
		}

		// keep successively hacking off the working string right after
		// each next starting delimiter postion found
		for (i = 0; i < intSubStrNum; ++i)
		{
			intPos = strWorking.indexOf(chrDelimiter);
			strWorking = strWorking.substring(intPos + 1);
		}

		// find the endinging delimiter postion for the given intSubStrNum
		intEndingDelimiterPos = strWorking.indexOf(chrDelimiter);

		// now we can return the proper substring
		return strWorking.substring(0, intEndingDelimiterPos);
	}

	// Add any single quotes or percent signs needed to allow the
	// given string to be inserted or updated in the database.
	// Returns the "prepared" string.
	function prepStringForDB(strRaw)
	{
		var strPrepared
		var strSavedBeginning;
		var strSavedEnding;
		var strWorking;
		var strSubStr;
		var intSubStrNum;
		var intPos = 0;
		var intPrevPos = 0;
		var chrSingleQuote = "'";
		var chrPercentSign = "%";

		if (strRaw == "")
		{
			return "";
		}

		// take care of single quotes
		/////////////////////////////

		strPrepared = strRaw;
		strWorking = "";
		// need special handling if given string starts or ends with one of the searched for characters,
		// because the helper function being called below (getNthSubStrFromStrJS) will not handle these special cases
		strSavedBeginning = "";
		strSavedEnding = "";
		if (strPrepared.charAt(0) == chrSingleQuote)
		{
			strSavedBeginning = chrSingleQuote + chrSingleQuote;
		}
		if (strPrepared.charAt(strPrepared.length - 1) == chrSingleQuote)
		{
			strSavedEnding = "''";
		}
		intSubStrNum = 1;
		strSubStr = getNthSubStrFromStrJS(strRaw, chrSingleQuote, intSubStrNum)
		while (strSubStr != "")
		{
			// build the working string, concatenating each substring with two single quotes in between
			strWorking = strWorking + strSubStr + chrSingleQuote + chrSingleQuote;
			++intSubStrNum;
			strSubStr = getNthSubStrFromStrJS(strPrepared, chrSingleQuote, intSubStrNum);
		}

		// remove the extra two single quotes that will be present at the end of the working string
		strWorking = strWorking.substr(0, strWorking.length - 2);

		strWorking = strSavedBeginning + strWorking + strSavedEnding;


		// take care of percent signs
		/////////////////////////////

		strPrepared = strWorking;
		strWorking = "";
		// need special handling if given string starts or ends with one of the searched for characters,
		// because the helper function being called below (getNthSubStrFromStrJS) will not handle these special cases
		strSavedBeginning = "";
		strSavedEnding = "";
		if (strPrepared.charAt(0) == chrPercentSign)
		{
			strSavedBeginning = chrPercentSign + chrPercentSign;
		}
		if (strPrepared.charAt(strPrepared.length - 1) == chrPercentSign)
		{
			strSavedEnding = chrPercentSign + chrPercentSign;
		}
		intSubStrNum = 1;
		strSubStr = getNthSubStrFromStrJS(strPrepared, chrPercentSign, intSubStrNum)
		while (strSubStr != "")
		{
			// build the working string, concatenating each substring with two percent signs in between
			strWorking = strWorking + strSubStr + chrPercentSign + chrPercentSign;
			++intSubStrNum;
			strSubStr = getNthSubStrFromStrJS(strPrepared, chrPercentSign, intSubStrNum);
		}
		// remove the extra two percent signs that will be present at the end of the working string
		strWorking = strWorking.substr(0, strWorking.length - 2);
		strWorking = strSavedBeginning + strWorking + strSavedEnding;

		return strWorking;
	}

	// Make sure the input is >= a minimum length, <= a max length,
	// and not in the array of specified disallowed values.  Also no "substrings" can be present from
	// the "partial not allowed" array. If all conditions are met, return empty string.  If any are not met,
	// return a string containing reason(s) why not.
	function validateStringInput(strInput, intMinLength, intMaxLength, strarrInputNotAllowed, strarrPartialNotAllowed)
	{
		var strRtnErrors = "";
		var i = 0;
		var strThingDisallowed = "";


		if (strInput.length < intMinLength)
		{
			strRtnErrors = strRtnErrors + "Input length must be at least " + (intMinLength ) + " characters long." + "\n";
		}

		if (strInput.length > intMaxLength)
		{
			strRtnErrors = strRtnErrors + "Input length must be no more than than " + (intMaxLength) + " characters long." + "\n";
		}

		for (i = 0; i < strarrInputNotAllowed.length; ++i)
		{
			strThingDisallowed = strarrInputNotAllowed[i];
			if (strThingDisallowed != "")
			{
				if (strInput == strarrInputNotAllowed[i])
				{
					strRtnErrors = strRtnErrors + "This input is not permitted: " + strarrInputNotAllowed[i] + "\n";
				}
			}
		}

		for (i = 0; i < strarrPartialNotAllowed.length; ++i)
		{
			strThingDisallowed = strarrPartialNotAllowed[i];
			if (strThingDisallowed != "")
			{
				if (strInput.indexOf(strarrPartialNotAllowed[i]) != -1)
				{
					strRtnErrors = strRtnErrors + "These characters are not permitted: " + strarrPartialNotAllowed[i] + "\n";
				}
			}
		}

		return strRtnErrors;
	}

	// Return true if the input represents an integer value or false if it does not.
	function validateIntegerInput(strInput)
	{
		var strAllDigits = "0123456789";
		var strDigit = "";

		if (strInput == "")
		{
			return false;
		}

		for (var i = 0; i < strInput.length; ++i)
		{
			strDigit = strInput.substring(i, i + 1);
			if (strAllDigits.indexOf(strDigit) == -1)
			{
				return false;
			}
		}

		// if we made it this far, it is an integer
		//  (i.e. whole number - no garuantee on overflow)
		return true;
	}

	function validateDate_MmDdYYyy(strInput)
	{
		var chrDelimiter = "/";
		var intSubStrNum = 1;
		var strSubString;
		var intLoop = 0;
		var strSubStringLength;
		var val = 0;

		strSubString = getNthSubStrFromStrJS(strInput, chrDelimiter, intSubStrNum);
		while (strSubString != "")
		{
			if (!validateIntegerInput(strSubString))
			{
				return false;
			}

			strSubStringLength = strSubString.length;
			++intLoop;
			val = parseInt(strSubString, 10);
			
			if (intLoop == 1)
			{
				if (strSubStringLength > 2)
				{
					return false;
				}
				else if (val > 12)
				{
					return false;
				}
				else if (val < 1)
				{
					return false;
				}
				
			}
			else if (intLoop == 2)
			{
				if (strSubStringLength > 2)
				{
					return false;
				}
				else if (val > 31)
				{
					return false;
				}
				else if (val < 1)
				{
					return false;
				}
				
			}
			else if (intLoop == 3)
			{
	//			if (strSubStringLength > 4)
	//			{
	//				return false;
	//			}
				if (strSubStringLength < 4)
				{
					return false;
				}
				
			}
		
			++intSubStrNum;
			strSubString = rTrimJS(getNthSubStrFromStrJS(strInput, chrDelimiter, intSubStrNum));
			
		}
		
		if (intLoop != 3)
		{
			return false;
		}

		// if we got this far then a valid date (format = MmDdYYyy) was entered
		return true;

	}

	// This function takes two date strings of format mm/dd/yyyy and compares them
	// Returns 0 if they are equal, returns -1 if first date is prior to second and
	// returns 1 if first date is after second date. This function assumes that
	// the date strings are passed in correct format. No validation is done.
	function compareDates(strDate1,strDate2)
	{
		var y1 = 0;
		var m1 = 0;
		var d1 = 0;
		var y2 = 0;
		var m2 = 0;
		var d2 = 0;
		var myTemp = 0;


		var chrDelimiter = "/";
		var intSubStrNum = 1;
		var strSubString;
		var intLoop = 0;
		var strSubStringLength;

		strSubString = getNthSubStrFromStrJS(strDate1, chrDelimiter, intSubStrNum);
		while (strSubString != "")
		{
			myTemp=0;
			if (intLoop == 0) {myTemp = parseInt(strSubString, 10);
						m1 = myTemp;}
			if (intLoop == 1) {myTemp = parseInt(strSubString, 10);
						d1 = myTemp;}
			if (intLoop == 2) {myTemp = parseInt(strSubString, 10);
						y1 = myTemp;}
			++intLoop;
			++intSubStrNum;
			strSubString = getNthSubStrFromStrJS(strDate1, chrDelimiter, intSubStrNum);
		}
		intLoop = 0;
		myTemp = 0;
		intSubStrNum = 1;
		strSubString = getNthSubStrFromStrJS(strDate2, chrDelimiter, intSubStrNum);
		while (strSubString != "")
		{
			myTemp = 0;
			if (intLoop == 0) {myTemp = parseInt(strSubString, 10);
						m2 = myTemp;}
			if (intLoop == 1) {myTemp = parseInt(strSubString, 10);
						d2 = myTemp;}
			if (intLoop == 2) {myTemp = parseInt(strSubString, 10);
						y2 = myTemp;}
			++intLoop;
			++intSubStrNum;
			strSubString = getNthSubStrFromStrJS(strDate2, chrDelimiter, intSubStrNum);
		}
		//alert("*"+m1+","+d1+","+y1+","+m2+","+d2+","+y2);
		if (y1 > y2) return(1);
		if (y1 < y2) return(-1);
		if (y1 == y2)
		{

			if (m1 > m2) return(1);

			if (m1 < m2) return(-1);

			if (m1 == m2)
			{
			 	if (d1 > d2) return(1);
				if (d1 < d2) return(-1);
				if (d1 == d2) return(0);
			}
		}

	}


	function validatePhone_999_999_9999(strInput)
	{
		var chrDelimiter = "-";
		var intSubStrNum = 1;
		var strSubString;
		var intLoop = 0;
		var strSubStringLength;

		strSubString = getNthSubStrFromStrJS(strInput, chrDelimiter, intSubStrNum);
		while (strSubString != "")
		{
			if (!validateIntegerInput(strSubString))
			{
				return false;
			}

			strSubStringLength = strSubString.length;
			++intLoop;
			if (intLoop == 1)
			{
				if (strSubStringLength != 3)
				{
					return false;
				}
			}
			else if (intLoop == 2)
			{
				if (strSubStringLength != 3)
				{
					return false;
				}
			}
			else if (intLoop == 3)
			{
				if (strSubStringLength != 4)
				{
					return false;
				}
			}

			++intSubStrNum;
			strSubString = getNthSubStrFromStrJS(strInput, chrDelimiter, intSubStrNum);
		}

		if (intLoop != 3)
		{
			return false;
		}

		// if we got this far then a valid phone number (format = 999-999-9999) was entered
		return true;
	}

	// Make sure that the proposed email is in format "x@y.zz" (minimum), meaning that:
	// 1) there are at least 6 characters
	// 2) the @ symbol is present
	// 3) a period or "dot" is present after the @ symbol
	// 4) there are a proper minimum number of intervening characters between and around the symbols
	// Returns true if successful validation, false if not.
	function validateEmail(emailStr)
	{
		if (emailStr.length == 0) {
		   return true;
		}
		var emailPat=/^(.+)@(.+)$/;
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
		var validChars="\[^\\s" + specialChars + "\]";
		var quotedUser="(\"[^\"]*\")";
		var ipDomainPat=/^(\d{1,3})[.](\d{1,3})[.](\d{1,3})[.](\d{1,3})$/;
		var atom=validChars + '+';
		var word="(" + atom + "|" + quotedUser + ")";
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
		var domainPat=new RegExp("^" + atom + "(\\." + atom + ")*$");
		var matchArray=emailStr.match(emailPat);
		if (matchArray == null) {
		   return false;
		}
		var user=matchArray[1];
		var domain=matchArray[2];
		if (user.match(userPat) == null) {
		   return false;
		}
		var IPArray = domain.match(ipDomainPat);
		if (IPArray != null) {
		   for (var i = 1; i <= 4; i++) {
		      if (IPArray[i] > 255) {
			 return false;
		      }
		   }
		   return true;
		}
		var domainArray=domain.match(domainPat);
		if (domainArray == null) {
		   return false;
		}
		var atomPat=new RegExp(atom,"g");
		var domArr=domain.match(atomPat);
		var len=domArr.length;
		if ((domArr[domArr.length-1].length < 2) ||
		   (domArr[domArr.length-1].length > 4)) {
		   return false;
		}
		if (len < 2) {
		   return false;
		}
		return true;
	}

	// Make sure that the proposed email is in format "x@y.zz" (minimum), meaning that:
	// 1) there are at least 6 characters
	// 2) the @ symbol is present
	// 3) a period or "dot" is present after the @ symbol
	// 4) there are a proper minimum number of intervening characters between and around the symbols
	// Returns non-empty msg string if problem, else returns empty string if successful validation.
	function validateEmailRtnMsg(strInput)
	{
		var intAtPos = 0;
		var intDotPos = 0;
		var chrAtSymbol = "@";
		var chrDotSymbol = "."
		var strWorking = "";
		var intActualDotPos = 0;

		var strRtnProblem = "";

		if (strInput.indexOf(" ") != -1)
		{
			strRtnProblem = "Spaces are not allowed in an email address.";
			return strRtnProblem;
		}

		if (strInput.length < "x@y.zz".length)
		{
			strRtnProblem = "There is an insufficient number of characters with which to represent a valid email address.";
			return strRtnProblem;
		}

		intAtPos = strInput.indexOf(chrAtSymbol);
		if (intAtPos == -1)
		{
			strRtnProblem = "No \"@\" symbol found.";
			return strRtnProblem;
		}

		strWorking = strInput.substring(intAtPos + 1)
		intDotPos = strWorking.indexOf(chrDotSymbol);
		if (intDotPos <=0 )
		{
			strRtnProblem = "The \".\" symbol is missing or out of place.";
			return strRtnProblem;
		}

		// make sure that the found characters have the minumum number of intervening characters
		if (intAtPos == 0)
		{
			strRtnProblem = "Missing characters prior to the \"@\" symbol.";
			return strRtnProblem;
		}
		intActualDotPos = intAtPos + intDotPos + 1;
		if (intActualDotPos - intAtPos < 1)
		{
			strRtnProblem = "An insufficient number of characters exist between the \"@\" symbol and the \".\" symbol.";
			return strRtnProblem;
		}
		if (strInput.length - (intActualDotPos + 1) < 2)
		{
			strRtnProblem = "Insufficient number of characters after the \".\" symbol.";
			return strRtnProblem;
		}
		var strarrEmailParts = strInput.split("@");
		if (strarrEmailParts.length > 2)
		{
			strRtnProblem = "The E-mail address is not valid as it contains more than one \"@\" symbol.";
			return strRtnProblem;
		}
		//else
		//{
		//	var strarrEmailParts = strInput.split(".");
		//}
		//if (strarrEmailParts.length > 2)
		//{
		//	strRtnProblem = "The E-mail address is not valid as it contains more than one \".\" symbol.";
		//	return strRtnProblem;	
		//}
		
		// if we got this far then a valid email address (minimum format = x@y.zz) was entered
		return strRtnProblem;
	}

	function prepXPlatDocSyntax(strID)
	{
		// Note: This function is intended to be used to feed the
		//       javascript eval statement in an effort to achieve
		//       cross platform compatability between the two major
		//       browser camps, I.E. and Netscape.

		if (window.navigator.userAgent.indexOf("MSIE")!= -1)
		{
			// this is I.E.
			return "document.all(\"" + strID + "\")";
		}
		else
		{
			// assume this is Netscape since it is not I.E.
			return "document.forms[0]." + strID;
		}
	}

	function prepXPlatDocSyntaxForm1(strID)
	{
		// Note: This function is intended to be used to feed the
		//       javascript eval statement in an effort to achieve
		//       cross platform compatability between the two major
		//       browser camps, I.E. and Netscape.

		if (window.navigator.userAgent.indexOf("MSIE")!= -1)
		{
			// this is I.E.
			return "document.all(\"" + strID + "\")";
		}
		else
		{
			// assume this is Netscape since it is not I.E.
			return "document.forms[1]." + strID;
		}
	}


	function prepXPlatDocSyntaxForm2(strID)
	{
		// Note: This function is intended to be used to feed the
		//       javascript eval statement in an effort to achieve
		//       cross platform compatability between the two major
		//       browser camps, I.E. and Netscape.

		if (window.navigator.userAgent.indexOf("MSIE")!= -1)
		{
			// this is I.E.
			return "document.all(\"" + strID + "\")";
		}
		else
		{
			// assume this is Netscape since it is not I.E.
			return "document.forms[2]." + strID;
		}
	}
	
	function prepXPlatDocSyntaxForm3(strID)
	{
		// Note: This function is intended to be used to feed the
		//       javascript eval statement in an effort to achieve
		//       cross platform compatability between the two major
		//       browser camps, I.E. and Netscape.

		if (window.navigator.userAgent.indexOf("MSIE")!= -1)
		{
			// this is I.E.
			return "document.all(\"" + strID + "\")";
		}
		else
		{
			// assume this is Netscape since it is not I.E.
			return "document.forms[3]." + strID;
		}
	}

	function prepXPlatDocImgSyntax(strNameID)
	{
		// Note: This function is intended to be used to feed the
		//       javascript eval statement in an effort to achieve
		//       cross platform compatability between the two major
		//       browser camps, I.E. and Netscape.

		if (window.navigator.userAgent.indexOf("MSIE")!= -1)
		{
			// this is I.E.
			return "document.all(\"" + strNameID + "\")";
		}
		else
		{
			// assume this is Netscape since it is not I.E.
			return "document.images['" + strNameID + "']";
		}
	}

	function prepXPlatStyleSyntax(strID)
	{
		// Note: This function is intended to be used to feed the
		//       javascript eval statement in an effort to achieve
		//       cross platform compatability between the two major
		//       browser camps, I.E. and Netscape.

		if (window.navigator.userAgent.indexOf("MSIE")!= -1)
		{
			// this is I.E.
			return prepXPlatDocSyntax(strID) + ".style";
		}
		else
		{
			// assume this is Netscape since it is not I.E.
			return prepXPlatDocSyntax(strID);
		}
	}



	// name - name of the cookie
	// value - value of the cookie
	// [expires] - expiration date of the cookie (defaults to end of current session)
	// [path] - path for which the cookie is valid (defaults to path of calling document)
	// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
	// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
	// * an argument defaults when it is assigned null as a placeholder
	// * a null placeholder is not required for trailing omitted arguments
	function setCookie(name, value, expires, path, domain, secure) {
	  var curCookie = name + "=" + escape(value) +
	      ((expires) ? "; expires=" + expires.toGMTString() : "") +
	      ((path) ? "; path=" + path : "") +
	      ((domain) ? "; domain=" + domain : "") +
	      ((secure) ? "; secure" : "");
	  document.cookie = curCookie;
	}

	// name - name of the desired cookie
	// * return string containing value of specified cookie or null if cookie does not exist
	function getCookie(name) {
	  var dc = document.cookie;
	  var prefix = name + "=";
	  var begin = dc.indexOf("; " + prefix);
	  if (begin == -1) {
	    begin = dc.indexOf(prefix);
	    if (begin != 0) return null;
	  } else
	    begin += 2;
	  var end = document.cookie.indexOf(";", begin);
	  if (end == -1)
	    end = dc.length;
	  return unescape(dc.substring(begin + prefix.length, end));
	}

	// name - name of the cookie
	// [path] - path of the cookie (must be same as path used to create cookie)
	// [domain] - domain of the cookie (must be same as domain used to create cookie)
	// * path and domain default if assigned null or omitted if no explicit argument proceeds
	function deleteCookie(name, path, domain) {
	  if (getCookie(name)) {
	    document.cookie = name + "=" + 
	    ((path) ? "; path=" + path : "") +
	    ((domain) ? "; domain=" + domain : "") +
	    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	  }
	}
//-->
//</Script>