<!--

function setDynaList(arrDL, none_available)
{
	var oListBox1 = document.forms[arrDL[2]].elements[arrDL[1]];
	var oListBox2 = document.forms[arrDL[4]].elements[arrDL[3]];
	var arrListItem = arrDL[5];
 
	clearDynaList(oListBox2);
 
	if (oListBox1.length > 0)
	{
		if (oListBox1.selectedIndex == -1)
		{
			oListBox1.selectedIndex = 0;
		}

		populateDynaList(oListBox2, oListBox1[oListBox1.selectedIndex].value, arrListItem, none_available);
	}
	return true;
}

function populateListBox(ListBox, arrListItem)
{
	var oListBox = document.Form1.elements[ListBox];
	var i;
	
	clearDynaList(oListBox);
	for (i=0; i<arrListItem.length; i=i+2)
	{
		oListBox.options[oListBox.options.length] = new Option(arrListItem[i], arrListItem[i+1]);
	}
	return true;
}

function setJointDynaList(arrDL, none_available) // 2 Parent list boxes
{
	var oListBox1 = document.forms[arrDL[2]].elements[arrDL[1]];
	var oListBox2 = document.forms[arrDL[4]].elements[arrDL[3]];
	var oListBox3 = document.forms[arrDL[6]].elements[arrDL[5]];
	var arrListItem = arrDL[7];
	var jointValue;
 
	clearDynaList(oListBox3);
 
	if ((oListBox1.length > 0) && (oListBox2.length>0))
	{
		if (oListBox1.selectedIndex == -1)
		{
			oListBox1.selectedIndex = 0;
		}
		
		if (oListBox2.selectedIndex == -1)
		{
			oListBox2.selectedIndex = 0;
		}

		jointValue = oListBox1[oListBox1.selectedIndex].value + ' - ' + oListBox2[oListBox2.selectedIndex].value;
		
		populateDynaList(oListBox3, jointValue, arrListItem, none_available);
	}
	return true;
}

function set3JointDynaList(arrDL, none_available) // 3 Parent list boxes
{
	var oListBox1 = document.forms[arrDL[2]].elements[arrDL[1]];
	var oListBox2 = document.forms[arrDL[4]].elements[arrDL[3]];
	var oListBox3 = document.forms[arrDL[6]].elements[arrDL[5]];
	var oListBox4 = document.forms[arrDL[8]].elements[arrDL[7]];
	var arrListItem = arrDL[9];
	var jointValue;
 
	clearDynaList(oListBox4);
 
	if ((oListBox1.length > 0) && (oListBox2.length>0) && (oListBox3.length>0))
	{
		if (oListBox1.selectedIndex == -1)
		{
			oListBox1.selectedIndex = 0;
		}
		
		if (oListBox2.selectedIndex == -1)
		{
			oListBox2.selectedIndex = 0;
		}
		
		if (oListBox3.selectedIndex == -1)
		{
			oListBox3.selectedIndex = 0;
		}

		jointValue = oListBox1[oListBox1.selectedIndex].value + ' - ' + oListBox2[oListBox2.selectedIndex].value + ' - ' + oListBox3[oListBox3.selectedIndex].value;
		
		populateDynaList(oListBox4, jointValue, arrListItem, none_available);
	}
	return true;
}
 
function setList(arrDL, none_available)
{
	var oListBox = document.forms[arrDL[2]].elements[arrDL[1]];
	var arrListItem = arrDL[3];
 
	clearDynaList(oListBox);
 
	populateList(oListBox, arrListItem, none_available);
	
	return true;
}
 
function clearDynaList(oListBox)
{
	var i;
	
	oListBox.selectedIndex = -1;
	for (i = oListBox.options.length; i >= 0; i--)
	{
		oListBox.options[i] = null;
	}
}

function setDynaField(arrDL)
{
	var oList = document.forms[arrDL[2]].elements[arrDL[1]];
	var oField = document.forms[arrDL[4]].elements[arrDL[3]];
	var arrListItem = arrDL[5];
 
	oField.value='';
 
	if (oList.length > 0)
	{
		if (oList.selectedIndex == -1)
		{
			oList.selectedIndex = 0;
		}

		populateDynaField(oField, oList[oList.selectedIndex].value, arrListItem);
	}
	return true;
}

function populateDynaField(oField, filterValue, arrListItem)
{
	var i;
	for (i = 0; i < arrListItem.length; i= i + 2)
	{
  		if (arrListItem[i] == filterValue)
  		{
			oField.value = arrListItem[i + 1];
		}
	}
}
 
function populateDynaList(oListBox, filterValue, arrListItem, none_available)
{
	var i;
	
	for (i = 0; i < arrListItem.length; i= i + 3)
	{
  		if (arrListItem[i] == filterValue)
  		{
			oListBox.options[oListBox.options.length] = new Option(arrListItem[i + 1], arrListItem[i + 2]);
		}
	}
	
	if ((oListBox.options.length == 0) && (none_available))
	{
		oListBox.options[oListBox.options.length] = new Option("[none available]",0);
	}
	
	if (oListBox.options.length == 0)
	{
		oListBox.selectedIndex = -1;
	}
	else
	{
		oListBox.selectedIndex = 0;
	}
}

function select_ddl(ddl, value_field, text_field)
{
	var objForm = document.forms[0];
	var objSelect = objForm.elements[ddl];
	
	if (objSelect.selectedIndex != -1)
	{
		eval('window.document.Form1.' + value_field + '.value=window.document.Form1.' + ddl + '.options[window.document.Form1.' + ddl + '.selectedIndex].value'); 
		if (text_field != null)
		{
			eval('window.document.Form1.' + text_field + '.value=window.document.Form1.' + ddl + '.options[window.document.Form1.' + ddl + '.selectedIndex].text');
		}
	}
	else
	{
		eval('window.document.Form1.' + value_field + '.value=""'); 
		if (text_field != null)
		{
			eval('window.document.Form1.' + text_field + '.value=""');
		}	
	}
}

function populateList(oListBox, arrListItem, none_available)
{
	var i;
	
	for (i=0; i<arrListItem.length; i=i+2)
	{
  		oListBox.options[oListBox.options.length] = new Option(arrListItem[i], arrListItem[i + 1]);
	}
	
	if ((oListBox.options.length == 0) && (none_available))
	{
		oListBox.options[oListBox.options.length] = new Option("[none available]",0);
	}
	
	if (oListBox.options.length == 0)
	{
		oListBox.selectedIndex = -1;
	}
	else
	{
		oListBox.selectedIndex = 0;
	}	
}

function addToListShowAll(oListBox)
{
	if (oListBox.options.length>0)
	{
		if (oListBox.options[0].value!='0')
		{
			oListBox.options[oListBox.options.length] = new Option("[show all]",'All');
		}
	}
}

function (arrDL)
{
	var oListBox = document.forms[arrDL[2]].elements[arrDL[1]];
	var oTextField = document.forms[arrDL[4]].elements[arrDL[3]];
	var arrList = arrDL[5];
 
	otextField.value='';
 
	if (oListBox.length > 0)
	{
		if (oListBox.selectedIndex == -1)
		{
			oListBox.selectedIndex = 0;
		}

		populateDynaField(oTextField, oListBox[oListBox.selectedIndex].value, arrList);
	}
	return true;
}

function populateDynaField(oTextField, filterValue, arrItemList)
{
	var i;
	
	for (i=0; i<arrItemList.length; i=i+2)
	{
  		if (arrItemList[i] == filterValue)
  		{
			oTextField.value = arrItemList[i+1];
		}
	}
}

function selectList(oListBox)
{	
	if ((oListBox.selectedIndex==-1)&&(oListBox.length>0))
	{
		oListBox.selectedIndex=0;
	}
}

function findOption(strText,strOption)
{
	var objSelect = document.Form1.elements[strOption];
	var strOptionText;
	var i;
	var found=false;
	
	strText=strText.toUpperCase();
	for(i=0;i<objSelect.length;i++)
	{
		strOptionText=objSelect.options[i].text.toUpperCase();
		if (strOptionText.indexOf(strText)!=-1)
		{
			objSelect.selectedIndex=i;
			found = true;
			break;
		}
	}
	if (found == false)
	{
		objSelect.selectedIndex = -1
	}
	return found;
}

function findOption_value(strText,strOption)
{
	var objSelect = document.Form1.elements[strOption];
	var strOptionText;
	var i;
	var found=false;
	
	strText=strText.toUpperCase();
	for(i=0;i<objSelect.length;i++)
	{
		strOptionText=objSelect.options[i].value.toUpperCase();
		if (strOptionText.indexOf(strText)!=-1)
		{
			objSelect.selectedIndex=i;
			found = true;
			break;
		}
	}
	if (found == false)
	{
		objSelect.selectedIndex = -1
	}
	return found;
}

function filter_list_box(Value, ListBox)
{
	var oListBox = document.Form1.elements[ListBox];
	var OptionText;
	var found = false;
	var i;

	Value=Value.toUpperCase();	
	for (i=0;i<oListBox.length;i++)
	{
		OptionText = oListBox.options[i].text.toUpperCase();
		if (OptionText.indexOf(Value) == -1)
		{
			oListBox.options[i]=null;
			i--;
		}
		else
		{
			found = true;
		}
	}
	return found;
}

function filter_list_box_start(Value, ListBox)
{
	var oListBox = document.Form1.elements[ListBox];
	var OptionText;
	var found = false;
	var i;

	Value=Value.toUpperCase();
	for (i=0;i<oListBox.length;i++)
	{
		OptionText = oListBox.options[i].text.toUpperCase();
		if (OptionText.indexOf(Value) == 0)
		{
			found = true;
		}
		else
		{
			oListBox.options[i]=null;
			i--;
		}
	}
	return found;
}

function add_list_box_items(ListBoxFrom, ListBoxTo)
{
	var oListBoxFrom = document.Form1.elements[ListBoxFrom]
	var oListBoxTo = document.Form1.elements[ListBoxTo]
	var i;	
	var j;
	var bln;
	for (i=0;i<oListBoxFrom.length;i++)
	{
		if (oListBoxFrom.options[i].selected)
		{
			bln = false;
			for (j=0;j<oListBoxTo.length;j++)
			{
				if (oListBoxFrom.options[i].value == oListBoxTo.options[j].value)
				{
					bln = true;
				}
			}
			if (bln == false)
			{
				oListBoxTo.length++;
				oListBoxTo.options[oListBoxTo.length-1].value = oListBoxFrom.options[i].value;
				oListBoxTo.options[oListBoxTo.length-1].text = oListBoxFrom.options[i].text;
			}
			oListBoxFrom.options[i].selected=false;
		}
	}
}

function add_list_box_items_all(ListBoxFrom, ListBoxTo)
{
	var oListBoxFrom = document.Form1.elements[ListBoxFrom]
	var oListBoxTo = document.Form1.elements[ListBoxTo]
	var i;	
	var j;
	var bln;
	for (i=0;i<oListBoxFrom.length;i++)
	{
		bln = false;
		for (j=0;j<oListBoxTo.length;j++)
		{
			if (oListBoxFrom.options[i].value == oListBoxTo.options[j].value)
			{
				bln = true;
			}
		}
		if (bln == false)
		{
			oListBoxTo.length++;
			oListBoxTo.options[oListBoxTo.length-1].value = oListBoxFrom.options[i].value;
			oListBoxTo.options[oListBoxTo.length-1].text = oListBoxFrom.options[i].text;
		}
		oListBoxFrom.options[i].selected=false;
	}
}

function remove_list_box_items(ListBox)
{
	var oListBox = document.Form1.elements[ListBox]
	var i;	
	for (i=0;i<oListBox.length;i++)
	{
		if (oListBox.options[i].selected)
		{
			oListBox.options[i]=null;
			i--;
		}
	}
}

function remove_list_box_items_all(ListBox)
{
	var oListBox = document.Form1.elements[ListBox]
	var i;	
	for (i=0;i<oListBox.length;i++)
	{
		oListBox.options[i]=null;
		i--;
	}
}

function remove_unselected_list_box_items(ListBox)
{
	var oListBox = document.Form1.elements[ListBox]
	var i;	
	for (i=0;i<oListBox.length;i++)
	{
		if (oListBox.options[i].selected == false)
		{
			oListBox.options[i]=null;
			i--;
		}
	}
}

function order_list_box_items(ListBox)
{
	var oListBox = document.Form1.elements[ListBox];
	var i;	
	for (i=0;i<oListBox.length-1;i++)
	{
		if (oListBox.options[i].text > oListBox.options[i+1].text)
		{
			oListBox.length++;
			oListBox.options[oListBox.length-1].value = oListBox.options[i].value;
			oListBox.options[oListBox.length-1].text = oListBox.options[i].text;
			oListBox.options[i]=null;
			i=-1;
		}
	}
}

function sort_list_box_items(ListBox)
{
	var oListBox = document.Form1.elements[ListBox];
	var i;
	var arrObj = new Array();
	var arrText = new Array();
	var obj;
	for (i=0;i<oListBox.length;i++)
	{
		obj = new Object();
		obj.id = oListBox.options[i].value;
		obj.text = oListBox.options[i].text;
		arrObj.push(obj);
		arrText.push(oListBox.options[i].text + '@' + i);
	}
	
	arrText.sort();
	clearDynaList(oListBox);
	var text = new Array();
	var idx;
	for (i=0;i<arrText.length;i++)
	{
		text = arrText[i].split('@');
		idx = parseInt(text[1]);
		oListBox.options[oListBox.options.length] = new Option(arrObj[idx].text,arrObj[idx].id);
		objAdd = null;
	}
}

function order_list_box_items_courses(ListBox)
{
	var oListBox = document.Form1.elements[ListBox];
	var arrCourse = new Array();
	var strCourseID;
	var strCourse;
	var intCourse;
	var intCourseLength;
	var intCourseIDLength;
	var i;
	
	intCourseIDLength=6;	
	intCourse=oListBox.length;
	
	for (i=0;i<intCourse;i++)
	{
		strCourse = oListBox.options[i].text;
		strCourseID = strCourse.substr(0,intCourseIDLength);
		strCourse = strCourse.substr(intCourseIDLength+3,strCourse.length);
		arrCourse[i] = strCourse + strCourseID;
	}
	
	arrCourse = arrCourse.sort();
		
	for (i=0;i<intCourse;i++)
	{
		strCourse = arrCourse[i];
		intCourseLength = strCourse.length;
		strCourseID = strCourse.substr(intCourseLength-intCourseIDLength,intCourseLength);
		strCourse = strCourse.substr(0,intCourseLength-intCourseIDLength);
		oListBox.options[i].value = strCourseID;
		oListBox.options[i].text = strCourseID + ' - ' + strCourse;
	}
}

function capture_list_box_values(ListBox, TextField)
{
	var oListBox = document.Form1.elements[ListBox];
	var oTextField = document.Form1.elements[TextField];
	var i;
		
	oTextField.value = '';
	for (i=0;i<oListBox.length;i++)
	{
		oTextField.value += '@' + oListBox.options[i].value;
	}
	if (oTextField.value.indexOf("@") != -1)
	{
		oTextField.value = oTextField.value.substring(1, oTextField.value.length)
	}			
}

function capture_list_box_selected_values(ListBox, TextField)
{
	var oListBox = document.Form1.elements[ListBox];
	var oTextField = document.Form1.elements[TextField];
	var i;
		
	oTextField.value = '';
	for (i=0;i<oListBox.length;i++)
	{
		if (oListBox.options[i].selected)
		{
			oTextField.value += '@' + oListBox.options[i].value;
		}
	}
	if (oTextField.value.indexOf("@") != -1)
	{
		oTextField.value = oTextField.value.substring(1, oTextField.value.length)
	}		
}

--> 