function lst_SetFocus(objText, objList)
	{
		var nOptionNO;
		var strTarget;
		var strTemp;
		var strRetVal;
		var i,nPos,nFirstPos;
		strRetVal = "";				
		strTarget = objText.value;
		
		nOptionNO = objList.length;
		for (i = 0; i < nOptionNO; i++)
		{
			strTemp = new String(objList.options[i].text);
			strTemp = strTemp.toLowerCase();
			nPos    = strTemp.indexOf(strTarget.toLowerCase(),0);
			if (nPos==0 && strTarget!="")
			{
				objList.options[i].selected=true;
				if (strRetVal!="")
				{
					strRetVal += "," + objList.options[i].value;
				}
				else
				{
					nFirstPos = i;
					strRetVal = objList.options[i].value;
				}	
			}	
			else
			{
				objList.options[i].selected=false;
			}
			strTemp = null;
		}
		objList.options[0].selected=false;
		if (nFirstPos>=0)
		{
			objList.options[nFirstPos].selected=true;
		}
		return strRetVal;
	}

	
	
	/* --- Following method move items from one combobox to another --- */
	
	function move(fbox, tbox) 
	{
		var arrFbox = new Array();
		var arrTbox = new Array();
		var arrLookup = new Array();
		var i;
		/* That part fills arrLookup with values of any data found in tbox
		*/
		for (i = 0; i < tbox.options.length; i++) 
		{
			arrLookup[tbox.options[i].text] = tbox.options[i].value;
			arrTbox[i] = tbox.options[i].text;
		}
		/* That part fills 3 arrays (arrLookup, arrTbox & arrFbox)
			arrLookup is filled with any values found in list2 
				(note that arrLookup was filled with all values found in list1 from the previous step)
			arrTbox is filled with selected items from list1 (fbox)
			arrFbox is filled with un-selected items from list1 (fbox)
		*/
		var fLength = 0;
		var tLength = arrTbox.length;
		for(i = 0; i < fbox.options.length; i++) 
		{
			arrLookup[fbox.options[i].text] = fbox.options[i].value;
			if (fbox.options[i].selected && fbox.options[i].value != "") 
			{
				arrTbox[tLength] = fbox.options[i].text;
				tLength++;
			}
			else 
			{
				arrFbox[fLength] = fbox.options[i].text;
				fLength++;
			 }
		}
		//arrFbox.sort();
		//arrTbox.sort();
		fbox.length = 0;
		tbox.length = 0;
		
		/* That part creats new option <option> and sets data of each array (arrTbox & arrFbox)
			in it using values of arrLookup
		*/
		var c;
		for(c = 0; c < arrFbox.length; c++) 
		{
			var no = new Option();
			no.value = arrLookup[arrFbox[c]];
			no.text = arrFbox[c];
			fbox[c] = no;
		}
		for(c = 0; c < arrTbox.length; c++) 
		{
			var no = new Option();
			no.value = arrLookup[arrTbox[c]];
			no.text = arrTbox[c];
			tbox[c] = no;
		}
	}
	
	function setFocus(objText, objList)
	{
		var nOptionNO;
		var strTarget;
		var strTemp;
		var strRetVal;
		var i,nPos,nFirstPos;
		strRetVal = "";				
		strTarget = objText.value;
		alert(strTarget)
		nOptionNO = objList.length;
		for (i = 0; i < nOptionNO; i++)
		{
			strTemp = new String(objList.options[i].text);
			strTemp = strTemp.toLowerCase();
			nPos    = strTemp.indexOf(strTarget.toLowerCase(),0);
			if (nPos==0 && strTarget!="")
			{
				objList.options[i].selected=true;
				if (strRetVal!="")
				{
					strRetVal += "," + objList.options[i].value;
				}
				else
				{
					nFirstPos = i;
					strRetVal = objList.options[i].value;
				}	
			}	
			else
			{
				objList.options[i].selected=false;
			}
			strTemp = null;
		}
		objList.options[0].selected=false;
		if (nFirstPos>=0)
		{
			objList.options[nFirstPos].selected=true;
		}
		return strRetVal;
	}
	
	function commitChooseIds(objTarget, formIds, formNames)
	{
		var strNames = "";
		var strIds = "";
		var i;
		for (i = 0; i < objTarget.options.length; i++) 
		{
			if (i == 0)
			{
				strNames = objTarget.options[i].text ;
				strIds = objTarget.options[i].value;
			}
			else
			{
				strNames = strNames + ","  + objTarget.options[i].text ;
				strIds = strIds + ","  + objTarget.options[i].value;
			}
		}
    var ObjOpenerForm; 
    ObjOpenerForm = eval("window.opener."+formIds);
    ObjOpenerForm.value = strIds;
    ObjOpenerForm = eval("window.opener."+formNames);
    ObjOpenerForm.value = strNames;
		window.close();
	}

  function sendChooseIds(objTarget, formIds, formNames)
	{
		var strNames = "";
		var strIds = "";
		var i;
		for (i = 0; i < objTarget.options.length; i++) 
		{
			if (i == 0)
			{
				strNames = objTarget.options[i].text ;
				strIds = objTarget.options[i].value;
			}
			else
			{
				strNames = strNames + ","  + objTarget.options[i].text ;
				strIds = strIds + ","  + objTarget.options[i].value;
			}
		}
    var ObjOpenerForm; 
    ObjOpenerForm = eval("window.document."+formIds);
    ObjOpenerForm.value = strIds;
    ObjOpenerForm = eval("window.document."+formNames);
    ObjOpenerForm.value = strNames;
		//window.close();
	}

  
  function showSelectWin(winUrl)
  {
    window.open(winUrl, "SelectWin", "width=550, height=350, left=200, top=100, scrollbars=1");
  }
	
	
	
	function moveUpList(listField) {
   if ( listField.length == -1) {  // If the list is empty
      //alert("There are no values which can be moved!");
   } else {
      var selected = listField.selectedIndex;
      if (selected == -1) {
         //alert("You must select an entry to be moved!");
      } else {  // Something is selected 
         if ( listField.length == 0 ) {  // If there's only one in the list
            //alert("There is only one entry!\nThe one entry will remain in place.");
         } else {  // There's more than one in the list, rearrange the list order
            if ( selected == 0 ) {
                return false
               //alert("The first entry in the list cannot be moved up.");
            } else {
               // Get the text/value of the one directly above the hightlighted entry as
               // well as the highlighted entry; then flip them
               var moveText1 = listField[selected-1].text;
               listField.options[selected-1].value
               var moveText2 = listField[selected].text;
               var moveValue1 = listField[selected-1].value;
               var moveValue2 = listField[selected].value;
               listField[selected].text = moveText1;
               listField[selected].value = moveValue1;
               listField[selected-1].text = moveText2;
               listField[selected-1].value = moveValue2;
               listField.selectedIndex = selected-1; // Select the one that was selected before
            }  // Ends the check for selecting one which can be moved
         }  // Ends the check for there only being one in the list to begin with
      }  // Ends the check for there being something selected
   }  // Ends the check for there being none in the list
}

function moveDownList(listField) {
   if ( listField.length == -1) {  // If the list is empty
      //alert("There are no values which can be moved!");
   } else {
      var selected = listField.selectedIndex;
      if (selected == -1) {
         //alert("You must select an entry to be moved!");
      } else {  // Something is selected 
         if ( listField.length == 0 ) {  // If there's only one in the list
            //alert("There is only one entry!\nThe one entry will remain in place.");
         } else {  // There's more than one in the list, rearrange the list order
            if ( selected == listField.length-1 ) {
               //alert("The last entry in the list cannot be moved down.");
            } else {
               // Get the text/value of the one directly below the hightlighted entry as
               // well as the highlighted entry; then flip them
               var moveText1 = listField[selected+1].text;
               var moveText2 = listField[selected].text;
               var moveValue1 = listField[selected+1].value;
               var moveValue2 = listField[selected].value;
               listField[selected].text = moveText1;
               listField[selected].value = moveValue1;
               listField[selected+1].text = moveText2;
               listField[selected+1].value = moveValue2;
               listField.selectedIndex = selected+1; // Select the one that was selected before
            }  // Ends the check for selecting one which can be moved
         }  // Ends the check for there only being one in the list to begin with
      }  // Ends the check for there being something selected
   }  // Ends the check for there being none in the list
}

	
