(function($){
$.fn.setMenu = function(){
	return this.each(function(){
		var menu = $(this);
		var initselected = $('li.selected', menu).addClass('over').length;
		var blogtimer, menutimer;
		$('li a', menu).each(function(){
			var backgroundcolor = $('.blog-title', this).css('background-color');
			var bubble = $('<div class="blog-description"></div>').insertAfter($(this)).html('<p>'+$(this).attr('title')+'</p>');
			if(bubble.height()>100){
				bubble.width(304).find('p').width(280);
				if(bubble.height()>100){
					bubble.width(404).find('p').width(380);
					if(bubble.height()>100){
						bubble.width(504).find('p').width(480);
					}
				}
			}
			var bubblearrow = $('<span class="bubble-arrow"></span>');
			$(this).attr('title','');
			if (!($.browser.msie&&($.browser.version<7))){
				$(this).append(bubblearrow);
			}
			if($('li', menu).index($(this).parent())>3){
				bubble.addClass('left').css({'margin-left':(bubble.width()+5)*-1});
				bubblearrow.addClass('left');
			}
			if (initselected && !$(this).parent().is('.selected')){
				$('.fadeout', this).show();
			}
		}).bind('mouseover focus click', function(){
			var blog = $(this).parent();
			clearTimeout(blogtimer);
			if (!initselected){
				blog.addClass('selected').siblings().removeClass('selected');
			}
			blog.addClass('over').siblings().removeClass('over').find('.bubble-arrow').stop().css({opacity:1}).hide().end().find('.blog-description').stop().css({opacity:1}).hide().end().find('.fadeout').show();
			blog.find('.bubble-arrow').fadeIn(100).end().find('.blog-description').fadeIn(100);
			blog.find('.fadeout').hide();
		}).bind('mouseout blur', function(){
			var blog = $(this).parent();
			blogtimer=setTimeout(function(){
				$('li.over', menu).removeClass('over');
				blog.find('.bubble-arrow').fadeOut(100).end().find('.blog-description').fadeOut(100);
				if(!blog.is('.selected')){blog.find('.fadeout').fadeIn(100);}
			}, 100);
		});
		menu.bind('mouseout blur',function(){
			menutimer=setTimeout(function(){
				if (initselected){
				$('li.selected', menu).addClass('over').find('.bubble-arrow').fadeIn(100).end().find('.blog-description').fadeIn(100).end().find('.fadeout').fadeOut(100);
				} else{
					$('.fadeout', menu).fadeOut(100);
				}
			},300);
		}).bind('mouseover focus', function(){
			clearTimeout(menutimer);
		});
		$('li.selected', menu).addClass('over').find('.bubble-arrow').fadeIn(100).end().find('.blog-description').fadeIn(100);
		$('a, input, select, textarea, [tabindex]').focus(function(){
			if($('.over', menu).length<1){
				menu.trigger('blur');
			}
		});
	});
};
})(jQuery);
