﻿function setupNewStories() {
    var NARROW_WIDE = 'narrow'; // 'narrow' or 'wide'
    
    var even = $('.newsStory:nth-child(even)');
    var odd = $('.newsStory:nth-child(odd)');
    var all = $('.newsStory');
    if (NARROW_WIDE == 'narrow') {
        $('#colRTS').append(even);
        $('#colLTS').append(odd);
        $('#colWTS').remove();
        even.addClass('tsNarrow');
        odd.addClass('tsNarrow');
        //Apply border to whichever DIV is the tallest
        if ($('#colRTS').height() < $('#colLTS').height()) {
            $('#colLTS').css('border-right', '1px dotted #A2B964');
        } else {
            $('#colRTS').css('border-left', '1px dotted #A2B964');
        }
        $('#colRTS .newsStory:last-child').css('border-bottom', 'none');
        $('#colLTS .newsStory:last-child').css('border-bottom', 'none');
    } else if (NARROW_WIDE == 'wide') {
        $('#colWTS').append(all);
        $('#colRTS').remove();
        $('#colLTS').remove();
        all.addClass('tsWide');
        $('#colWTS .newsStory:last-child').css('border-bottom', 'none');
    }

    $('<div style="clear:both;"></div>').insertAfter('.newsStory');

}

$(document).ready(function() {
    setupNewStories();
});