function initializeTicker() {
    var t_div = document.getElementById( "ticker" ); //div that holds ticker
    var d_span = document.createElement( "span" );   //span that will hold date
    var c_div = document.createElement( "div" );     //holds ticker controls
    var ul, lis, a, span;
    var today = new Date();
    var back_text = "\u00ab";
    var next_text = "\u00bb";

    d_span.className = "date";
    d_span.appendChild( document.createTextNode( getDayOfWeek( today.getDay() ) + ", " + getMonthName( today.getMonth() ) + " " + today.getDate() + ", " + today.getFullYear() ) );
    t_div.appendChild( d_span );

    ul = t_div.removeChild( t_div.getElementsByTagName( "ul" ).item( 0 ) )
    lis = ul.childNodes;
    for( var i = 0; i < lis.length; i++ ) {
        if( lis[ i ].nodeName.toUpperCase() == "LI" ) {
            var text = lis[ i ].firstChild.firstChild.nodeValue;
            var url = lis[ i ].firstChild.getAttribute( "href", 2 ); //IE-proprietary iFlag attribute == 2
            // will need to add target

            a = document.createElement( "a" );
            a.appendChild( document.createTextNode( text ) );
            a.href = url;
            t_div.appendChild( a );
        }
    }

    span = document.createElement( "span" );
    span.appendChild( document.createTextNode( back_text ) );
    span.onclick = ticker_back;
    c_div.appendChild( span );

    span = document.createElement( "span" );
    span.appendChild( document.createTextNode( next_text ) );
    span.onclick = ticker_next;
    c_div.appendChild( span );

    c_div.id = "ticker_controls";
    t_div.appendChild( c_div );
}

function getDayOfWeek( day ) {
    var days = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];

    return days[ day ];
}

function getMonthName( month ) {
    var months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];

    return months[ month ];
}

function ticker_next() {
    var t_div = document.getElementById( "ticker" ); //div that holds ticker
    var anchors = t_div.childNodes;
    var mover;
    var i = 0;

    while( anchors[ i ].nodeName.toUpperCase() != "A" ) {
        i++;
    }
    mover = t_div.removeChild( anchors[ i ] );

    t_div.insertBefore( mover, document.getElementById( "ticker_controls" ) );
}

function ticker_back() {
    var t_div = document.getElementById( "ticker" ); //div that holds ticker
    var anchors = t_div.childNodes;
    var mover, span;
    var i = anchors.length - 1;

    while( anchors[ i ].nodeName.toUpperCase() != "A" ) {
        i--;
    }
    mover = t_div.removeChild( anchors[ i ] );

    i = 0;
    while( anchors[ i ].nodeName.toUpperCase() != "SPAN" ) {
        i++;
    }
    span = anchors[ i ];

    t_div.insertBefore( mover, span.nextSibling );
}

addEvent( window, "load", initializeTicker );