<!--
	// VARIABLE DECLARATIONS
	var digits = "0123456789"
	var lowercaseLetters = "abcdefghijklmnopqrstuvwxyz"
	var uppercaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	var whitespace = " \t\n\r";
	var pEntryPrompt = "Please enter the following information: "

	// non-digit characters which are allowed in credit card numbers
	var creditCardDelimiters = " "

	// CONSTANT STRING DECLARATIONS
	// m is an abbreviation for "missing"
	var mPrefix = "Please Enter the following field: "
	var mSuffix = "    This is a compulsary field."
	
	
	// Determines if empty fields are acceptable
	var defaultEmptyOK = false


	// Check whether string s is empty.
	function isEmpty(s) 
	{
	    return ((s == null) || (s.length == 0));
	}

	// Returns true if string s is empty or 
	// whitespace characters only.
	function isWhitespace (s) 
	{
		var i;

		// Is s empty?
		if (isEmpty(s)) return true;

		// Search through string's characters one by one
		// until we find a non-whitespace character.
		// When we do, return false; if we don't, return true.
		for (i = 0; i < s.length; i++)
		{   
			// Check that current character isn't whitespace.
			var c = s.charAt(i);

			if (whitespace.indexOf(c) == -1) return false;
		}

		// All characters are whitespace.
		return true;
	}

	// Removes all characters which appear in string bag from string s.
	function stripCharsInBag (s, bag) 
	{
		var i;
		var returnString = "";

		// Search through string's characters one by one.
		// If character is not in bag, append to returnString.
		for (i = 0; i < s.length; i++)
		{
			// Check that current character isn't whitespace.
			var c = s.charAt(i);
			if (bag.indexOf(c) == -1) returnString += c;
		}

		return returnString;
	}

	// Removes all whitespace characters from s.
	// Global variable whitespace (see above)
	// defines which characters are considered whitespace.
	function stripWhitespace (s)
	{
	    return stripCharsInBag (s, whitespace);
	}

	// Workaround for bug in Navigator 2.02
	function charInString (c, s)
	{   for (i = 0; i < s.length; i++)
		{   if (s.charAt(i) == c) return true;
		}
		return false
	}

	// Removes initial (leading) whitespace characters from s.
	// Global variable whitespace (see above)
	// defines which characters are considered whitespace.
	function stripInitialWhitespace (s)
	{   var i = 0;

		while ((i < s.length) && charInString (s.charAt(i), whitespace))
		   i++;

		return s.substring (i, s.length);
	}

	function isEmail (s) 
	{
	    if (isEmpty(s))
		   if (isEmail.arguments.length == 1) return defaultEmptyOK;
		   else return (isEmail.arguments[1] == true);

		// is s whitespace?
		if (isWhitespace(s)) return false;

		// there must be >= 1 character before @, so we
		// start looking at character position 1
		// (i.e. second character)
		var i = 1;
		var sLength = s.length;

		// look for @
		while ((i < sLength) && (s.charAt(i) != "@"))
		{ i++
		}

		if ((i >= sLength) || (s.charAt(i) != "@")) return false;
		else i += 2;

		// look for .
		while ((i < sLength) && (s.charAt(i) != "."))
		{ i++
		}

		// there must be at least one character after the .
		if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
		else return true;
	}

	// Display prompt string s in status bar.
	function prompt (s)
	{   window.status = s
	}

	// Display data entry prompt string s in status bar.
	function promptEntry (s)
	{   window.status = pEntryPrompt + s
	}

	function warnEmpty (theField, s)
	{
		/*var result = " ";
		var property = "";
		for (curProperty in theField) {
		  property = eval("theField." + String(curProperty));
		  result = curProperty + ": " + String(property);
		  alert(result);	
		}*/
	    theField.focus()
		alert(mPrefix + "\n\n\t" + s + "\n\n" + mSuffix)
		return false
	}

	function warnInvalid (theField, s)
	{   theField.focus()
		//theField.select()
		alert(s)
		return false
	}

	// Check that string theField.value is not all whitespace.
	function checkString (theField, s, emptyOK)
	{   // Make sure the field exists before completing the test
	
		if (theField == null) return true;
		// Next line is needed on NN3 to avoid "undefined is not a number" error
		// in equality comparison below.
		if (checkString.arguments.length == 2) emptyOK = defaultEmptyOK;
		if ((emptyOK == true) && (isEmpty(theField.value))) return true;
		
		if ((theField.type == "text") ||(theField.type == "hidden") ||(theField.type == "password") ||
		    (theField.type == "textarea") ||(theField.type == "radio") ||(theField.type == "checkbox") )
		{
			if (isWhitespace(theField.value))
			   return warnEmpty (theField, s);
			else return true;
		}
		else
		{
			if (isWhitespace(theField.options[theField.selectedIndex].value))
			   return warnEmpty (theField, s);
			else return true;
		}
	}




	// Check that string theField.value is a valid Email.
	function checkEmail (theField, s, emptyOK)
	{   if (checkEmail.arguments.length == 1) emptyOK = defaultEmptyOK;
		if ((emptyOK == true) && (isEmpty(theField.value))) return true;
		else if (!isEmail(theField.value, false))
		   return warnInvalid (theField, iEmail);
		else return true;
	}

      //Double Check Email Address
	  function validateEmail (theField1, theField2)
	{	var s1 = "";
              var s2 = "";
              if (theField2 == null) return true;
                  s1 = stripWhitespace(theField1.value);
                  s2 = stripWhitespace(theField2.value);
                  if (s1 == s2) return true;
                  return warnInvalid(theField2, iConfirmEmail);
      }
	  





//-->


