$j = jQuery.noConflict();

$j(function(){

	// onglets (fiche produit)
	$j('.product_infos .raccourcis a').click(function(){
		$j('.product-collateral .box-collateral h2:nth-child(' + $j(this).attr('data-target') + ')').click();
	});
	$j('.lien_suite').click(function(){
		$j('.product-collateral .box-collateral h2:nth-child(1)').click();
	});

	// carousel des marques (footer)
	$j('#carousel_marques').jcarousel();

	// panier déroulant (header)
	$j('.block-cart .block-content').hide();
	$j('.block-cart .block-title').live('mousemove', function(){
		if($j(this).next('.block-content:not(:visible)').length){
			$j(this).next('.block-content').slideDown(100);
		}
	});
	$j('.block-cart').live('mouseleave', function(){
		$j(this).find('.block-content').slideUp(100);		
	});
	
	// form newsletter (footer)
	$j('.footer #newsletter').val('Votre email');
	$j('.footer #newsletter').focus(function(){
		if($j(this).val() == 'Votre email'){
			$j(this).val('');
		}
	});
	$j('.footer #newsletter').blur(function(){
		if($j(this).val() == ''){
			$j(this).val('Votre email');
		}
	});

	// gestion quantite produit
	$j("img.quantite").click(function(){
		champ = $j(this).parents('.structure_plus_moins').find('input');
		if($j(this).attr("alt")=="moins"){
			if(parseInt(champ.val()) > 0){
				champ.val(parseInt(champ.val()) - 1);
			}
		} else {
			champ.val(parseInt(champ.val()) + 1);
		} 
	});
	
	// selection speciale
	$j('.selection-speciale .contenu_alt').hide();
	$j('.selection-speciale li.item').hover(
		function(){
			$j(this).find('.product-image, .remise').hide();
			$j(this).find('.contenu_alt').show();
		},
		function(){
			$j(this).find('.product-image, .remise').show();
			$j(this).find('.contenu_alt').hide();
		}
	);
	
	// deplace les commentaires "dans" la colonne de gauche
	$j('.product-collateral').append($j('#customer-reviews'));
	
	// page a propos
	// deplace le flash avant les deux colonnes
	$j('.col-main').before($j('#flash_a_propos'));
	var flashvars = {};
	var params_flash = {};
	params_flash.wmode = 'transparent';
	swfobject.embedSWF("/skin/frontend/toc/toc/flash/apropos.swf", "flash_a_propos", "920", "340", "9.0.0", "expressInstall.swf", flashvars, params_flash);

	
	
	$j('.col-main').before($j('.col2-left-layout .category-description'));
	
	
	
	// nav deroulante
	$j("#nav > li > ul").hide();
	$j("#nav > li").hover(
		function(){
			$j(this).find('> ul').show();
		},
		function(){
			$j(this).find('> ul').hide();
		}
	);

 });
