<!-- Comment out script for old browers
function swap(e1, e2)
{
  ttext = e1.text;
  tvalue = e1.value;
  e1.text = e2.text;
  e1.value = e2.value;
  e2.text = ttext;
  e2.value = tvalue;
} 
function deleteBlankRowIfNotEmpty(toList)
{
   var idx = -1;
   var val = "";
// find a blank row in table 
   for (i = 0; i < toList.length; i++){ 
        val = toList.options[i].value;
        if (val == "") {
           idx = i;
           break;
        }
   } 
   if (idx >= 0 && (toList.length > 1))
      toList.options[idx] = null;
}
 function moveElementUp(toList, p_formname)
         {    // go through the list and get all selected items
              for ( i = 0; i <= toList.length-1; i++) 
              { // if the item is selected then swap it
                if (toList.options[i].selected)                     
                {   // check if it is not the first item
                    if (i != 0)
                    {
                        swap(toList.options[i], toList.options[i - 1]);
                        toList.options[i - 1].selected = true;
                        toList.options[i].selected = false;
                    }                        
                }
              }
          //newOrder(toList, eval("document."+ p_formname + "." + toList.name.substr(0, toList.name.lastIndexOf("select"))));
         }
 function moveElementDown(toList, p_formname)
         {    // go through the list and get all selected items
              for ( i = toList.length-1; i >= 0; i--) 
              { // if the item is selected then swap it
                if (toList.options[i].selected)                     
                {   // check if it is not the first item
                    if (i != toList.length-1)
                    {
                        swap(toList.options[i], toList.options[i + 1]);
                        toList.options[i + 1].selected = true;
                        toList.options[i].selected = false;
                    }                        
                }
              }
          //newOrder(toList, eval("document."+ p_formname + "." + toList.name.substr(0, toList.name.lastIndexOf("select"))));
         }
 function moveElementTop(toList, p_formname)
         {    // get the first item selected which needs to move to top
              iSelected = toList.selectedIndex;
              if (iSelected == 0)
                 return;
              // now run the moveup loop   
              for ( iMoveTop = 1; iMoveTop <= iSelected; iMoveTop++) {
                 moveElementUp(toList, p_formname);
              } 
         }
 function moveElementBottom(toList, p_formname)
         {    // get the last item selected which needs to move to bottom
              for ( i = 0; i <= toList.length-1; i++) 
              { // if the item is selected then swap it
                if (toList.options[i].selected)                     
                    iSelected = i;
              }
              if (iSelected == toList.length-1)  
                 return;
              iSelected = toList.length - 1 - iSelected; 
              // now run the movedown loop   
              for ( iMoveDown = 1; iMoveDown <= iSelected; iMoveDown++)
                 moveElementDown(toList, p_formname);
          //newOrder(toList, eval("document."+ p_formname + "." + toList.name.substr(0, toList.name.lastIndexOf("select"))));
         }
function selectAll(fromList)
{
  for ( i = 0; i <= fromList.length-1; i++ )
    fromList.options[i].selected = true;
  return true;
}
function unSelectAll(fromList)
{
  for ( i = 0; i <= fromList.length-1; i++ )
    fromList.options[i].selected = false;
  return true;
}
function clearList(fromList)
{
  fromList.length = 0;
}
function copyToList(fromList, toList, direction, p_formname) {
  for ( i = 0; i <= fromList.length-1;) {
    if (fromList.options[i].selected) {
        txt = fromList.options[i].text;
        val = fromList.options[i].value;
        if ( val != "" ) {
           // check if value is a spacer
           if ( val == "spacer" ) {
                if ( direction == "left" ) {
                     // remove from right and do not add on left
                     fromList.options[i]= null;
                }   
                else {
                    // add to right but do not remove from left
                    fromList.options[i].selected = false;
                    toList.options[toList.length] = new Option( txt, val, false, true );
                    toList.options[toList.selectedIndex].selected = false;
                }
           }
           else {  //only increment when not moving and deleting
             // create a new row
             toList.options[toList.length] = new Option( txt, val, false, true );
             // added these lines
             // removes from fromList and unselects item in toList
             fromList.options[i]= null;
             toList.options[toList.selectedIndex].selected = false;
           }  //only increment when not moving and deleting
        }
    }
    else i++;  //only increment when not moving and deleting
  }
  deleteBlankRowIfNotEmpty(fromList);
  deleteBlankRowIfNotEmpty(toList);
  //navigator.plugins.refresh(true);
  // Set the order
  //newOrder(toList, eval("document."+ p_formname + "." + toList.name.substr(0, toList.name.lastIndexOf("select"))))
  //newOrder(fromList, eval("document."+ p_formname + "." + fromList.name.substr(0, fromList.name.lastIndexOf("select"))));
}
function copyAll(fromList, toList, direction, p_formname) {
     indexofspacer = -1;
        spacerval = "";
        spacertxt = "";
        indexofitem = toList.length;
     for ( i = 0; i <= fromList.length-1; i++ ) {
         txt = fromList.options[i].text;
         val = fromList.options[i].value;
         if ( val != "" ) {
             // check if we need to copy the spacer too
             if ( val != "spacer") {
                  toList.options[indexofitem] = new Option( txt, val, false, true );
                  toList.options[indexofitem].selected = false;
                     indexofitem++;
                }
                else { // found a spacer
                    indexofspacer = i;
                    spacerval = val;
                    spacertxt = txt;
                }
            }
     }   
        if (indexofspacer != -1 && direction == "right" ) // let the spacer be on the from list
            fromList.length = 1;
        else
         clearList(fromList);
     deleteBlankRowIfNotEmpty(toList);
     unSelectAll(toList);
     //navigator.plugins.refresh(true);
        // Set the order
        //newOrder(toList, eval("document."+ p_formname + "." + toList.name.substr(0, toList.name.lastIndexOf("select"))));
        //newOrder(fromList, eval("document."+ p_formname + "." + fromList.name.substr(0, fromList.name.lastIndexOf("select"))));
}
 function newOrder(toList,toString) { 
    return;
    toString.value = "";
    for (var i = 0; i <= toList.length - 1; i++){ 
        if (toList.options[i].value != "") { 
           toString.value += toList.options[i].value;
           if (i < toList.length - 1 && toList.options[i+1].value != "") 
              toString.value += ",";
              } 
        } 
 } 
//-->

