$(function() {

	max_items = 5;
	
	$('input[class=hair]')
	.css('background','snow')
	.each(function() {
		if ($(this).val() > max_items) {
			$(this).val(5).css('background','yellow');
		 	alert("Sorry, the maximum quantity is " + max_items);
		}
	});
	
	$('input[class=hair]')
	.focus(function() {
		current = $(this).val();
	})
	.change(function() {
		if ($(this).val() > max_items) {
			$(this).val(current).css('border-color','red').focus();
			alert("Sorry, due to diversion concerns\nfor some hair products\nthe maximum quantity is " + max_items);
		}
		current = $(this).val();
	});
	
});

