function printYear() {
    var today = new Date();
    document.write(today.getFullYear());
}

$(document).ready(function() {

    $("#promo li").hover(
		function() {
		    $("#promo li").removeClass('active');
		    $(this).addClass('active');
		    var getimg = $(this).find('a').attr('rel');
		    $("#promo div p img").attr('src', getimg);
		    var gettitle = $(this).find('a').text();
		    $("#promo div p.title").text(gettitle);
		    var getcopy = $(this).find('span').attr('title');
		    $("#promo div p.copy").text(getcopy);
		},
		function() {
		}
	);
    $("#promo li:first").each(function() {
        $("#promo li").removeClass('active');
        $(this).addClass('active');
        var getimg = $(this).find('a').attr('rel');
        $("#promo div p img").attr('src', getimg);
        var gettitle = $(this).find('a').text();
        $("#promo div p.title").text(gettitle);
        var getcopy = $(this).find('span').attr('title');
        $("#promo div p.copy").text(getcopy);
    });

    $('#promo .info').before('<img src="/system/assets/images/promo-corners.png" alt="" width="606" height="228" class="promo-rounded" style="position:absolute; z-index:10;" />');

    $('.carousel ul').jcarousel({
        'scroll': 2
    });

    $(".news ul").after('<div><a href="#" class="prev"><img src="/system/assets/images/news-prev.gif" /></a><a href="#" class="next"><img src="/system/assets/images/news-next.gif" /></a></div>');
    $(".news li").hide();
    $(".news .prev").hide();
    $(".news li:first").show();
    $(".news li:first").addClass('news-show');

    $(".news .next").click(function() {
        if ($('.news li').eq(-2).hasClass('news-show')) {
            $(".news li.news-show")
				.hide()
				.removeClass("news-show")
				.addClass("news-hide")
				.next()
				.show()
				.removeClass("news-hide")
				.addClass("news-show");
            $(".news .next").hide();
            return false;
        } else {
            $(".news li.news-show")
				.hide()
				.removeClass("news-show")
				.addClass("news-hide")
				.next()
				.show()
				.removeClass("news-hide")
				.addClass("news-show");
            $(".news .prev").show();
            return false;
        }
    }
	);

    $(".news .prev").click(function() {
        if ($('.news li').eq(1).hasClass('news-show')) {
            $(".news li.news-show")
				.hide()
				.removeClass("news-show")
				.addClass("news-hide")
				.prev()
				.show()
				.removeClass("news-hide")
				.addClass("news-show");
            $(".news .prev").hide();
            return false;
        } else {
            $(".news li.news-show")
				.hide()
				.removeClass("news-show")
				.addClass("news-hide")
				.prev()
				.show()
				.removeClass("news-hide")
				.addClass("news-show");
            $(".news .next").show();
            return false;
        }
    }
	);



    $('#news-show').click(function() {
        $(".carousel").css('top', '-10000px');
        $("#news").css('top', '53px');
        $(".carousel p").hide();
        $("#news p").show();
        $('#tab-options li a').removeClass('active');
        $(this).addClass('active');
        return false;
    });

    $('#events-show').click(function() {
        $(".carousel").css('top', '-10000px');
        $("#events").css('top', '53px');
        $(".carousel p").hide();
        $("#events p").show();
        $('#tab-options li a').removeClass('active');
        $(this).addClass('active');
        return false;
    });

    $('#video-show').click(function() {
        $(".carousel").css('top', '-10000px');
        $("#video").css('top', '53px');
        $(".carousel p").hide();
        $("#video p").show();
        $('#tab-options li a').removeClass('active');
        $(this).addClass('active');
        return false;
    });


    var searchbox = $(".search .form-text");
    searchbox.focus(function() {
        if ($(this).attr("value") == "Search...") $(this).attr("value", "");
        if ($(this).attr("value") != "Search...") $(this).css("color", "#333333");
    });
    searchbox.blur(function() {
        if ($(this).attr("value") == "") $(this).attr("value", "Search...");
        if ($(this).attr("value") == "Search...") $(this).css("color", "#8d8d8d");
    });

    $('.nav-primary > ul > li').each(function(i, e) {
        $(e).addClass('m' + (i + 1));
    });
    $('#home-row-2 p.read a').bigTarget({ clickZone: 'div:eq(0)' });

    $(':first-child').addClass('first');
    $(':last-child').addClass('last');
    $('a[rel=newWindow]').attr('target', '_blank');
});
