function ExpandNews() {
    // Look to cookie object to see if cookie exists. Cookie Name = 'Landmark.News';
    // If cookie is there read contents and process
    // otherwise show the news for current year and hide all others.
    
    var cookieName = 'Landmark.News';
    $(".content").hide();
    
    if ($.cookie(cookieName) != null) {
        processCookie();
    }
    else {
        showDefault();
    }
    createCookie();

    // Opens the current year and hides all others. Default behaviour.
    function showDefault() {        
        var date = new Date().getFullYear();
        $("#news_archive_" + date).show();
        setBackgroundImage("news_" + date, true);        
    };

    // Process the cookie and set the expansions types the same as 
    // the cookie values.
    function processCookie() {
        var values = $.cookie(cookieName).split(",");
        if (values === null) { return false };
        for (var i = 0; i < values.length; i++) {
            if (values[i] != 'default') {
                var item = $('#' + values[i]);
                if (item) {
                    $(item).show();
                    var id = values[i].replace('_archive', '');
                    setBackgroundImage(id, true);
                }
            }
        }        
    };

    // Creates the cookie with the current settings
    // with the selected expansions.
    function createCookie() {
        var values = [];
        values.push("default");
        // Grab all elements with a class of expand
        var els = $(".content");

        for (var i = 0; i < els.length; i++) {
            var item = els[i];
            if (!$(item).is(":hidden")) {
                values.push(item.id);
            }
        }
        $.cookie(cookieName, values, { path: '/news'});
    };

    $(".expand").live('click', function() {
        var that = this;
        var contentEl = $(this).parent().next(".content");
        contentEl.slideToggle(200, function() {
            var isOpen = !$(this).is(':hidden');
            setBackgroundImage(that.id, isOpen);
            createCookie();
        });        
        return false;
    });

    function setBackgroundImage(id, isOpen) {
        if (isOpen) {
            $('#' + id).css("background-image", "url(/Content/images/drop-down-arrow-open.gif)");
        } else {
            $('#' + id).css("background-image", "url(/Content/images/drop-down-arrow.gif)")
       }        
    }
};
