	function TrimLeft( strData ) {
		var zz;
		for ( zz=0; zz<strData.length; zz++ )
		{
			if ( strData.charAt(zz) != " " )
				return strData.substr( zz );
		}
		return "";
	}

	function TrimRight( strData ) {
		var zz;
		for ( zz=strData.length-1; zz>= 0; zz-- )
		{
			if ( strData.charAt(zz) != " " )
				return strData.substr( 0, zz+1 );
		}
		return "";
	}

	function Trim( strData ) {
		return TrimLeft( TrimRight( strData ) );
	}

	function TrimInt(intValue, trimValue) {
		var vNumber = new String(intValue);
		var index;
		var newNumber= new String(vNumber);
		for (index=0;index<vNumber.length;index++) {
			if (vNumber.charAt(index) == trimValue)
				newNumber = vNumber.substr(index + 1, newNumber.length - 1);
			else
				break;			
			}
		return newNumber;
	}
	
	function IsInt( strData ) {
		if ( isNaN( Trim( strData ) ) ) return false;
		var intValue = parseInt( strData );
		if ( isNaN( intValue ) ) return false;
		var fltValue = parseFloat( strData );
		if ( isNaN( fltValue ) ) return false;
		if ( intValue != fltValue ) return false;
		return true;
	}

	function IsFloat( strData ) {
		if ( isNaN( Trim( strData ) ) ) return false;
		var fltValue = parseFloat( strData );
		if ( isNaN( fltValue ) ) return false;
		return true;
	}

	function ValidateInt( oField, intMin, intMax, strMessage ) {
		var strData = Trim( oField.value );
		oField.value = strData;
		if ( !IsInt( strData ) ){
			oField.select();
			oField.focus();
			alert( strMessage );
			return false;
		}

		strData = parseInt( strData );
		oField.value = strData;
		if ( strData < intMin || strData > intMax ) {
			oField.select();
			oField.focus();
			alert( strMessage );
			return false;
		}
		
		return true;
	}

	function ValidateFloat( oField, intMin, intMax, strMessage ) {
		var strData = Trim( oField.value );
		oField.value = strData;
		if ( !IsFloat( strData ) ){
			oField.select();
			oField.focus();
			alert( strMessage );
			return false;
		}

		strData = parseFloat( strData );
		oField.value = strData;
		if ( strData < intMin || strData > intMax ) {
			oField.select();
			oField.focus();
			alert( strMessage );
			return false;
		}
		
		return true;
	}

	function InputFieldFilter( strOldString ) {
		// Replace Double Quotes ["] with char 227
		var strNewString = Trim( strOldString.replace( /\"/g, String.fromCharCode( 227 ) ) )

		// Replace Single Quotes ['] with char 228 with char 254,'039', char 255
		strNewString = Trim( strNewString.replace( /\'/g, String.fromCharCode(254) + "039" + String.fromCharCode(255)))

		// Replace Dash [-] with char 254,'151', char 255
		strNewString = Trim(strNewString.replace( /-/g, String.fromCharCode(254) + "151" + String.fromCharCode(255)))
		
		// Replace Comma [,] with char 254,'044', char 255
		strNewString = Trim(strNewString.replace( /\,/g, String.fromCharCode(254) + "044" + String.fromCharCode(255)))
		
		// Replace Space with char 254,'032', char 255 
		strNewString = Trim(strNewString.replace( / /g, String.fromCharCode(254) + "032" + String.fromCharCode(255)))
		
		// Replace Percent [%] with char 254,'037', char 255  
		strNewString = Trim(strNewString.replace( /%/g, String.fromCharCode(254) + "037" + String.fromCharCode(255)))
		
		// Replace Ampersand [&] with char 254,'038', char 255  
		strNewString = Trim(strNewString.replace( /&/g, String.fromCharCode(254) + "038" + String.fromCharCode(255)))
		
		// Replace Left Parentheses [(] with char 254,'040', char 255  
		strNewString = Trim(strNewString.replace( /\(/g, String.fromCharCode(254) + "040" + String.fromCharCode(255)))
		
		// Replace Right Parentheses [)] with char 254,'041', char 255  
		strNewString = Trim(strNewString.replace( /\)/g, String.fromCharCode(254) + "041" + String.fromCharCode(255)))
		
		// Replace Period [.] with char 254,'046', char 255
		strNewString = Trim(strNewString.replace( /\./g, String.fromCharCode(254) + "046" + String.fromCharCode(255)))
		
		// Replace Forward Slash [/] with char 254,'047', char 255
		strNewString = Trim(strNewString.replace( /\//g, String.fromCharCode(254) + "047" + String.fromCharCode(255)))
		
		// Replace Asterick [*] with char 254,'042', char 255
		strNewString = Trim(strNewString.replace( /\*/, String.fromCharCode(254) + "042" + String.fromCharCode(255)))
		
		// Replace Question Mark [?] with char 254,'063', char 255
		strNewString = Trim(strNewString.replace( /\?/, String.fromCharCode(254) + "063" + String.fromCharCode(255)))
		
		// Replace Exclamation Point [!] with char 254,'033', char 255
		strNewString = Trim(strNewString.replace( /\!/, String.fromCharCode(254) + "033" + String.fromCharCode(255)))

		return strNewString;
	}

	function InputFieldDeFilter( strOldString ) {

		// Replace char 227 with Double Quotes ["]
		var reFind = new RegExp( "\xE3", "g" );
		var strNewString = Trim( strOldString.replace( reFind, '"' ) )

		// Replace char 228 with Single Quotes [']
		reFind = new RegExp( "\xE4", "g" );
		strNewString = Trim( strNewString.replace( reFind, "'" ) )
		
		// Replace char 254,'039', char 255 with Single Quotes [']
		strNewString = Trim( strNewString.replace( /\xFE039\xFF/g, "'"))
		
		// Replace char 254,'151', char 255 with Dash [-]
		strNewString = Trim( strNewString.replace( /\xFE151\xFF/g, "-"))
		
		// Replace char 254,'044', char 255 with  Comma [,]
		strNewString = Trim(strNewString.replace( /\xFE044\xFF/g, ","))
		
		// Replace char 254,'032', char 255 with a Space 
		strNewString = Trim(strNewString.replace( /\xFE032\xFF/g, " "))
		
		// Replace char 254,'037', char 255 with Percent [%]
		strNewString = Trim(strNewString.replace( /\xFE037\xFF/g, "%"))
		
		// Replace char 254,'038', char 255 with Ampersand [&] 
		strNewString = Trim(strNewString.replace( /\xFE038\xFF/g, "&"))
		
		// Replace char 254,'040', char 255 with Left Parentheses [(]
		strNewString = Trim(strNewString.replace( /\xFE040\xFF/g, "("))
		
		// Replace char 254,'041', char 255 with Right Parentheses [)]
		strNewString = Trim(strNewString.replace( /\xFE041\xFF/g, ")"))
		
		// Replace char 254,'046', char 255 with Period [.]
		strNewString = Trim(strNewString.replace( /\xFE046\xFF/g, "."))
		
		// Replace char 254,'047', char 255 with Forward Slash [/]
		strNewString = Trim(strNewString.replace( /\xFE047\xFF/g, "/"))
		
		// Replace char 254,'042', char 255 with Asterick [*]
		strNewString = Trim(strNewString.replace( /\xFE042\xFF/, "*"))
		
		// Replace char 254,'063', char 255 with Question Mark [?]
		strNewString = Trim(strNewString.replace( /\xFE063\xFF/, "?"))
		
		// Replace char 254,'033', char 255 with Exclamation Point [!]		
		strNewString = Trim(strNewString.replace( /\xFE033\xFF/, "!"))


		return strNewString;
	}
