function confirmDelete(delUrl) {
  if (confirm("Are you sure you want to delete this item?")) {
    document.location = delUrl;
  }
}

function showQuickContents(){
	$("#header #cart .quickcontents").slideDown(function(){
		$("#header #cart .quickcontents .inner").animate({opacity: 0.9});
	});
}

function hideQuickContents(){
	$("#header #cart .quickcontents .inner").animate({opacity: 0},function(){
		$("#header #cart .quickcontents").slideUp();	
	});
}	

function updateCartCounts(count){
	if(!count){
		$.ajax({
			type: "POST",
			url: "/_ajax_cart.php",
			data: ({
				action: "count"
			}),
			success: function(msg){
				count = msg;
				$(".loader").hide();	
				$(".cartcount").html("(" + count + ")");
				$( '#hdr-checkout_btn' ).css ( 'display', 'inline' );
				$( '#product-checkout_btn' ).slideDown ();
			}
		});			
	} else {
		$(".cartcount").html("(" + count + ")");
		$("#content.product .purchase .inner .form .input_button .loader").hide();			
	}	
}

function updateCartQuickContents(){
	$.ajax({
		type: "POST",
		url: "/_ajax_cart_quickcontents.php",
		success: function(msg){
			$("#header #cart .quickcontents .inner").html(msg);
			updateCartCounts();

		}
	});	
}

function showLightbox(id,pos,xmlTarget){
	tb_show("test","/media_gallery.php?initid="+id+"&pos="+pos+"&xmlTarget="+xmlTarget+"&TB_iframe=true&height=600&width=600");	
//	tb_show("test","http://www.google.com");	
}

function switchColorXML(pid,color,sku){
	var str = "/_xml_product_photo.php?productid="+pid+"&color="+color;
	$("input[name='sku']").val(sku);
	if(getFlashMovie("product-photo")){
		getFlashMovie("product-photo").reloadComponentWith(str);	
	}
}

function getFlashMovie(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
}


