// Au chargement de la page
$(document).ready(function() {
	// BoF BoB: Lancement de l'accordeon en homepage
	if ( $("#accordion1").length != 0 ) {
		$("#accordion1").msAccordion({defaultid:0, autodelay:6});
	}
	// EoF BoB: Lancement de l'accordeon en homepage
	
	// BoF BoB: Coins arrondis IE
	if ($.browser.msie) {
		DD_roundies.addRule( 'div.block ul.tree li a', '7px' );
		DD_roundies.addRule( 'div.block ul.tree li', '7px' );
		DD_roundies.addRule( '#primary_block #short_description_block', '7px' );
		DD_roundies.addRule( '#cart_block', '7px' );
		DD_roundies.addRule( '#editorial_block_center .rte p', '7px' );
		DD_roundies.addRule( 'div.cat_desc', '7px' );
		DD_roundies.addRule( '#tableauHomeContent', '0px 7px 0px 7px' );
	}
	// EoF BoB: Coins arrondis IE
	
	// BoF BoB: Tableau de la homePage
	var homeTab = {
		show: function( tabName ) {

			var tabId = 1;
			var name = tabName.split( '-' );
			name.reverse( );
			tabId = name[0];
			
			$( '#tableauHome li' ).removeClass( 'selected' );
			$( '#tableauHomeContent div' ).hide(  );
			
			$( '#tableauHome' ).find( '#tableauHomeLabel-' + tabId ).addClass( 'selected' );
			$( '#tableauHomeContent' ).find( '#tableauHomeTab-' + tabId ).show(  );
		}
	}
	
	homeTab.show( 'tableauHomeLabel-1' );
	$( '#tableauHome li' ).click( function( ) {
		homeTab.show( $( this ).attr( 'id' ) );
	});
	// EoF BoB: Tableau de la homePage
	
	// BoF BoB: Bt finaliser sur shopping cart
	$( '.finaliser' ).click( function( ) {
    	var $target = $( '#registerForm' );
    	$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
    	if ($target.length) {
    		var targetOffset = $target.offset().top;
    		$('html,body').animate({scrollTop: targetOffset}, 1000);
		       return false;
    	}
    	$( '#registerForm #nom' ).focus( );
	});
	
	// EoF BoB: Bt finaliser sur shopping cart
	if ( $( '#venteadd_form' ).length != 0 ) {
		$( '#add_to_cart input' ).hide( );
	}
	// BoF BoB: Gestion des boutons ajouter au devis
	
	// EoF BoB: Gestion des boutons ajouter au devis

});
