(function($){

    $('a.new-window, a[rel=external]').live("click", function(){
        window.open(this.href);
        return false;
    });

    $(document).ready(function () {

        $("li:last-child").addClass("last-child");
        $("li:first-child").addClass("first-child");

        $("img[align='right']","#content").addClass("align-right");
        $("img[align='left']","#content").addClass("align-left");
        $("img[align='center']","#content").addClass("align-center");

        $("#pande a").addClass("new-window");
        // Set this is JS since we know we can unset it on focus
        $("#p").val("search our site");

        swapValues = [];
        $(".swapValue").each(function(i){
            swapValues[i] = $(this).val();
            $(this).focus(function(){
                if ($(this).val() == swapValues[i]) {
                    $(this).val("");
                }
            }).blur(function(){
                if ($.trim($(this).val()) == "") {
                    $(this).val(swapValues[i]);
                }
            });
        });

        if($.browser.msie){
            $("#topNav li").hover(
                function () {
                    $(this).addClass('sfhover');
                }, 
                function () {
                    $(this).removeClass('sfhover');
                }
            );
        }
        $(".sidebarContent","div.top").hover(
                function () {
                    $("#galMore").fadeOut();
                    $(this).animate({height:"450px"}, {queue:false, duration:1000});

                }, 
                function () {
                    $(this).animate({height:"220px"}, {queue:false, duration:1000});
                    $("#galMore").fadeIn();
                }
            );

        
    });
})(jQuery);

