jQuery(document).ready(function() {
		function emptyCart(url){
			var txt = 'Êtes-vous sûr de vouloir vider le panier ?';
			
			jQuery.prompt(txt,{ 
				buttons:{Vider:true, Annuler:false},
				callback: function(v,m,f){
					
					if(v){
						var uid = f.userid;
						jQuery.get(url,function(data){
							if(data){						
								jQuery.prompt('Le panier a été vidé !'); 
								window.history.go(0);								
							}else{ 
								jQuery.prompt("Une erreur s'est produite !"); 
							}							
						});
					}else{}					
				}
			});
		}
		jQuery('.buttonclear a').live('click', function(event){
			event.preventDefault();
			emptyCart(jQuery(this).attr('href'));
		});
		jQuery('img.hover').hover(
			function(){
				var t = jQuery(this);
				t.attr('src',t.attr('src').replace('_OFF','_ON'));
			},
			function(){
				var t = jQuery(this);
				t.attr('src',t.attr('src').replace('_ON','_OFF'));
			}
		)
		//jQuery("#headnav").superfish(); 
		jQuery("#dropdown-categories").superfish();
		jQuery("#dropdown-categories ul li").hover(function(){jQuery(this).addClass('sfHover')},function(){jQuery(this).removeClass('sfHover')}); 
		jQuery(".sys_image_pop").colorbox({
			opacity:0.3,
			rel:"group_product"
		});
		/*
		jQuery("#dropdown-categories > p").click(function () {
			if (jQuery("#dropdown-categories > ul").is(":hidden")) {
				jQuery("#dropdown-categories > ul").slideDown();
				jQuery("#dropdown-categories > p > span").html("-");
			} else {
				jQuery("#dropdown-categories > ul").slideUp();
				jQuery("#dropdown-categories > p > span").html("+");
			}
		});
		*/
		jQuery(".link_full_specification").click(function(){
			if (jQuery("#full_specification").is(":hidden")) {
				jQuery("#full_specification").slideDown();
				jQuery(".link_full_specification").html("Masquer la description complète");
			} else {
				jQuery("#full_specification").slideUp();
				jQuery(".link_full_specification").html("Voir toute la description");
			}
		});
		function equalHeight(group) {
			var tallest = 0;
			group.each(function() {
				var thisHeight = jQuery(this).height();
				if(thisHeight > tallest) {
					tallest = thisHeight;
				}
			});
			group.height(tallest);		
		}
		equalHeight(jQuery(".product-li"));
	});
