$(document).ready(function(){  
//Cufon
Cufon.replace('h1, h2, h3, h4, h5, h6', { fontFamily: 'Congress', hover:true  });

$("#header .menu li").hoverClass("sfHover");

})

$.fn.hoverClass = function(c) {
    return this.each(function(){
        $(this).hover( 
            function() { $(this).addClass(c);  },
            function() { $(this).removeClass(c); }
        );
    });
	
$(".menu").not(".menu .menu").each(function() {
	W = 0;
	$("a", this).each(function() {
		txt = $(this).html();
		txt = txt.substr(0, txt.length-7);
		txt = txt.replace(/ /g, "&nbsp;");
		$(this).html(txt);
		
		if(W < $(this).width())
			W = $(this).width(); //Plus padding
			
	})
	
	if(W < $(this).parent("li").width())
		W = $(this).parent("li").width() - 10; //Minus the padding
	
	//Set UL width
	$(this).width(W);
	//Set the position of the third level
	$("ul", this).css({"margin-left" : W+40});
	//Set the width of the a
	$("a", this).not(".menu .menu a").width(W);
})
	
$(".menu .menu").each(function() {
	W = 0;
	$("a", this).each(function() {
		if(W < $(this).width())
			W = $(this).width();
	})
	$(this).width(W); $('a', this).width(W);
})

	
	
};
