var curImg = 0;
var animProd = [];

changePicAnim = function() {
	if(animProd.length>0) {
		var oldImg = animProd[curImg];
		curImg = (curImg + 1) % animProd.length; 
		var newImg = animProd[curImg];
		$('#animprod1').attr('src', oldImg);
		$('#animprod2').fadeOut("slow", function(){
			$(this).attr('src', newImg);
			$(this).fadeIn("normal", function(){ window.setTimeout("changePicAnim();", 2000);});							 
	 });
	}
};

$(document).ready(function(){ 

    $("#navigation > ul > li > a").click( 
        function() { 
            
            $('..',this).each(function() {
                    $(this).siblings().children('ul').hide();
    	       }
    	    )
            
            if ($('../ul',this).css("display") == 'block') {
                $('../ul',this).hide();
            }
            else {
                $('../ul',this).show();
            }
        } 
   );
       

    $("#navigation > ul > li > a").each(function() 
        {
            var theClass = $(this).attr('className');
            if(theClass != undefined)
			{
				$('..',this).addClass(theClass);
			}
       }
    )
	
	if(typeof animProd != "undefined" && animProd.length > 0) {
		$("#navigation .preload").remove();
		$("#navigation").prepend('<img id="animprod2" src="' + animProd[curImg] + '" />');
		$("#navigation").prepend('<img id="animprod1" src="' + animProd[animProd.length-1] + '" />');
		window.setTimeout("changePicAnim();", 2000);
	}
	
	$(".sousmenu[@class*=off] ul").hide();
	$(".sousmenu[@class*=off] span").wrap('<a href="#" class="showssMenu"></a>');

	

	 $("a.showssMenu").click(function() {
	 	$(".sousmenu ul").hide();
	 	$(this).siblings("ul").show();
   	});	


});
