	

	//TODO (LH) these 2 methods should be placed in a common javascript util file...  I ripped em out of CarsGuide dealer_request.jsp and adjusted slightly
	function restrictNumbersOnly(keyEvent)
	{
		var charCode = (keyEvent.charCode) ? keyEvent.charCode : ((keyEvent.keyCode) ? keyEvent.keyCode : ((keyEvent.which) ? keyEvent.which : 0));
		if ((charCode >= 48 && charCode <= 57) //between 0 and 9
			|| charCode == 46 //Delete
			|| charCode == 8 //Backspace
			|| charCode == 9 //Tab
			|| charCode == 37 //Left Arrow
			|| charCode == 39) //Right Arrow
		{
			return true;
		}
		return false;
	}

    //Function to check whether the given String is of a particular length between the minimum value min and the maximum value max 
	function isValidLength(string, min, max)
	{
		if (string.length >= min && string.length <= max) 
			return true;
		return false;
	}

	
	//Function that removes the leading and trailing white spaces from a string.
	function trim(string) {
		var newString  = '';
		var substring  = '';
		beginningFound = false;

		// copy characters retaining whitespace present inbetween the string
		for (var i = 0; i < string.length; i++) {
	  
			// transfering non-whitespace characters
			if (string.charAt(i) != ' ' && string.charCodeAt(i) != 9) {
		 
				// transfering  the whitespace characters of the temporary string
				if (substring != '') {
					newString += substring;
					substring = '';
				}
				newString += string.charAt(i);
				if (beginningFound == false)
					 beginningFound = true;
			}else 
				if (beginningFound == true)
					 substring += string.charAt(i); //forming the string to syntax.
		}
		return newString;
	}

   
