var sysValidate = new Object();
sysValidate.postal = function(locale,zip) {
	zip = new String(zip);
	switch(locale){
		case 'de_DE':
			return ( zip.length == 5 && !isNaN( zip ) );
			break;
		case 'de_AT':
		case 'de_CH':
			return ( zip.length == 4 && !isNaN( zip ) );
			break;
	}
	return false;
}

function isGermanLetter( value ){
	try {
		return /^[a-zA-ZäáàâçéèêíìîñöóòôüúùûßÄÁÀÂÇÉÈÊÍÌÎÑÖÓÒÔÜÚÙÛ\-]+$/.test( value );
	} catch( e ) {
		return true;
	}
}

function isGermanWord( value ) {
	try {
		return /^[a-zA-ZäáàâçéèêíìîñöóòôüúùûßÄÁÀÂÇÉÈÊÍÌÎÑÖÓÒÔÜÚÙÛ\- ´`']+$/.test( value );
	} catch( e ) {
		return true;
	}
}

function isUserName( value ) {
	return /^[a-z0-9_]{4,15}$/i.test( value );
}

try {
	jQuery.validator.addMethod( 'userName', isUserName, 'Only letters allowed' );
	jQuery.validator.addMethod( 'germanNames', isGermanWord, 'Only letters allowed' );
	jQuery.validator.addMethod( 'germanLetters', isGermanLetter, 'Only letters allowed' );
	jQuery.validator.addMethod( 'cityNames', isGermanWord, 'Only letters allowed' );
	jQuery.validator.addMethod( 'postal', function( value,element,params ) { return sysValidate.postal( $(params).val(), value ); } , '' );
}catch(e){}
