﻿var module = false;

//setup nav icons
if (document.images) {
    tomodule = new Image( 29, 9 );
    tomodule.src = 'images/news_module.gif';
    tomodule_black = new Image( 29, 9 );
    tomodule_black.src = 'images/news_module_black.gif';
    tolist = new Image( 29, 9 );
    tolist.src = 'images/news_list.gif';
    tolist_black = new Image( 29, 9 );
    tolist_black.src = 'images/news_list_black.gif';
}

//change toggle icon onmouseover/onmouseout
function switchtoggle( iID, state ) {
    if (module) {
        if (state > 0) {
            src = tolist_black.src;
        } else {
            src = tolist.src;
        }
    } else {
        if (state > 0) {
            src = tomodule_black.src;
        } else {
            src = tomodule.src;
        }
    }
    document.getElementById( iID ).src = src;
}

//toggle row/grid view
function switchview() {
    if (module) {
        module = false;
        switchtoggle( 'togglel', 0 );
        document.getElementById( 'module' ).style.display = 'none';
        document.getElementById( 'list' ).style.display = '';
    } else {
        module = true;
        switchtoggle( 'toggle', 0 );
        document.getElementById( 'module' ).style.display = '';
        document.getElementById( 'list' ).style.display = 'none';
    }
}   

function init() {
    switchviw();
}