/*requires jquery-1.3.2.min.js*/
/*requires jquery.format.1.02.js*/
/*requires Text.js*/

/*
	Requires jQuery library, jQuery Format plugin and Text.js
*/
$(function() {
	$("input.ShortIntBox").format({precision: 0,allow_negative:false,autofix:true});
	$("input.ShortIntBox").blur(function (){
		var val = parseInt( $("#NoOfPeopleTextBox").val() );
		if (!isNaN(val)) {
			if (val < 1) {
				$(".ErrorPrompt", $(this).parent()).remove();
				var errorText = GetText("TooFewServings");
				if ($(this).attr("rel") == "People") errorText = GetText("TooFewPeople");
				$(this).parent().append("<p class='ErrorPrompt'>" + errorText + "</p>");
			} else if (val > 99999) {
				$(".ErrorPrompt", $(this).parent()).remove();
				var errorText = GetText("TooManyServings");
				if ($(this).attr("rel") == "People") errorText = GetText("TooManyPeople");
				$(this).parent().append("<p class='ErrorPrompt'>" + errorText + "</p>");
			} else {
				$(".ErrorPrompt", $(this).parent()).remove();
			}
		} else {
			$(".ErrorPrompt", $(this).parent()).remove();
		}
	});
});