<!--
//	Validates the form that contains the button that is passed in.  
//	If the form is valid, then we go ahead and submit it
function checkAndSubmit(button) {
	var $form = button.parent();
	var $sizes = $('#sizes', $form);
	var $message = "";
	
	//	Validation:
	//	First - validate that a size is selected
	var size = $sizes.val();
	
	//	assumes that if $sizes is null, then this is an item that doesn't care about size selection
	if ( null != $sizes && size == "" ) {	
		$message = $message + "Please select a size before adding this item to your cart!";	
	}
	
	//	other validation...  to be added as needed
	
	//	Now, if validation passes - ie, the $message var is empty, then we can submit...
	if ( $message.length == 0) {
		asyncFormSubmit($form);
		$('#msgArea', $form).css("display", "none");
	}
	//	... otherwise, display the message
	else {	
		$('#msgArea', $form).css("display", "inline-block");
		$('#msgArea', $form).html($message);
	}
}

//	Intended to do an ajax-y submit so that the user stays on the current page.
//	Currently, just submits the form that is passed in.
function asyncFormSubmit(form) {
	//alert("Submitting form " + form.attr('id') + " (not really)");
	form.submit();
}
//-->