var theDate = new Date();

function basketTransfer() {

	if (document.getElementById('SizeID').value=="-") {
		alert("You must select a size before continuing");
		return false;
	}
	
	if (document.getElementById('ColourID').value=="-") {
		alert("You must select a colour before continuing");
		return false;
	}
	
	if (document.getElementById('qty').value=="0" || document.getElementById('qty').value=="") {
		alert("You must enter a quantity before continuing");
		return false;
	}


	var theDate = new Date();
	
	$.post("addprod.asp",{
		productid: $("#productid").val(),
		qty: $("#qty").val(),
		SizeID: $("#SizeID").val(),
		ColourID: $("#ColourID").val(),
		js: "1"
	},function(rText) {
		switch (rText) {
			case "OK":
				$("#buynow").TransferTo({
					to: "baskettext",
					className: "transfer",
					duration: "150"
				});
	
				$("#minicart").load("inc_minicart.asp?" + theDate.getTime(),function() {
					$("#minicart").Pulsate(250,1);

					$("#prodmsg").css("color","#009900").html("This product has now been added to your basket");
				});
			break;
			
			case "NaN":
				$("#prodmsg").css("color","#cc0000").html("Quantity specified was non-numeric - this product has not been added.");
			break;
			
			default:
				$("#prodmsg").css("color","#cc0000").html("An error occured - this product has not been added to your basket.");
			break;
		}
	});

	return false;
}

$(document).ready(function() {
	$("#addform").submit(function() { return basketTransfer(); });
});


