﻿$(document).ready(function () {

    //Clickable blurbs
    $(".blurb-list li, #news-list li, #slideshow li, #right-content .linked").click(
    function () {
        if ($(this).find("a").size() > 0) {
            window.location = $(this).find("a:eq(0)").attr("href");
            return false;
        }
    });

    if ($("body").hasClass("ancient-browser")) {
        //Remove excessive seperator
        $("#footer ul:first").find("li:last-child").css("border-right", "none");
        $("#toplinks, #footer-links").find("li:first-child").css("border-right", "none");

        //Create corners
        $(".blurb-list li").corner("12px");
    }

    $('#slideshow')
    .cycle({
        fx: 'fade',
        speed: 300,
        timeout: 6000,
        pager: "#slide-pager"
    });

    $(".submenu", "#mainmenu").hide();

    $("#mainmenu>li").hover(function () {
        $("#mainmenu .submenu").stop().hide().css("height", "auto");
        var animateSpeed = ($(".submenu", this).find("li").size() * 50);
        $(".submenu", this).slideDown(animateSpeed);
    }, function () {
        $(".submenu", this).stop().hide().css("height", "auto");
    }); ;


    //Force line-break, must be done before cufon!
    $('.helvetica-condensed:contains("-")', "#mainmenu").each(function () {
        if ($(this).children().length < 1)
            $(this).html(
               $(this).text().replace("-", "-<br/>")
           )
    });


    Cufon.replace(".helvetica-condensed");
});
