//
// Copyright 2001-2006 Adobe Macromedia Software LLC and its licensors. All rights reserved.
// ----------------------------------------------------
//
// Flash Button.js
//
// See Commands/Flash Button.js for implementation of
// Insert Flash Button object
//

//
// ---- Object API ---
//
function objectTag()
{
  var retVal, theURL;
  if (!dw.getDocumentPath("document"))
  {
    alert(MSG_PleaseSaveDocument);
//	theURL = dreamweaver.browseForFileURL("save");
//	if (!theURL)
	  return "";
//	else
//	  dreamweaver.saveDocument(dw.getDocumentDOM(), theURL);
  }

  if (dreamweaver.getDocumentDOM().getIsTemplateDocument())
	if (!confirm(MSG_ConfirmTemplateSWF))
      return "";

  var cmdFile = dreamweaver.getConfigurationPath() + "/Commands/Flash Button.htm";
  var cmdDOM = dreamweaver.getDocumentDOM(cmdFile);
  
  retVal = callCommand("Flash Button");

  // check to see if accessibility option for media objects is turned on
  prefsAccessibilityOption = dw.getPreferenceString("Accessibility", "Accessibility Media Options", "");
  if (prefsAccessibilityOption == 'TRUE' && cmdDOM.parentWindow.clickedOK) 
  {
    var objDOM = dreamweaver.getDocumentDOM();
    addAccessibility(objDOM);
  }

  return "";
}

function addAccessibility(objDom) 
{
  var cmdFile = dreamweaver.getConfigurationPath() + "/Commands/Flash Options.htm";
  var cmdDOM = dreamweaver.getDocumentDOM(cmdFile);
   
  cmdDOM.parentWindow.setFormItem(objDom);
  dreamweaver.popupCommand("Flash Options.htm");
}
