// topmost.js
// Preload Tab Images
var agents =    new Image(); agents.src = "/images/topmost/agents_on.gif";
var producers = new Image(); producers.src = "/images/topmost/producers_on.gif";
var writers =  new Image(); writers.src =  "/images/topmost/writers_on.gif";

var divids=new Array('agents_div','producers_div','writers_div');
var tabids=new Array('agents','producers','writers');


function switchid(id,tab){  
        hideallids();
        showdiv(id,tab);
}

function hideallids(){
        //loop through the array and hide each element by id
        for (var i=0;i<divids.length;i++){
                hidediv(divids[i],tabids[i]);
        }                 
}

function hidediv(id,taboff) {
        //safe function to hide an element with a specified id
        if (document.getElementById) { // DOM3 = IE5, NS6
                document.getElementById(id).style.display = 'none';
        }
        else {
                if (document.layers) { // Netscape 4
                        document.id.display = 'none';
                }
                else { // IE 4
                        document.all.id.style.display = 'none';
                }
        }
        // switch tab image to off state
        document.getElementById(taboff).src = "/images/topmost/"+taboff+"_off.gif";
}

function showdiv(id,tab) {
        //safe function to show an element with a specified id
                  
        if (document.getElementById) { // DOM3 = IE5, NS6
                document.getElementById(id).style.display = 'block';
        }
        else {
                if (document.layers) { // Netscape 4
                        document.id.display = 'block';
                }
                else { // IE 4
                        document.all.id.style.display = 'block';
                }
        }
        // switch tab image to current selection
        document.getElementById(tab).src = "/images/topmost/"+tab+"_on.gif";
}
// end types/topmost/js/topmost.js




