identifyBehaviorArguments()

Description Identifies arguments from a behavior function call as nav, dep, URL, NS4.0ref, IE4.0ref, objName, or other so that URLs in behaviors can be updated if the user saves the document to another location, and so that the referenced files can be displayed in the site map and considered dependent files for the purposes of uploading to and downloading from a server.
Arguments theFunctionCall
This argument is the string that was returned earlier by the applyBehavior() function.
Returns A string containing a comma-separated list of the types of arguments in the function call. The length of the list must equal the number of arguments in the function call. Argument types will always be one of the following:
nav specifies that the argument is a navigational URL, and therefore that it should be displayed in the site map.
dep specifies that the argument is a dependent file URL, and therefore that it should be included with all other dependent files when a document containing this behavior is downloaded from or uploaded to a server.
URL specifies that the argument is both a navigational URL and a dependent URL (or that it is a URL of unknown type), and therefore that it should be displayed in the site map and considered a dependent file when uploading to or downloading from a server.
NS4.0ref specifies that the argument is a Netscape DOM object reference.
IE4.0ref specifies that the argument is an Internet Explorer DOM object reference.
objName specifies that the argument is a simple object name, as specified in the NAME attribute for the object. This type was added in Dreamweaver 3.
other specifies that the argument is none of the above types.
Example This simple example of identifyBehaviorArguments() would work for the Open Browser Window behavior action, which returns a function that always has three arguments (the URL to open, the name of the new window, and the list of window properties):
function identifyBehaviorArguments(fnCallStr) {

  return "URL,other,other";

}

A more complex version of identifyBehaviorArguments() is necessary for behavior functions that have a variable number of arguments (such as Show/Hide Layer). This version of identifyBehaviorArguments() relies on the fact that there is a minimum number of arguments, and additional arguments always come in multiples of the minimum number. In other words, a function with a minimum number of arguments of 4 may have 4, 8, or 12 arguments, but it will never have 10 arguments.
function identifyBehaviorArguments(fnCallStr) {
  var listOfArgTypes;
  var itemArray = dreamweaver.getTokens(fnCallStr, '(),');

  //The array of items returned by getTokens() includes the function name, 
  //so the number of *arguments* in the array is the length of the array 
  //minus one. Divide by 4 to get the number of groups of arguments.
  var numArgGroups = ((itemArray.length - 1)/4);
  //For each group of arguments
  for (i=0; i < numArgGroups; i++){

    //Add a comma and "NS4.0ref,IE4.0ref,other,dep" (because this 
    //hypothetical behavior function has a minimum of four arguments: 
    //the Netscape object reference, the IE object reference, a dependent 
    //URL, and perhaps a property value such as "show" or "hide") to the 
    //existing list of argument types, or if no list yet exists, add only
    //"NS4.0ref,IE4.0ref,other,dep"
    var listOfArgTypes += ((listOfArgTypes)?",":"") + 
    "NS4.0ref,IE4.0ref,other,dep";
  }
}