// Global Variables
fstClockTimeoutId = null;

function ord( chr )
{
    return (chr+' ').charCodeAt(0);
}

function strToHex( str )
{
    var hexStr = '';
    for( var i = 0; i < str.length; i++ )
        hexStr += ord(str[i]).toString(16) + ' ';
    return hexStr;
}

/*** FST Time Conversion ***/
function fstGetTime()
{
    var d = new Date();

    // This sets the time in d to FST (UTC-6 hours)
    d.setTime( d.getTime() + ( d.getTimezoneOffset() * 60000 ) - 6*60*60*1000 );
    return d.toLocaleTimeString();
}


function fstSetTime()
{
    document.getElementById( 'fst_clock' ).innerHTML = fstGetTime();
    fstClockTimeoutId = setTimeout( 'fstSetTime( "fst_clock" )', 1000 );
}


/*** Menu ***/
function menuSelect( sectionObj )
{
    var sectionID = sectionObj.id.substr(4);
    var obj;

    sectionObj.className = 'nav_section';
    document.getElementById( 'navc_' + sectionID ).style.display = 'block';

    for( var i = 1; i <= totalSections; i++ )
    {
        if( i == sectionID ) continue;

        document.getElementById( 'nav_' + i ).className = 'nav_section_off';
        document.getElementById( 'navc_' + i ).style.display = 'none';
    }
}


function menuSelectAll()
{
    for( var i = 1; i <= totalSections; i++ )
    {
        document.getElementById( 'nav_' + i ).className = 'nav_section_off';
        document.getElementById( 'navc_' + i ).style.display = 'block';
    }
}


function menuHide()
{
    document.getElementById( 'side_menu' ).style.display = 'none';
    document.getElementById( 'nav_icon' ).style.display = 'block';
}


function menuShow()
{
    document.getElementById( 'side_menu' ).style.display = 'block';
    document.getElementById( 'nav_icon' ).style.display = 'none';
}


/*** Initialization Functions ***/
function ftrInit()
{
    menuSelect( document.getElementById( 'nav_' + cs ) );
    fstSetTime();

    if( menuAutoHide ) menuHide();
}

/*** Initialization ***/
window.onload = ftrInit; 

