// Copyright 2001, 2002, 2003 Macromedia, Inc. All rights reserved.

//---------------     API FUNCTIONS    ---------------

function isDOMRequired()
{ 
	// Return false, indicating that this object is available in code view.
	return false;
}

function objectTag()
{
  var bDialogState = dw.getShowDialogsOnInsert(); // Was dialog shown?
  var newURL = browseForFileURL("select");

  if ((newURL == '') && bDialogState)
    return '';

  // Attempt to get SSI used for connection include file if Server Model is defined for page
  // and the URL doesn't already contain directive syntax.  Nested directives are bad.
  var insertText = "";
  if (newURL.indexOf("<%") == -1 &&
	  newURL.indexOf("<?") == -1 &&
	  dw.getDocumentDOM().serverModel.getDisplayName() != "")
    insertText = dw.getExtDataValue("connectioninc_statement", "insertText");

  // Default to NCSA SSI
  if (insertText == "" || insertText.indexOf('@@connectionURL@@') == -1)
	  insertText = '<!--#include file="@@connectionURL@@" -->';

  // For Apache include, use 'virtual' for site relative file paths, otherwise 'file'
  insertText = (newURL.substring(0,1) == "/")
				? insertText.replace("#include file", "#include virtual")
				: insertText.replace("#include virtual", "#include file");

  return (insertText.replace('@@connectionURL@@', newURL));
}

