(function($) {
	$.fn.bgOpacity = function() {
		return this.each(function() {
			$(this).append('<div class="box_opacity"></div>');
			if ($(this).parent().hasClass('active')) {
				$(this).css('background', 'none');
				$(this).children('.box_opacity').show();
			}
			var el = $(this).children('.box_opacity');
			var titleTop = $('h2#page_title').text();
			var titleHover;


			$(this).hover(
					function(){
						if (!$(this).parent().hasClass('active')) $(this).closest('ul').children('li.active').children('a').children('.box_opacity').stop(true, true).fadeTo('normal', 0);
						$(el).stop(true, true).fadeTo('slow', 1);
						titleHover = $(this).text();
						$('h2#page_title').text(titleHover);
					},
					function(){

						if (!$(this).parent().hasClass('active')) {
							$(this).closest('ul').children('li.active').children('a').children('.box_opacity').stop(true, true).delay(600).fadeTo('normal', 1, function(){
								$('h2#page_title').text(titleTop);
							});
							$(el).stop(true, true).fadeTo('slow', 0);
						}
					}
			);
		});
	}
})(jQuery);

$(document).ready(function(){
	if (!($.browser.msie && $.browser.version == 6)) {
		$('area#link-logo').hover(
			function(){
				$('img#logo-active').stop(true, true).fadeIn();
			},
			function(){
				$('img#logo-active').stop(true, true).fadeOut();
			}
		);

                $('li.addr a').hover(
                        function(){
                                $(this).stop(true, true).fadeTo('normal', 1);
                        },
                        function(){
                                $(this).stop(true, true).fadeTo('slow', 0.5);
                        }
                );
        }

        if (!($.browser.msie && $.browser.version == 6)) {
            $('.menu_bottom ul li a').bgOpacity();
            $('.menu_top ul li a').bgOpacity();
            $('#menu_main_page ul li a').bgOpacity();
        }
});

