$(document).ready(function() {	// Panier	$("a.add-to-cart").click(function(){		var last_id = $(this).attr("pid");		$.ajax({url:(WEBSITE_BASE ? WEBSITE_BASE : "")+"/cart-ajax.php", data:"action=add&id="+$(this).attr("pid")+"&q="+$("#quantity").val(), dataType:"xml", success:function(xml){			if ($(xml).find("error").length > 0)			{				if ($(xml).find("error").attr("num") == 1) $("#cart-error-1").dialog("open");			}			else if ($(xml).find("cart").length > 0)			{				if ($(xml).find("cart").attr("max") == 1) $("#cart-max").dialog("open");								$("span.count-cart").html($(xml).find("cart").attr("ref"));								$.ajax({url:(WEBSITE_BASE ? WEBSITE_BASE : "")+"/cart-ajax.php", data:"action=get", dataType:"text", success:function(s){					$("#cart").html(s);					//$("#cart ul li[rel="+last_id+"]").css("font-weight", "bold");					SetMiniCartCommand();					$("#cart select.update-quantity").uniform();					SetBestSize();				}});			}		}});		return false;	});		// Popup Log	$("a.pop-login-error").click(function(){		$("#pop-login-error").dialog("open");		return false;	});	$("#pop-login-error").dialog({		autoOpen: false,		draggable:false,		resizable:false,		height: 256,		width: 433,		modal: true	});	$("#pop-login-error a.close-me").click(function(){		$("#pop-login-error").dialog('close');		return false;	});		// Popup panier	$("#cart-error-1").dialog({		autoOpen: false,		show: "blind",		modal: true,		resizable: false,		overlay: {backgroundColor: '#000', opacity: 0.6}	});	$("#cart-max").dialog({		autoOpen: false,		show: "blind",		modal: true,		resizable: false,		overlay: {backgroundColor: '#000', opacity: 0.6}	});		// Panier	$("#form-panier a.bag-remove").click(function(){		var rel = $(this).closest("li").attr("rel");		$(this).closest("li").fadeOut('slow', function() {			$(this).remove();			$.ajax({url:(WEBSITE_BASE ? WEBSITE_BASE : "")+"/cart-ajax.php", data:"action=update&val=0&id="+rel, dataType:"xml", success:function(xml){				$("span.count-cart").html($(xml).find("cart").attr("ref"));				SetBestSize();			}});		});				return false;	});		function SetMiniCartCommand() {		$("select.update-quantity").change(function(){			var rel = $(this).closest("li").attr("rel");			if ($(this).val() == 0) {				$(this).closest("li").fadeOut('slow', function() {					$(this).remove();					if ($("#cart ul li").length == 0) {						$.ajax({url:(WEBSITE_BASE ? WEBSITE_BASE : "")+"/cart-ajax.php", data:"action=get", dataType:"text", success:function(s){							$("#cart").html(s);							SetBestSize();						}});					}				});			}			$.ajax({url:(WEBSITE_BASE ? WEBSITE_BASE : "")+"/cart-ajax.php", data:"action=update&val="+$(this).val()+"&id="+rel, dataType:"xml", success:function(xml){				$("span.count-cart").html($(xml).find("cart").attr("ref"));				SetBestSize();			}});			return false;		});	}		SetMiniCartCommand();		// Adresse	$("#form-commande input.adress[@type=radio]").change(function(){		if ($("#form-commande input.adress[@type=radio]:checked").val() == 'oui') $("#adresse-livraison").hide();		else $("#adresse-livraison").show();		return false;	});});
