$(document).ready(function(){
// The status of the project is loaded from Projects.xml in the Fast Facts, then bounced on up to this status bar.
// Unless the status isn't listed there or is spelted encorektlee. Then the Status bar is not shown at all.

// Extra Strong Tag removed from Fast Facts area. This tag is in place for the Javascriptless. 
    $("li#statustype strong").remove();

// Finds xml generated text from the UL, writes HTML accordingly
    $("li#statustype:contains('Long-Range Studies')").html("<li><div id='statusactive'></div></li><li><div></div></li><li><div></div></li><li><div></div></li>");
    $("li#statustype:contains('Projects Under Development')").html("<li><div></div></li><li><div id='statusactive'></div></li><li><div></div></li><li><div></div></li>");
    $("li#statustype:contains('Projects Under Construction')").html("<li><div></div></li><li><div></div></li><li><div id='statusactive'></div></li><li><div></div></li>");
    $("li#statustype:contains('Archive')").html("<li><div></div></li><li><div></div></li><li><div></div></li><li><div id='statusactive'></div></li>");

// Add some ID's and Classes
    $("li#statustype li:nth-child(1)").attr({id:"status1"});
    $("li#statustype li:nth-child(2)").attr({id:"status2"});
    $("li#statustype li:nth-child(3)").attr({id:"status3"});
    $("li#statustype li:nth-child(4)").attr({id:"status4"}).addClass("oneline");

// Name each status 
    $("li#status1 div").html("Long-Range<br />Studies");
    $("li#status2 div").html("In<br />Development");
    $("li#status3 div").html("Under<br />Construction");
    $("li#status4 div").html("Complete");

// Add title text
    $("li#status1 div").attr({title:"Projects resulting from these studies are generally at least 10 years or more from construction."});
    $("li#status2 div").attr({title:"Planning and/or design is underway and are generally less than 10 years from right-of-way acquisition or construction."});
    $("li#status3 div").attr({title:"The projects in this section have been awarded contracts and are currently under construction."});
    $("li#status4 div").attr({title:"Projects that fall in this category are, in most cases, complete."});

// Sets up the wrapping div's content
    $("div#statusbarwrap").addClass("fgray small").html("<div id='statusbar'><h4 class='fwhite alignleft'>Status</h4><ul class='white alignleft aligncenter'></ul></div>");

// Moves the LI's to Status Bar
    $("li#statustype li").appendTo("div#statusbar ul");

// Removes unused li from DOM
    $("li#statustype").remove();

// If no status is in projects.xml, or the wrong status is listed, the whole status bar is tossed.
    $("div#statusbar ul:empty").closest("div").remove();
});