var theDate;
var executions = 0;
var transferBox;

function updateMinicart() {
	theDate = new Date();
	
	// TRANSFER BOX
	transferBox.TransferTo({
		to: "minicart",
		className: "transfer",
		duration: 400
	});
	
	// GET RID
	$("#minicart").fadeOut(200,function() {
		// RELOAD
		$("#minicart").load("inc_minicart_inner.asp?d=" + theDate.getTime(),function() {
			// BRING BACK
			$("#minicart").fadeIn(200);
			
			// SHOW VIEW BASKET BUTTON
			$("#vbb:hidden").slideDown("fast");
		});
	});
	
	/*
	$("#jqpop").jqm({
		ajax: "prodadded.asp",
		modal: true,
		onShow: function(h) {
			h.w.fadeIn("slow");
		},
		onHide: function(h) {
			h.w.fadeOut("slow",function() {
				if (h.o) h.o.remove();
			});
		}
	}).jqmShow();
	*/
}

$(document).ready(function() {	
	var options = {
		success: updateMinicart,
		semantic: true
	};
		
	// CLICK WHOOSH!
	$("#addprodmain,#addprodmulti").bind("submit",function() {
		$("input[@name=js]",this).val("1");
		
		transferBox = $("input[@type=image]",this);
		
		// SUBMIT VIA AJAX
		$(this).ajaxSubmit(options);
		
		// PREVENT ACTUAL SUBMISSION
		return false;
	});
	
	// EMAIL FORM
	$("#oosemail").focus(function() {
		if ($(this).val() == $("#oosemail")[0].defaultValue) {
			$(this).val("");
		}
	}).blur(function() {
		if ($(this).val() == "") {
			$(this).val($("#oosemail")[0].defaultValue);
		}
	});
});
