$(document).ready(function() {
    FixFooterNavigationWidth();
    ToggleLogInExpandPanel();
    ClearSerarchText();
    StopFaqListClick();
    ToggleFaqListExpandPanel();
    ToggleTipAFriendExpandPanel();
});


function ToggleTipAFriendExpandPanel() {
    $("#pageInfo #share span.tip-a-friend-anchor").click(
        function() {
            $("#tipAFriend").toggle();
        }
    );
}

function FixFooterNavigationWidth() {
    var itemCount = $("#footer #footer-navigation > ul > li").size()
    var width = 100 / itemCount;
    $("#footer #footer-navigation > ul > li").css("width", width + "%");
}


function ToggleLogInExpandPanel() {
    $("#LogIn a.opener").click(
        function() {
            $("#LogIn fieldset.log-in").toggle();
        }
    );
}

function ClearSerarchText() {
    $("#search input").focus(
        function() {
            $(this).val("");
        }
    );
}

function StopFaqListClick() {
    $(".faq-portlet dl dt a").click(
        function() {
            return false
        }
     );
}

function ToggleFaqListExpandPanel() {
    $(".faq-portlet dl dt a").click(
        function() {
            $(this).parent().toggleClass("expanded");
            $(this).parent().next().toggle(); //.slideToggle("slow"); 
        }
    );
}
