//d is the post date, in the format "mm/dd/yyyy hh:mm:ss tt"
//id is the unique ID blogger assigns to the post, which i've also assigned to the surrounding DIV
function adjust_color(d, id) {
    todayDate = new Date(); // returns the current date
    postDate = new Date(d);

	// fix for local times that may be behind the postdate
    if (postDate > todayDate)
    {
	    postDate = todayDate;
    }

    // convert milliseconds to days and round
    dayDiff = Math.round((todayDate-postDate) / 86400000); 

    //colors from http://www.webwhirlers.com/colors/wizard.asp using "#ddddbb" as the seed
    //assign colors in decreasing difference from the background color based on the date difference
    class_name = "";
    switch (dayDiff){
    case 0: 
	  class_name = 'sidebar-content-item neatlink-most-recent';
        backgroundColor="#ddc3bb";
        break;
    case 1: 
	  class_name = 'sidebar-content-item neatlink-less-recent';
        backgroundColor="#ddccbb";
        break;
    case 2: 
	  class_name = 'sidebar-content-item neatlink-least-recent';
        backgroundColor="#ddd4bb";
        break;
    default:
        backgroundColor="#eec"; // default background color
    }

    if (class_name != "")
    {
		document.getElementById(id).className = class_name;
    }
}



