// DOM ready check
$(document).ready(function() {


// excerpt triggers on the home page
$(".trigger").toggle(function(){
	$(this).parent().parent().next(".excerpt").removeClass("closed").addClass("open");
	$(this).removeClass("closed").addClass("open");
},function(){
	$(this).parent().parent().next(".excerpt").removeClass("open").addClass("closed");
	$(this).removeClass("open").addClass("closed");
});


// twitter timestamp conversion
function convertTwitterTimes() {
    var month = new Array(12);
    month[0] = "Jan";
    month[1] = "Feb";
    month[2] = "Mar";
    month[3] = "Apr";
    month[4] = "May";
    month[5] = "Jun";
    month[6] = "Jul";
    month[7] = "Aug";
    month[8] = "Sep";
    month[9] = "Oct";
    month[10] = "Nov";
    month[11] = "Dec";
    
    $(".twitter abbr").each(function() {
        var longdate = new Date( $(this).attr("title") );
        
        var hour = longdate.getHours();
        var suffix = "am";
        if( hour > 12 ) {
            hour = hour - 12;
            suffix = "pm";
        }
        
        var minutes = longdate.getMinutes();
        if( minutes < 10 ) {
            minutes = "0" + minutes;
        }

        var datestring = longdate.getDate() + " " + month[longdate.getMonth()] + " " + longdate.getFullYear() + " @ " + hour + ":" + minutes + " " + suffix;
        
        $(this).text(datestring);
    });
}
convertTwitterTimes();




// end DOM ready check
});