////////////////////////////////////////////////////////////////////
//
//  DEVELOPMENT HISTORY
//
//  JavaScript for various utilities and functions.
//
//  $Id: Utils.js,v 1.2 2009/04/20 15:43:48 whawkins Exp $
//  $Log: Utils.js,v $
//  Revision 1.2  2009/04/20 15:43:48  whawkins
//  Enter PR: 4705
//  Merged CLASS_REL_5_1_1_BRANCH to HEAD.
//
//  Revision 1.1.2.1  2009/04/20 13:22:17  mhamilto
//  Enter PR: 4495
//  JavaScript for various utilities and functions.  First additions are to
//  toggle the display style of a passed object between block and none and
//  to switch two images.
//
//
////////////////////////////////////////////////////////////////////

// Pre-load the plus and minus images used
// to signify expandable/collapsable blocks.
plus_img = new Image(12,12);
plus_img.src = "plus.gif";
minus_img = new Image(12,12);
minus_img.src = "minus.gif";

// Toggle the display style of the passed object
// between block and none.
function toggler (theID) {
    myID = document.getElementById(theID);
    myID.style.display = (myID.style.display == 'block') ? 'none' : 'block';
} //toggler()

// Switch between two images.
function swap_image (image_name, view_a, view_b){
    if (document.images[image_name].src.lastIndexOf(view_a) > 0) {
        path = document.images[image_name].src.substring( 0, document.images[image_name].src.lastIndexOf(view_a) );
        document.images[image_name].src = path + view_b;
    }
    else if (document.images[image_name].src.lastIndexOf(view_b) > 0) {
        path = document.images[image_name].src.substring( 0, document.images[image_name].src.lastIndexOf(view_b) );
        document.images[image_name].src = path + view_a;
    }
} //swap_image()
