function Validation(Field,Type,Min,Max,Field2){
	var Str = $('#'+Field).val();
	var Regexp;
	var ErrorText;
	var Match='';
	if (Type=='AlphaNumeric'){
		Regexp="^[\\w ]{"+Min+","+Max+"}$";
		ErrorText="Invalid data. Requires "+Min+" to "+Max+" characters. Letters, Numbers and Spaces only.";
	}
	if (Type=='TextField'){
		Regexp="^[\\w\\£\\.\\s\\+\\,!'=\\(\\)\\*\\&\\-\\$\\%;:\\\"\\/\\? ]{"+Min+","+Max+"}$";
		ErrorText="Invalid data. Requires "+Min+" to "+Max+" characters.";
	}
	if (Type=='PageTitle'){
		Regexp="[\\w\\- \\.\\&\\(\\)]{"+min+","+max+"}?";
		ErrorText="Invalid title. Requires "+Min+" to "+Max+" characters (alphanumeric,-,.,&,(,)) only";
	}
	if (Type=='NameFormat'){
		Regexp="^[\\w\\-\\. ]{"+Min+","+Max+"}$";
		ErrorText="Invalid name. Requires "+Min+" to "+Max+" characters. Letters, numbers, spaces, hyphens and full stops only.";
	}
	if (Type=='Numeric'){
		Regexp="^[\\d ]{"+Min+","+Max+"}$";
		ErrorText="Invalid data. Requires "+Min+" to "+Max+" digits. Numbers only.";
	}
	if (Type=='Telephone'){
		Regexp="^[\\d \\+]{"+Min+","+Max+"}$";
		ErrorText="Invalid data. Requires "+Min+" to "+Max+" digits. Numbers,Spaces and + only.";
	}
	if (Type=='Email'){
		Regexp="^[A-Za-z0-9\.\%\_\-]+@[A-Za-z0-9\.\-]+\\.(?:[A-Za-z]{2}|com|org|net|biz|info|name|aero|biz|info|jobs|museum|name)$";
		ErrorText="Invalid email address.";
	}
	if (Type=='EmailorNone'){
		Regexp="^([\w-_.]*[\w-_.]@[\w-_]+?[\w-_.]+\.[\w.]{3,})?$";
		ErrorText="Invalid email address.";
	}		
	if (Type=='Url'){
		Regexp="^(?:(?:http://|http://www\\.|www\\.)[a-zA-Z0-9]+[A-Za-z0-9\\.\\-]+\\.(?:[A-Za-z]{2}|com|org|net|biz|info|name|aero|biz|info|jobs|museum|name)){"+Min+","+Max+"}$";
		ErrorText="Invalid url format.";
	}		
	if (Type=='PostCode'){
		Regexp="^[a-zA-Z]+[a-zA-Z0-9]{1,3}\\s[\\d]{1}[a-zA-Z]{2}$";
		ErrorText="Invalid postcode.";
	}
	if (Type=='UsernameOrPassword'){
		Regexp="^[\\w-_]{"+Min+","+Max+"}$";
		ErrorText="Invalid username or password. Requires "+Min+" to "+Max+" characters. Alphanumeric and _- characters only.";
	}
	if (Type=='UsernameOrPasswordMatch'){
		Regexp="^[\\w-_]{"+Min+","+Max+"}$";
		ErrorText="Invalid username or password. Requires "+Min+" to "+Max+" characters. Alphanumeric and _- characters only.";
		if($('#'+Field).val()!=$('#'+Field2).val()){
			ErrorText="Your passwords do not match.";
			Match='Fail';
		}
	}
	if(!Str.match(Regexp) || Match=='Fail'){
		$('#'+Field+"_Errors").fadeIn(200);
		$('#'+Field+"_Errors img").attr("title",ErrorText);	
		$('#'+Field+"_Errors img").attr("alt",ErrorText);		
		return 'fail';
	}
	else{
		$('#'+Field+"_Errors").fadeOut(500);
		return 'true';
	}
}