// DOM Ready
window.onload = (function() {
						  
						  
	/*
        CALCUL DE LA MARGE DES ITEMS
    */
	/*
	var largeurGlobal = 953;
	var nbItems = 7;
	var margeGlobal = largeurGlobal;
	
	$('a.menulink').each(function(){
		margeGlobal -= $(this).width();
	});
	
	var margeByItem = margeGlobal / (nbItems*2);
	margeByItem = Math.floor(margeByItem)
		
	$('a.menulink').css({
		marginRight : margeByItem+"px",
		marginLeft : margeByItem+"px"
	});				  
						  
	*/
	
	
	
   
    /*
        EXAMPLE ONE
    */
    
    /* Add Magic Line markup via JavaScript, because it ain't gonna work without */
    $("#example-one").append("<li id='magic-line'></li>");
    
    /* Cache it */
    var $magicLine = $("#magic-line");
    
	
    $magicLine
        .width($("#current_page_item").width())
        .css("left", $("#current_page_item a").position().left)
        .data("origLeft", $magicLine.position().left)
        .data("origWidth", $magicLine.width());
        
    $("#example-one .item").hover(function() {
        $el = $(this).find("a");
        leftPos = $el.position().left;
        newWidth = $el.parent().width();
        
        $magicLine.stop().animate({
            left: leftPos,
            width: newWidth
        });
    }, function() {
        $magicLine.stop().animate({
            left: $magicLine.data("origLeft"),
            width: $magicLine.data("origWidth")
        });    
    });
   
    
    /* Kick IE into gear */
    $("#current_page_item_two a").mouseenter();
    
});

