function refreshBasket(){
	$(".minibasket .ajax").html("<img width='160' src='/common/sgraphics/load.gif' />");
	$.get("/mm5/merchant.mvc?Screen=MINI",function(data){$(".minibasket .ajax").html(data);UI_Init_Basket();$(".minibasket a.button").button();});
}

function quickBuy(code){
	$("body").append("<div title='Add to Basket' id='ATB' style='text-align:center;padding-top:10px;'>Verifying Inventory<br><img src='/common/Customize/load.gif' /></div>");
	$.ajax({url:"http://www.rnkshops.com/mm5/merchant.mvc?Screen=JPROD&callback=?&Product_Code="+code, type:"GET", dataType: "jsonp" ,success:
		function(data){
			$("#ATB").dialog('close');
			if(data.inv==0){
				$("#ATB").html("<img src='/common/sgraphics/bad.png' /><br>Sorry, "+data.name+" is not available for sale.");
			}else if(data.attrc>0){
				$("#ATB").html("<img src='/common/sgraphics/caution.png' /><br>Sorry, "+data.name+" has options and cannot be bought on this page at this time.<br><br>Please click 'View Item' instead.");
			}else if(data.error=="Error"){
				$("#ATB").html("<img src='/common/sgraphics/caution.png' /><br>Unable to verify inventory.<br><br>Please click 'View Item' instead.");
			}else{
				$("#ATB").html("<img src='/common/sgraphics/good.png' /><br>"+data.name+" added to basket...");
				$(".minibasket .ajax").html("<img width='160' src='/common/sgraphics/load.gif' />");
				$.get("/mm5/merchant.mvc?Screen=BASK&Action=ADPR&Product_Code="+data.code+"&Quantity=1",refreshBasket);
			}
			$("#ATB").dialog({modal: true,width: 250,buttons: {Ok: function() {$(this).dialog('close');$("#ATB").remove();}}});	
		}
	});
	$("#ATB").dialog({modal: true,width: 250,buttons: {Cancel: function() {$(this).dialog('close');$("#ATB").remove();}}});
}