// Removes leading whitespaces
function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
	return LTrim(RTrim(value));
	
}

function isPostcode(EiValue)
{
	if (EiValue!="")
	{
		if (trim(EiValue).length>4)
		{
			
			if (EiValue.substring(3,4) != ' ')
			{
			var message = "- Please put a space after third or fourth sign of postcode.\n"
			return message
			}
		}
		
		if (trim(EiValue).length<3)
				{
				var message = "- Please put at least first three letters of the postcode.\n"
				return message
				}
			
		}   
	return ''
}

