<!--

/* ********************************************************************
This script provides reusable methods to handle dynamic interface 
activity, via JavaScript.  These methods are all tested to be HTML 4
complaint and work one MSIE 4/5, and Netscape 4.

NOTE: Reuse without permission is prohibited.
Copyright enLogica, Inc. 2002
neal.cabage@enlogica.com

01. setDropDownValue(form, whichDropDown, whichVal) 
02. getDropDownValue(form, whichDropDown)
03. currDisplayVal(form,whichDropDown)
04. setFieldValue(form, whichTextField, value)
05. setRadioButton(form, radioGroup, val)
******************************************************************** */

/* Set the value of a dropdown menu */
function setDropDownValue(whichForm, whichDropDown, whichVal) {

    var execMe; var i; 
    execMe = "selectCount = document.forms[\"" + whichForm + "\"]." + whichDropDown + ".length;\r";
    execMe = execMe + "for(i=0;i<selectCount;i++) {\r";
    execMe = execMe + "if (document.forms[\"" + whichForm + "\"]." + whichDropDown + ".options[i].value == whichVal) {\r";
    execMe = execMe + "itemIndex = i;\r";
    execMe = execMe + "}\r";
    execMe = execMe + "}\r";	
    execMe = execMe + "document.forms[\"" + whichForm + "\"]." + whichDropDown + ".selectedIndex = itemIndex;\r";
    eval(execMe);
}

/* Retrieve value of a dropdown menu */
function getDropDownValue(whichForm, whichDropDown) {

    var getVal; var i; var execMe;
    execMe = "i = document.forms[\"" + whichForm + "\"]." + whichDropDown + ".selectedIndex;\r";
    execMe = execMe + "getVal = document.forms[\"" + whichForm + "\"]." + whichDropDown + ".options[i].value;\r";
    eval(execMe);
    return(getVal);
}

/* Returns the display value of a dropdown (not the value attribute */
function currDisplayVal(whichForm, whichDropDown) {
		
    execMe = "currIndex = document.forms[\"" + whichForm + "\"]." + whichDropDown + ".selectedIndex;";
    execMe = execMe + "myDisplayVal = document.forms[\"" + whichForm + "\"]." + whichDropDown + ".options[currIndex].text;";
    eval(execMe);	
		
    return(myDisplayVal);
}

/* Set the value of a text field */
function setFieldValue(whichForm, whichTextField, value) {

    var execMe;
    execMe = "document.forms[\"" + whichForm + "\"]." + whichTextField + ".value=\"" + value + "\"";
    eval(execMe);
}

/* Set the value of a radio button group */
function setRadioButton(form, radioGroup, val){

    var group;
    eval("group = document.forms[\""+ form + "\"]." + radioGroup);
    for ( var i=0; i<group.length; i++ ){
         if ( group[i].value==val ){
              group[i].checked = true; break;	
         }
    }
}

//-->