/// <reference path="jQuery-vsdoc.js" />

(function($)
{
    $(document).ready(function()
    {
        $("#topMenu a:first").addClass("first");

        //submenu on hover
        $("#topMenu li:has(ul)").hover(
            function(event)
            {
                var that = $(this);
                setTimeout(function() { openMenu(that) }, 100);
            },
            function(event)
            {
                var that = $(this);
                setTimeout(function() { closeMenu(that) }, 100);

            }
           );
        // add extra li's for design to submenu
        //$("#topMenu ul ul").prepend("<li class='firstItem'></li>");
        $("#topMenu ul ul").append("<li class='lastItem'></li>");
        //homeBlocks on hover
        $("div.homeBlock div.trigger").hover(
            function()
            {

                $(this).parent().find("ul.extra").slideDown();

            },
            function()
            {

                $(this).parent().find("ul.extra").slideUp();
            }
          );
        //img tooltip homepage
        /*$("#tooltipTrigger").hover(
            function()
            {
                $("#tooltip").fadeIn("slow");
            },
              function()
              {
                  $("#tooltip").fadeOut("slow");
              }
           );*/
        $("a.show").click(function(event)
        {
            event.preventDefault();
            $(this).next(".extraInfo").toggle();
            if($(this).next(".extraInfo").is(":visible")){
                $(this).text("Read less...");
            }else{
                $(this).text("Read more...");
            }
        })
    });
})(jQuery)

function openMenu(element)
{
    $(element).children("ul").stop(true, true).slideDown();
}
function closeMenu(element)
{
    $(element).children("ul").stop(true, true).slideUp();
}

/* solves the firebug console calls in browsers without firebug */
if (!('console' in window) || !('firebug' in console))
{
    var names = ['log', 'debug', 'info', 'warn', 'error', 'assert', 'dir', 'dirxml', 'group', 'groupEnd', 'time', 'timeEnd', 'count', 'trace', 'profile', 'profileEnd'];
    window.console = {};
    for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() { };
}
