//Created by Dawid Kasperowicz
$(function()
{
	var restrictMaxLength = ['item-detail-quantity', 'quantity-textbox'];
	
	$('input').live('blur', function ()
	{
		$(this).val(trim($(this).val()));

	}).click(function ()
	{
		var currentID = $(this).attr('id'),
			currentClass = $(this).attr('class'),
			currentElement = $(this);
		
		$(restrictMaxLength).each(function (index, value)
		{			
			if (currentID === value || currentClass === value)
			{
				currentElement.attr('maxlength', '3');
			}
		});
	});
	
	$('.numeric').numeric();
});

//Created by Dawid Kasperowicz
function trim (stringToTrim)
{
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
