var timeout         = 500;

var closetimer		= 0;

var ddmenuitem      = 0;



function menu_open()

{	menu_canceltimer();

	menu_close();

	ddmenuitem = $(this).find('ul').eq(0).css("display","block");

}



function menu_close()

{	if(ddmenuitem) ddmenuitem.css("display","none");}



function menu_timer()

{	closetimer = window.setTimeout(menu_close, timeout);}



function menu_canceltimer()

{	if(closetimer)

	{	window.clearTimeout(closetimer);

		closetimer = null;}}

                



document.onclick = menu_close;



$(document).ready(function(){

    

    // navigation

    $('#navigation > li').bind('mouseover', menu_open);

    $('#navigation > li').bind('mouseout',  menu_timer);

    

    $("#navigation>li").eq(0).addClass("first");

    $("#top-nav>li").eq(0).addClass("first");

    

    //zebra striped comments

    $("ul.commentlist li:odd").addClass("alt");

    

    // top internal link

    $("body a").eq(0).attr("name","top");

    

    //sidebar widgets toggle effect

    $("#sidebar h2").toggle(function(){

        $(this).next().stop().hide(500);

    },function(){

        $(this).next().stop().show(500);

    });

    

    //comments toggle effect

     $("#comments").toggle(function(){   

        $("ul.commentlist").hide(900);

    },function(){

        $("ul.commentlist").show(900);

    });

     

     

     //Reply button functionality

     $("a.reply-link").click(function(){

        var author=$(this).prevAll("span.hidden").html();

        $("textarea#comment").append("&lt;strong&gt;@" + author + "&lt;/strong&gt;");

    });

     

     //Quote button functionality

     $("a.quote-link").click(function(){

        var quote=$(this).prevAll("span.comment-text").text();

        $("textarea#comment").append("&lt;blockquote&gt;" + quote + "&lt;/blockquote&gt;");

    });

     

     
/*
     //Post images Hover transparency transition

    $("#content .entry img").hover(function(){

        $(this).stop().animate({opacity : "1"},200);},

        function(){

        $(this).stop().animate({opacity : "0.85"},200);} 

    );
*/

    



});

