
// Copyright 2000 Macromedia, Inc. All rights reserved.

//*************************API**************************

<!--Copyright 2000 Macromedia, Inc. All rights reserved.-->

function commandButtons(){
  return new Array(BTN_OK,     "okClicked()",
                   BTN_Cancel,"cancelClicked()",
           BTN_Help,"displayHelp()" );
}

var helpDoc = MM.HELP_cmdSelectDSNList;

var selectObj;

//*******************LOCAL FUNCTIONS*********************

function initializeUI()
{
   selectObj = new ListControl("dsn");

   var useHTTP = MM.useHTTP;
   var selectedDSN = MM.commandReturnValue;

   if (useHTTP)
   {
	//use Remote DSN List.
	remoteDSNs = MMDB.getRemoteDsnList();
	selectObj.setAll(remoteDSNs, remoteDSNs);
   }
   else
   {
	//use Local DSN List.
	localDSNs = MMDB.getLocalDsnList();
	selectObj.setAll(localDSNs, localDSNs);
   }

  if(!selectObj.pickValue(selectedDSN))
		selectObj.setIndex(0);

}

function cancelClicked(){
   MM.commandReturnValue = "";
   window.close();
}

function okClicked()
{
  var retdsn = "";
  var index = document.theForm.dsn.selectedIndex;

  if ( index != -1 )
  {
	  retdsn = document.theForm.dsn.options[index].text;
  }

  MM.commandReturnValue = retdsn;
  window.close();
}