
	$(document).ready(function() {
		$('#buy-now-button').click(function()
		{
			if(parseInt($('#amount').attr('value')) != $('#amount').attr('value')) {
				alert('Please input a whole number greater than or equal to the minimum purchase  (i.e. '+(minimum)+').');
				return;
			}
			
			if($('#amount').attr('value') < minimum) {
				alert('Please input a rental period above that is greater than or equal to the minimum purchase.');
				return;
			}
			
			if(interval != 1)
			{
				var extra = $('#amount').attr('value') - minimum;
				if (extra != 0) {
					if (extra < interval || extra%interval != 0) {
						alert('Please input a rental period that is a multiple of ' + interval + ' (i.e. ' + (interval + minimum) + ')');
						return;
					}
				}
			}
			
			
			if($('#tos-checkbox').attr("checked")) {
				this.form.submit();
			} else {
				alert('Please agree to the terms and conditions by selecting the checkbox below.');
			}
		});
	});

