
	var sYou ="Your Name"
	var sEmail_you = "Your Email"
	var sFrend = "Friend Name"
	var sEmail_frend ="Friend Email"
	var iEmail = "The E-mail Address field must be a valid email address (e.g. name@domain.com). Please re-enter it now."
	
	function Reservation_Form_Validator( theForm )
	{  		
	

		var Response = false
		Response = (	
						
						checkString(theForm.elements["you"],sYou) &&
						checkString(theForm.elements["email_you"],sEmail_you) &&
						checkEmail(theForm.elements["email_you"]) &&
						checkString(theForm.elements["frend"],sFrend) &&
						checkString(theForm.elements["email_frend"],sEmail_frend) &&
						checkEmail(theForm.elements["email_frend"])
					

		  			)
					
					
	return (Response);						
	}

/////////////////////////////////////////////////////////////////////////////////////


	var whitespace = " \t\n\r";
	var pEntryPrompt = "Please enter the following information: "
	var mPrefix = "Please Enter the following field: "
	var mSuffix = "    This is a compulsory field."
	var defaultEmptyOK = false

	function isEmpty(s) 
	{
	    return ((s == null) || (s.length == 0));
	}


	function isWhitespace (s) 
	{
		var i;


		if (isEmpty(s)) return true;


		for (i = 0; i < s.length; i++)
		{   

			var c = s.charAt(i);

			if (whitespace.indexOf(c) == -1) return false;
		}


		return true;
	}


	function stripCharsInBag (s, bag) 
	{
		var i;
		var returnString = "";

		for (i = 0; i < s.length; i++)
		{

			var c = s.charAt(i);
			if (bag.indexOf(c) == -1) returnString += c;
		}

		return returnString;
	}


	function stripWhitespace (s)
	{
	    return stripCharsInBag (s, whitespace);
	}


	function charInString (c, s)
	{   for (i = 0; i < s.length; i++)
		{   if (s.charAt(i) == c) return true;
		}
		return false
	}


	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);


		if (isWhitespace(s)) return false;

		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)
	{

	    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;
	}





