function initWindowLoad(){
}

function initDomReady(){
	
	/**** MISE EN PLACE DU MENU ******/
	var COLMARGIN = 0; 
	var COLWIDTH = 300; 
	var columns = 3;
	
	$('.sub-child').css('display', 'block');
    $('.sub-child').css('position', 'absolute');
	$('.sub-child > ul').css('position', 'absolute').css('width', COLWIDTH  + 'px');
 
	var compteurBox = 0;
	
	$('.sub-child').each(function() {
		var pointer = 0;
		var compteur = 0;
		var arr = [];
		var max_height = 0;
		$(this).children('ul').each(function() {
				
				compteur++;
				var tempTop;
				var tempLeft;
			
				if (compteur <= columns) { 
					
					tempTop = 0;
					arr[pointer] = $(this).height()+COLMARGIN;
					tempLeft = (pointer * (COLWIDTH));
					max_height = Math.max(max_height,$(this).height()+COLMARGIN);
					pointer++;
					
				}else{
					
					tempTop = arr[0] ;
					indice = 0;
					for(var i = 1 ; i  < arr.length ; i++){
						if(tempTop > arr[i]){
							tempTop = arr[i];
							indice = i;
						}
					}
					tempLeft = (indice * (COLWIDTH));
					arr[indice] += $(this).height()+COLMARGIN;
					max_height = Math.max(max_height,arr[indice]);
				
				}
				
				$(this).css('top', tempTop+15 + 'px');
				$(this).css('left', tempLeft+20 + 'px');
				 
				
				if (pointer === columns) { pointer = 0; }
		
		});
		$(this).height(max_height+30 +'px');
	});
    $('.sub-child').css('display', 'none');

}

$(window).load(function(){ initWindowLoad();


	// PAGE2 HEIGHT
	var pageHeight = $("#footerBottom").offset().top;
	$('#page2').css('height', (pageHeight+200)+'px');
	
	// UL PAGINATION WIDTH
	var nombreLi = $('#pagination-ul > *').length;
	$('#pagination-ul').css('width', (nombreLi*27));
	

		
	/* CHANGE CAROUSEL
	********************************** */
	
	
	$('#carousel_associes .tabs_container .tab').each(function(j){ 
		$(this).click(function(){ 
			$('#carousel_associes .tabs_container .tab').removeClass('actif');
			$('#carousel_associes .tabs_container .tab:eq('+j+')').addClass('actif');
			$('#carousel_associes .carousel_multi').css('display', 'none');
			$('#carousel_associes .carousel_multi').eq(j).css('display', 'block');
			$('#carousel_associes .tabs_container .tab_view_all > a').css('display', 'none');
			$('#carousel_associes .tabs_container .tab_view_all > a:eq('+j+')').css('display', 'block');
		}); 
	});
			
	/* ****************************** */


    // BLOCK CART	
    $("#header #cart_block").hover(function() {
        //$('#cart_block_list').slideDown('slow');
        $('#cart_block_list').stop(true,true).slideDown({ duration: 500, easing: "easeOutBounce"});
    }, function(){
        $('#cart_block_list').stop(true,true).slideUp();     
    });
	
 });
$(document).ready(function(){ initDomReady(); });

$(document).ready(function(){
        if( $.browser.msie == true){
            $('.rounded').each(function() {
                PIE.attach(this); 
                // Previens les bugs d'IE
                $('#menu .rounded').css('display', 'block');
                $('#menu .rounded').css('display', 'none');
                $('#menu .rounded').css('display', '');
                
            });
        }
		menuHeader();
});

function menuHeader() {
	$(".menu-ul > li").hover(function() {
		if($(this).children(".sub-child").css("display") == "none"){
			$(this).children(".sub-child").css("display", "block");
		}
		else {
			$(this).children(".sub-child").css("display", "none");
			}
	}

)}
	

        	
