// JavaScript Document

// + Updates
// + ------------------------------------------------------------
// +
// + 2009-05-14 => Modification complète du script
// +
// + ------------------------------------------------------------

(function($) {
	$(function(){
		/* Document is ready
		---------------------------------------- */

		//
		// Préparation du menu
		//
		$('#navigation > li > ul').hide();

		//
		// Assignation des évènements et transformation
		//
		$('#navigation > li.column').each(function (){
			var subMenu = $('> ul', this);
			var toggle = $('> a', this);
			var n = subMenu.queue("fx");

			toggle.bind('mouseenter', function(){
				subMenu.stop(true, true).slideDown('fast');
				$(this).css({backgroundPosition: '0px -30px', color: '#ffffff'});
			}).end()
			.bind('mouseleave', function(){
				subMenu.stop(true, true).slideUp();
        toggle.not('.mainmenured').css({backgroundPosition: '0px 0px', color: '#a0a0a0'});
			});
		});
	});
})(jQuery);

jQuery(document).ready(function() {

 	// hides the slickbox as soon as the DOM is ready
  jQuery('#espace_pro_toogle').hide();
	// toggles the slickbox on clicking the noted link
  jQuery('#espace-pro a').not('.reallink').click(function() {
	jQuery('#espace_pro_toogle').slideToggle(400);
		return false;
  });
  
  // hides the slickbox as soon as the DOM is ready
  jQuery('#espace_pro_toogle2').hide();
	// toggles the slickbox on clicking the noted link
  jQuery('a.bt_home_inscription2').click(function() {
	jQuery('#espace_pro_toogle2').slideToggle(400);
		return false;
  });
  
  jQuery('#navigation-globalproduits').show();
  
	// toggles the slickbox on clicking the noted link
  jQuery('.slide_nav_prod').click(function() {
		jQuery('.nos-documents-panel-content').slideUp(400);
		jQuery('.nos-produits-panel-content').slideToggle(400);
		return false;
  });
  // toggles the slickbox on clicking the noted link
  jQuery('.slide_nav_doc').click(function() {
		jQuery('.nos-produits-panel-content').slideUp(400);
		jQuery('.nos-documents-panel-content').slideToggle(400);
		return false;
  });

  //Chargement d'une fiche produit
  jQuery('.top-column-navigation-content li.leaf a').click(function()
  {
    jQuery('#ajax-loader').fadeIn('fast');
    jQuery.ajax({
      url: jQuery(this).attr('href'),
      dataFilter: function(data) {
        return data.substring(data.indexOf('<body') + 6, data.lastIndexOf('</body'));
      },
      success: function(data) {
        jQuery('#ajax-content').html(data);
        initializeSpecsTable();
        initializeProductTabs();
        jQuery('#ajax-loader').fadeOut('fast');
      }
    });

    jQuery('#breadcrumb_produit').slideDown(400);
    jQuery('#infos_produit').slideDown(400);
    jQuery('.page-main-center2:not(#infos_produit)').slideUp(400);
		jQuery('.nos-documents-panel-content').slideUp(400);
		jQuery('.nos-produits-panel-content').slideUp(400);

    return false;
  });
});