jQuery.fn.inputValue = function(options)
{
	var settings = jQuery.extend({allow:'', disallow:''}, options);

	return jQuery(this).keypress
	(
		function (e)
		{
			if (!e.charCode)
			{
				var code = String.fromCharCode(e.which);
			}
			else
			{
				var code = String.fromCharCode(e.charCode);
			}

			if (code && (typeof(e.keyCode) == 'undefined' || (e.keyCode != 8 && e.keyCode != 9 && e.keyCode != 13 && e.keyCode != 17 && e.keyCode != 37 && e.keyCode != 38 && e.keyCode != 39 && e.keyCode != 40 && e.keyCode != 46)))
			{
				if (settings.allow.length != 0 && settings.disallow.length != 0)
				{
					if(settings.allow.indexOf(code) == -1)
					{
						e.preventDefault();
					}
					else if(settings.disallow.indexOf(code) != -1)
					{
						e.preventDefault();
					}
				}
				else if(settings.allow.length != 0)
				{
					if(settings.allow.indexOf(code) == -1)
					{
						e.preventDefault();
					}
				}
				else if(settings.disallow.length != 0)
				{
					if(settings.disallow.indexOf(code) != -1)
					{
						e.preventDefault();
					}
				}
			}

			if (e.ctrlKey && code=='v')
			{
				e.preventDefault();
			}

			jQuery(this).bind('contextmenu',function () {return false});
		}
	);
};


/**
 *	input fields will accept valid email address
 */
jQuery.fn.inputEmail = function()
{
	return this.each (function()
		{
			jQuery(this).inputValue({allow:'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@.0123456789-_'});
		}
	);
};


/**
 *	input fields will accept digits only
 */
jQuery.fn.inputZipDE = function()
{
	return this.each (function()
		{
			jQuery(this).inputValue({allow:'0123456789'});
		}
	);
};


/**
 *	input fields will accept digits only
 */
jQuery.fn.inputInteger = function()
{
	return this.each (function()
		{
			jQuery(this).inputValue({allow:'-0123456789'});
		}
	);
};


/**
 *	input fields will accept digits and dots.
 */
jQuery.fn.inputFloat = function()
{
	return this.each (function()
		{
			jQuery(this).inputValue({allow:'0123456789.'});
		}
	);
};


/**
 *	input fields will accept all letters (case insensitive)
 */
jQuery.fn.inputLetter = function()
{
	return this.each (function()
		{
			jQuery(this).inputValue({allow:'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZäöüÄÖÜß- '});
		}
	);
};

/**
 *	input fields will accept all letters (case insensitive)
 */
jQuery.fn.inputNickname = function()
{
	return this.each (function()
		{
			jQuery(this).inputValue({allow:'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZäöüÄÖÜß0123456789-'});
		}
	);
};


/**
 *	input fields will accept all letters (case insensitive)
 */
jQuery.fn.inputLatin = function()
{
	return this.each (function()
		{
			jQuery(this).inputValue({allow:'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZäöüÄÖÜß0123456789-., @$#{}[]&%§^°/()=?;:'});
		}
	);
};


