//reloads the window if Nav4 resized
function MM_reloadPage(init) {  
 
 if (init==true) with (navigator) {
 
   if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
 
     document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;
     onresize=MM_reloadPage; 
   }
 
 }
 
   else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)     
 
     location.reload();
 
 }
 
MM_reloadPage(true);


// Give focus to a form element
function setFocus (form,input) {
    if (document.forms) {
        document.forms[form].elements[input].focus();
    }
}

// Change an element's css class
//
function swpClass (obj,cssClass) {
    if (obj)  
    {
      if (obj.className) {
        obj.className = cssClass;
     }
    }
}

// Private function for creating functions that change an element's css class
//
function _ClosureSetClassName (css) {
    return function (id) {
        if (document.getElementById) {
            var element = document.getElementById(id);
	    swpClass(element,css);
        }
    }
}


// Create functions for manipulating css classes
//
var show    = _ClosureSetClassName('Visible');   // make an element visible
var unshow  = _ClosureSetClassName('Hidden');    // make an element invisible

// Display a list based on the selection of another list
//
function showChoices (list, prefix) {
    if (document.getElementById) {
        if (list && list.options) {
            for (i = 0 ; i < list.options.length ; i++) {
                var num   = list.options[i].value;
                var value = prefix + ((parseInt(num)) ? num : '0' );
                if (document.getElementById(value)) unshow(value);
            }

            var num    = list.value;
            var value  = prefix + ((parseInt(num)) ? num : '0' );
            var values = new Array(value, prefix + '0');

            for (i = 0 ; i < values.length ; i++) {
                if (document.getElementById(values[i])) {
                    show(values[i]);
                    break;
                }
            }
        }
    }
}


// Change the options in a drop-down list (obsoletes above)
//
function setOptionsList (targetObj,newlist)
{
    if (list = targetObj.options)
    {
        var selectedValue  = arguments[2];
        var selection      = selectedValue || list[list.selectedIndex].value;

        list.selectedIndex = -1;
        list.length        = newlist.length;
        
        for (var i = 0 ; i < list.length ; i++)
        {
            list[i].value = newlist[i][0];
            list[i].text  = newlist[i][1];

            if (list[i].value == selection)
            {
                list[i].selected = true; // make sure previously selected options persist
            }
        }    
    }
}


// Private function for creating functions that control tabs
//
function _ClosureShowSelectedElement (numOfTabs,elementPrefix) {
    return function (element) {
        for (var i = 1; i <= numOfTabs; i++) {
	    menuName = elementPrefix + i;
            if (document.getElementById(menuName)){
	        if (element == menuName){
		    document.getElementById(element).style.display = 'block';
		} else {
		    document.getElementById(menuName).style.display = 'none';
		}
	    }
	}
    return;    
    }
}
