// JScript File

function OnLoad()
{
   FolderListLoad();
   document.getElementById("ButtonNext").focus();
}  //OnLoad


function FolderListLoad()
{
   var   wFolder;
   var   szTableHtml="";
   for (wFolder= 0; wFolder < wNumFolders; wFolder++)
   {
      szTableHtml += "<table id=\"FolderTable\" cellspacing=0 cellpadding=2> ";
      szTableHtml += "<tr> ";
      szTableHtml += "<td valign=\"top\" nowrap=\"nowrap\" > ";
      szTableHtml += "<input type=checkbox name=FolderCheckbox onclick=\"CheckboxClicked()\" ";
      szTableHtml += "value=\"" + aszFolderName[wFolder] + "\">" + aszFolderName[wFolder];
      szTableHtml += " </td> ";
      szTableHtml += "</tr> ";
      szTableHtml += "</table> ";
   }  //for

   FolderTableDiv.innerHTML= szTableHtml;
}  //FolderListLoad


function CheckboxClicked()
{
   wNumChecked= 0;
   CheckedFolderString= "";
   var FolderCheckboxList= document.getElementsByName("FolderCheckbox");
   for (i=0; i < FolderCheckboxList.length; i++)
   {
      if (FolderCheckboxList[i].checked)
      {
         wNumChecked++;
         CheckedFolderString += FolderCheckboxList[i].value + ",";
      }
   }
   document.getElementById("FoldersChecked").value= CheckedFolderString;
   document.getElementById("radio-RemoveFolder").checked= "checked";
}  //CheckboxClicked


function NextButtonState()
{
    if (document.getElementById("radio-AddFolder").checked == "checked")
    {
        document.getElementById("ButtonNext").disabled="";
    }
    else
    {
        if (document.getElementById("radio-RemoveFolder").checked == "checked")
        {
            if (document.getElementsByName("FolderCheckbox").length > 0)
            {
                document.getElementById("ButtonNext").disabled="";
            }
            else
            {
                document.getElementById("ButtonNext").disabled="disabled";
            }
        }
    }
}   //NextButtonState


function whichButton(event)
{
   if((event.srcElement.id != "ButtonBack")&&(event.srcElement.id != "ButtonCancel"))
   {
      if(event.srcElement.id == "ButtonNext")
      {
         var FolderCheckboxList= document.getElementsByName("FolderCheckbox");
         document.getElementById("FoldersChecked").value= "next37";
      }

      if(event.keyCode==13)
      {
         document.getElementById("ButtonNext").focus();
         return false;
      }
   }
}  //whichButton
