$(document).ready(function(){
	// product list
	// var $j = jQuery.noConflict();
	// $j('ul#product_list li:nth-child(5)').append('<p>Test</p>');
	
	 // nav déroulante à regler
	$('#header .sf-contener ul ul').css('left', 0);
	$('#header .sf-contener .sf-menu>li:nth-child(7)').addClass('last-blue');
	$('#header .sf-contener .sf-menu>li:nth-child(8)').addClass('blue-menu');
	$('#header .sf-contener .sf-menu>li:nth-child(9)').addClass('blue-menu');
	$('#header .sf-contener .sf-menu>li:nth-child(10)').addClass('blue-menu');
	
	/* print */
	$('#print').click(function(){window.print();});
	
	/* input */
	$('#search_query_top').focus(function(){
			if($(this).attr('value') == 'Recherchez produit, une marque...'){
					$(this).attr('value', '');
			}
	});
	$('#search_query_top').blur(function(){
			if($(this).attr('value') == ''){
					$(this).attr('value', 'Recherchez produit, une marque...');
			}
	});
	
	/* last odd even */
	$('#best-sellers_block_right li:even').addClass('even');
	$('.pagination li:first-child').addClass('no-border');
	$('#search #product_list li:nth-child(6n)').addClass('last-inline');
	$('.pages-sitemap .tree li:last-child').addClass('last');
	$('#header .sf-contener ul ul li:last-child').addClass('last');
	$('#viewed-products_block_left li:even').addClass('even');
	$('#crossselling_list li:nth-child(6n)').addClass('last-inline');
	$('#crossselling_list li:nth-child(7n)').addClass('clear');
	
	/* carrousel */
	$('#index #scenes-hp').jcarousel({
		scroll: 1,
		wrap: 'circular',
		auto:8,
		initCallback: mycarousel_initCallback
	});
	
	/* menu left */
	$('.up-down').live('click', function() {
		if($(this).hasClass('off')){
			$(this).removeClass('off');
			$(this).find('img').attr('src', $(this).find('img').attr('src').replace(/_on.gif/g, '_off.gif'));
			$(this).parent().parent().find('.block_content').slideDown();
		}else{
			$(this).addClass('off');
			$(this).find('img').attr('src', $(this).find('img').attr('src').replace(/_off.gif/g, '_on.gif'));
			$(this).parent().parent().find('.block_content').slideUp();
		}
	});
	
	$('#copy_arevage').html($('#average').html());
});

function mycarousel_initCallback(carousel) {
	
	// stoppe l'autoscroll au survol de la souris
	$('#index #scenes-hp').hover(function() {
		carousel.stopAuto();
	}, function() {
		carousel.startAuto();
	});
	
	
};
