//***********************TANGO JavaScript API****************** //Functions and variables used by TANGO system //Do not call those functions and do not use those variables directly //TANGO API constants and variables Tango_MASTER = 0; Tango_SLAVE = 1; Tango_NONE = 2; Tango_status = Tango_NONE; Tango_handle = null; Tango_plugin = null; Tango_init = false; //Tango_setMaster - used by TANGO system, do not use this function function Tango_setMaster() { Tango_status = Tango_MASTER; if (!Tango_init) Tango_start(); Tango_init = true; } //Tango_setSlave - used by TANGO system, do not use this function function Tango_setSlave() { Tango_status = Tango_SLAVE; if (!Tango_init) Tango_start(); Tango_init = true; } //finish - used by TANGO system, do not use this function function Tango_finish() { window.close(); } //end of functions and variables used by TANGO system //***********************TANGO JavaScript API****************** //Tango_isMaster() - master/slave status check //returns true if the running script is master, otherwise returns false function Tango_isMaster() { return(Tango_status == Tango_MASTER); } //Tango_isStandAlone() - standalone/non-TANGO mode //returns true if the script is running as a standalone application function Tango_isStandAlone() { return(Tango_status == Tango_NONE); } //Tango_askMaster - updates information about master/slave status of the script function Tango_askMaster() { Tango_handle.askMaster(); } //Tango_register - registers script in the TANGO system function Tango_register() { if (parent.opener == null) { return; } if (parent.opener.name == "Tango_CA") { Tango_status = Tango_SLAVE; Tango_plugin = parent.opener.navbar.document.local; name = window.name; AIDend = name.indexOf('_'); SIDend = name.indexOf('_', AIDend + 1); AID = name.substring(3, AIDend); SID = name.substring(AIDend + 1, SIDend); AT = name.substring(SIDend + 1, name.length); Tango_handle = Tango_plugin.addScript(window, AID, SID, AT); Tango_askMaster(); } } // Tango_start - called after data about master/slave status are initialized // body of this function should be implemented by the script developer to // launch/branch different scripts for the master and slave instances, or left empty function Tango_start() { //start of the code //end of the code } //Tango_send - sends string to the TANGO system function Tango_send(data) { if (Tango_isMaster()) Tango_handle.putMessage(data); } //Tango_receive - called by the TANGO system, when an message arrives, //body of this function should be implemented by the script developer function Tango_receive(data) { //start of message handling //end of message handling } //Tango_remove - quit from TANGO. This function is usually called when // the current page is unloaded, ie., in onUnload event of a body or frame function Tango_remove() { if (!Tango_isStandAlone()) { Tango_handle.remove(); } } //********************end of TANGO JavaScript API************************ /*Initial methods for registering in TANGO runtime and updating master/slave status */ Tango_register(); //End of initialisation - end of the TANGO code //Your code starts here