$(document).ready(function () {

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

        jQuery.fn.center = function (onTopOf) {
            this.css("position","absolute");
            if (onTopOf == null) {
                this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
                this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
            } else {
                var pos = $(onTopOf).position();
                this.css("top", pos.top +  ( $(onTopOf).height() - this.height() ) / 2+  "px");
                this.css("left", pos.left + ( $(onTopOf).width() - this.width() ) / 2+ "px");
            }
            return this;
        }
        // Check sidebars and apply classes to content area
        // 
        width = 16;
        if ($('#sidebar .box').children().length == 0) {
            width += 8
            $('#sidebar .box').remove();
            $('#contentWrap').addClass('span-'+width).removeClass('span-16');
        }


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

        $("input[type=text]").addClass("text");
        $("input[type=password]").addClass("text");
        $("input[type=submit]").addClass("submit");

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

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

        if($.browser.msie){
		$("#topNav li").hover(
		function () {
		    $(this).addClass('sfhover');
		}, 
		function () {
		    $(this).removeClass('sfhover');
		}
		);
        }
});



