﻿function registerNumericTextboxes() {
	$(".numeric").numeric();
}

function notAllowEmptyTextBox(textbox) {
	var qttyLength = textbox.val().length;
	if (qttyLength == 0) {
		textbox.val("0");
	}
}

function notAllowNegativeQtty(textbox) {
	var qtty = textbox.val();	
	if (parseInt(qtty) <= 0) {
		textbox.val("0");
	}
}

function registerQttyTextBoxConstraints() {
	$(".numeric").change(function () {
		var theTextbox = $(this);
		notAllowEmptyTextBox(theTextbox);
		notAllowNegativeQtty(theTextbox);
	});
}
