﻿//Use in News.aspx page

jQuery(document).ready(function() {

    //menu icons
    $(".MenuOver").hover(
        function() {
            $(this).addClass("news_menu_item_over");
        },
        function() {
            $(this).removeClass("news_menu_item_over");
        }
    );


    //show the highlight icon when headlines are hovered
    $(".MenuLinkOver").hover(
        function() {
            var menu_class = $(this).attr("name")
            $('.' + menu_class).addClass("news_menu_item_over")
        },
        function() {
            var menu_class = $(this).attr("name")
            $('.' + menu_class).removeClass("news_menu_item_over");
        }
    );

    //adding news comment section
    $(".CommentButton").click(function() {
        if ($('.CommentForm').css('display') == 'none') {
            $(this).hide("fast", function() {
                $(".CommentForm").show("slow");
            });
        }
    });

    //news menu items
    var $mainmenu = $("#news_drop_menu>ul")
    var $headers = $mainmenu.find("ul").parent()
    $headers.each(function() {
        $(this).hover(
			function() {
			    var $pos = $(this).find("*").filter("div").offset()
			    var $targetul = $(this).children("ul:eq(0)")
			    $targetul.css({left: $pos.left, top: $pos.top + 16})
			    $targetul.slideDown(200)
			},
			function() {
			    var $targetul = $(this).children("ul:eq(0)")
			    $targetul.slideUp(100)
			}
		) //end hover
    }) //end $headers.each()
    $mainmenu.find("ul").css({ display: 'none', visibility: 'visible' })
}) //end document.ready
