// --  NOTE:  To be used in Firefly standalone outputs, where in isolation or within frames.
// --  Functions and Utilities to Load and Launch a FireflyŽ Simulation -->
// --  This javascript file and browsersniff.js are included in fireflyruntime.html

//Variable Definitions
var ki_engineReady = false;
var ki_preloading = "PRELOADING";
var ki_preloadOnReady = false;
var ki_showOnReady = true;
var ki_simWeAreWaitingFor = " ";
var ki_simulations = null;
var ki_simulationNames = " ";
var ki_listeners = null; //an array of listeners that must 
                      //implement the following functions:
                      //informMentorReady()
                      //informSimLoaded(simName)
                      //informSimExited(simName)
var ki_listenerLen = 0;  //number of listeners in array.
var ki_simulationDirectory = null;
var ki_trackingObject = null;
var ki_simulationLayer = "simLayer";
var ki_linkLayer1 = "linkLayer1";
var ki_linkLayer2 = "linkLayer2";
var ki_linkLayer3 = "linkLayer3";
var ki_simRequester = null;
var ki_pageloaded = false;

var ki_quote = "\"";
var ki_backslash = "\\";
var ki_slash = "/";
var ki_runtimeRelativePath = null;
var ki_zeroBase = 0;
var ki_debug = false;
var ki_lastAppletTag = null;
var ki_spacer = " ";
var ki_urlSpacer = "%20";


//Bug Tool


var ki_bugTracking = ki_bugtracking;
var ki_bugReady = false;
var ki_bugToolPath = null;
var ki_bugLayerName = "bugLayer";
var ki_bugProjectName = "Unknown Project";
var ki_bugTrackingOnReady = ki_bugtracking;
var ki_showBugToolOnReady = false;
var ki_bugParam0 = "";
var ki_bugParam1 = "";
var ki_bugParam2 = "";
var ki_bugParam3 = "";
var ki_bugParam4 = "";
var ki_bugParam5 = "";
var ki_bugParam6 = "";
var ki_bugParam7 = "";
var ki_bugParam8 = "";
var ki_bugParam9 = "";
var ki_bugParam10 = "";


var ki_pluginsArchive = null;
var ki_currentLinkLayer = null;
var ki_nextLinkLayer = ki_linkLayer1;
var ki_resourceAppletNumber = 0;
var ki_nextAppletTag = null;
var ki_demandOnReady = false;
var ki_lastSimDir = null;

//NOT RENAMED for engine compatibility
/******************************************************************************************
**
** Function     mentorReady
** Inputs:	none
**				   
** Return:	boolean value indicating success
**			
**
** Description:
** This Function is called by the StartApplet to indicate that the runtime engine has
** been successfully loaded and initialized. If there are sims waiting to preload, do
** so now.
******************************************************************************************/
function mentorReady()
{
    
    ki_engineReady = true;
    if(ki_listeners != null)
    {
       var index = 0;
       
       while(index < ki_listenerLen)
       {
          var currentListener = ki_listeners[index];
          if(currentListener != null)
          {
             if(currentListener.ki_informMentorReady)
             {
                currentListener.ki_informMentorReady();
             }
          
          } 
          
          index++;
       
       }
    
    }
    
       
    
    if(ki_preloadOnReady)
    {
       ki_preloadOnReady = false;
       var simDir = ki_determineSimPath();
       ki_simulationDirectory = null;
       ki_lastSimDir = simDir;
       
      
       if(!ki_isNullString(ki_simulationNames))
       {
          
          setTimeout("ki_loadSimulations(" + ki_quote +ki_simulationNames+ki_quote+","+ki_quote + simDir+ki_quote +")",5);
          
       
       }
    
    }
    return true;

}

//Called if we are in a pre-1.2 jdk so we do not use streaming.
//NOT RENAMED for engine compatibility
function useDefaultMethods()
{
   kiUseStreaming = false;
   
   return true;

}





/////////////////////////////////////////  API Functions ////////////////////////////////////////

/******************************************************************************************
**
** Function:   ki_determineSimPath 
** Inputs:	   none
**				   
** Return:	   String indicating path of simulations
**			
**
** Description:
**This Function returns the path of the simulation directory and it's resources.
******************************************************************************************/
function ki_determineSimPath()
{

	if(kiUseStreaming)
	{
		return ".";
	}
	else
	{
		//get the full URL of the HTML file launching the simulations
		var path = location.toString();

		//get the lst index of the separator so we can remove the html file name from the path
		var endSimPathIndex = path.lastIndexOf("/");
		//alert(endSimPathIndex);

		//finally set and return the variable of the simPath
		var finalSimPath = path.substring(0,endSimPathIndex);
		//alert("finalSimPath: "+finalSimPath);

		return finalSimPath;

	}
}

/******************************************************************************************
**
** Function     ki_preload
** Inputs:	simulationList - string representing a comma-delimited list of simulation names
**              simDir - the path of the directory, relative to the api directory where
**                       the simulations are stored.
**				   
** Return:	boolean value indicating success. If the runtime engine has not completed
**              loading as yet, false will be returned and ki_preloadOnReady set to true
**              so that once the engine has completed loading we will go ahead and
**              preload.
**			
**
** Description:
** This Function loads one or more simulations located in simDir
**
******************************************************************************************/
function ki_preload(simulationList, simDir)
{
 
   if(ki_isNullString(simulationList))
   {
       return false;
   
   }

   
   ki_lastAppletTag = appletTag;
   ki_simulations = ki_createArray(simulationList,ki_preloading);
   ki_simulationNames = simulationList;
   ki_simWeAreWaitingFor = simulationList;
   
   ki_simulationDirectory = simDir;
   ki_preloadOnReady = true;
   
   if(!ki_engineReady)
   {
   	return false;
   }   
   
   return ki_loadSimulations(ki_simulationNames,simDir);
   
}


/******************************************************************************************
**
** Function     ki_setPlugins
** Inputs:	plugins - string representing a list of archive files needed for required plugins
**                       
**				   
** 
**			
**
** Description:
** This Function sets the value of the ki_pluginsArchive variable value which 
** represents a list of archive files needed for any required plugins. 
**
******************************************************************************************/
function ki_setPlugins(plugins)
{
   
   ki_pluginsArchive = plugins;
   return true;

}



/******************************************************************************************
**
** Function     ki_showSim
** Inputs:	simName - string representing the name of the simulation to be displayed
**              requester - frame requesting the simulation MUST IMPLEMENT a function
**                             named informSimLoaded that takes the simulation's name as a 
**                             parameter if the value of requester is not null
**                       
**				   
** Return:	boolean value indicating immediate success. If the simulation is still
**              loading when This Function is called, it will return false so that
**              the calling function can handle any visible indication of loading.
**			
**
** Description:
** This Function displays the specified simulation if it is in the ready list and
** already preloaded. If not loaded, sets the ki_showOnReady flag to true and stores the
** simName and will show it as soon as it is 
** ready. 
**
******************************************************************************************/
function ki_showSim(simName,requester)
{
    
    ki_simRequester = requester;
        
    if(ki_isNullString(simName))
    {
   
       return false;
    
    }
    
    if(ki_simulations == null)
    {
       //we have a problem... no sims were preloaded...
       alert("There was a problem loading the simulations, cannot show the simulation " + simName);
       return false;
    
    }
    
    if(ki_isSimInReadyList(simName,ki_preloading))
    {
       
       ki_simWeAreWaitingFor = simName;
       ki_showOnReady = true;
       if(kiOnDemand)
       {
          //Inform the simulation manager to start loading this sim on demand.
          if(ki_engineReady && document.Start)
          {
          
              if(document.Start.demandSim(simName))
              {
                 return false;
              
              }
              else
              {
                 alert("Could not load sim on demand: " + simName);
                 return false;
              
              }
          }
          else
          {
             ki_demandOnReady = true;
          
          }
       
       }
       return false;
    
    }
    
    
    
    return ki_showWindow(simName);
}

/******************************************************************************************
**
** Function     ki_showSimDelayed
** Inputs:	simName - string representing the name of the simulation to be displayed
**              
**                       
**				   
** Return:	boolean value indicating immediate success. If the simulation is still
**              loading when This Function is called, it will return false so that
**              the calling function can handle any visible indication of loading.
**			
**
** Description:
** This Function displays the specified simulation if it is in the ready list and
** already preloaded. If not loaded, sets the ki_showOnReady flag to true and stores the
** simName and will show it as soon as it is 
** ready. 
**
******************************************************************************************/
function ki_showSimDelayed(simName)
{
        
    if(ki_isNullString(simName))
    {
   
       return false;
    
    }
    
        
    if(ki_isSimInReadyList(simName,ki_preloading))
    {
           
           ki_simWeAreWaitingFor = simName;
           ki_showOnReady = true;
           return false;
        
    }
    
    
    return ki_showWindow(simName);
}


/******************************************************************************************
**
** Function     ki_setTrackingObject
** Inputs:	trackObject - frame or document that contains the tracking function
**				   
** Return:	boolean value indicating success
**			
**
** Description:
** This Function sets the ki_trackingObject. The object fulfilling the role of ki_trackingObject must implement a 
** func called trackSim(simName, simStatus, simScore) that returns a boolean indicating success 
**
******************************************************************************************/
function ki_setTrackingObject(trackObject)
{
       
    ki_trackingObject = trackObject;
    return true;
}

//NOT RENAMED for engine compatibility
/******************************************************************************************
**
** Function     loadLinkedSim
** Inputs:	simName - string representing a simulation name
**              no simDir is necessary because it will equal to the current simDir
**				   
** Return:	boolean value indicating success. 
**			
**
** Description:
** This Function loads a simulation into one of the ki_linkLayer layers. The layer it
** loads into is determined by the value of the ki_nextLinkLayer variable which 
** keeps track of which linkLayer is available (does not hold a currently running sim)
** This should only be called from the runtime engine.
**
******************************************************************************************/
function loadLinkedSim(simName)
{
 
   if(ki_isNullString(simName))
   {
       return false;
   
   }
   
   //This should never happen 
   if(!ki_engineReady)
   {
       alert("Error - The runtime engine is no longer present, cannot load linked simulation.");
       return false;
   
   }
   
   if(kiUseStreaming)
   {
      
       return ki_loadSimulations(simName,ki_lastSimDir);
       
   }
   
  
   var appletTag = ki_createAppletTag(simName, ki_lastSimDir);
   
  
   
   //Make sure that old ResourceApplet gets destroyed before we do anything.
    ki_layerWrite(" ",ki_nextLinkLayer);
    
    if(appletTag == null)
    {
    
       return false;
    }
    
    ki_nextAppletTag = appletTag;  
    ki_currentLinkLayer = ki_nextLinkLayer;
    setTimeout("ki_delayedLinkLoad()",3);
    
    
    return true;
}


function ki_delayedLinkLoad()
{
    if(ki_nextAppletTag == null)
    {
       return false;
    
    }
    
    var ok = ki_layerWrite(ki_nextAppletTag,ki_currentLinkLayer);
    if(ok)
    {
       ki_updateNextLinkLayer();
    }
    
    return ok;

}

function ki_updateNextLinkLayer()
{ 
  
     if(ki_nextLinkLayer == ki_linkLayer1)
     {
        ki_nextLinkLayer = ki_linkLayer2;
     
     }
     else if(ki_nextLinkLayer == ki_linkLayer2)
     { 
     
        ki_nextLinkLayer = ki_linkLayer3;
     }
     else if(ki_nextLinkLayer == ki_linkLayer3)
     {
        ki_nextLinkLayer = ki_linkLayer1;
     
     }
     else
     {
        ki_nextLinkLayer = ki_linkLayer1;
     
     }

     

     return true;

}

//NOT RENAMED for engine compatibility
/******************************************************************************************
**
** Function     simReady
** Inputs:	simName - the name of the simulation that is ready
**              simHash - the hashcode of the ResourceApplet applet
**              
**              
**              
**				   
** Return:	boolean value returned to java code. (works better if a value returned).
**              
**			
**
** Description:
** This Function is called by the StartApplet after a simulation has finished loading and
** has completed setup.. i.e. it is ready to show.
** 
******************************************************************************************/
function simReady(simName, simHash)
{
   ki_addSimToReadyList(simName, simHash);
   if(ki_showOnReady)
   {
      
      if(!ki_isNullString(ki_simWeAreWaitingFor) && ki_isSimInReadyList(ki_simWeAreWaitingFor,simHash))
      {
      
         ki_showOnReady = false;
         ki_simWeAreWaitingFor = " ";
         setTimeout("ki_showSimDelayed("+ki_quote+simName+ki_quote+")",3);
      
      }
   
   
   }
   
   
   if(ki_simRequester != null)
   {
      if(ki_simRequester.ki_informSimLoaded)
      {
         ki_simRequester.ki_informSimLoaded(simName);
         ki_simRequester = null;
      
      }
      
   
   }
   
   if(ki_listeners != null)
   {
      var index = 0;
      while(index < ki_listenerLen)
      {
         var currentListener = ki_listeners[index];
         if(currentListener != null && currentListener.ki_informSimLoaded)
         {
            currentListener.ki_informSimLoaded(simName);
         }
         
         index++;
      
      }
   
   }
   
   return true;
   

}


//NOT RENAMED for engine compatibility
/******************************************************************************************
**
** Function     simExit
** Inputs:	simName - the name of the simulation that has just exited
**              status  - the status of the simulation that has just exited..
**                        this parameter is no longer used (deprecated)
**				   
** Return:	boolean value indicating success
**			
**
** Description:
** This Function is called by the StartApplet when a sim is unloaded, removes it from
** the ready list - the status parameter is no longer used.. see simEvent function
** for tracking/scoring
******************************************************************************************/
function simExit(simName,simStatus)
{
   if(ki_listeners != null)
   {
      var index = 0;
      while(index < ki_listenerLen)
      {
         var currentListener = ki_listeners[index];
         if(currentListener != null && currentListener.informSimExited)
         {
            currentListener.ki_informSimExited(simName);
         }
         
         index++;
      
      }
   
   }
   
   setTimeout("ki_removeSimFromReadyList("+ki_quote+simName+ki_quote+")",3);
   return true;
   

}

//NOT RENAMED for engine compatibility
/******************************************************************************************
**
** Function     simEvent
** Inputs:	simName - the name of the simulation that has just exited
**              simStatus  - the status of the simulation that has just exited..
**                        
**              simScore - the score, if appropriate for the simulation
**				   
** Return:	boolean value indicating success, will return false if no tracking available.
**			
**
** Description:
** This Function is called by the runtime engine when a user exits a simulation, passing
** in tracking/scoring data that can be sent to an lms or other tracking/scoring api.
** If tracking or scoring is required, first call the api function ki_setTrackingObject,
** passing in the object that will handle this data. See the ki_setTrackingObject 
** function for more details.
** 
******************************************************************************************/
function simEvent(simName, simStatus, simScore)
{

   if(ki_trackingObject == null)
   {
      return false;
   
   }
   
   if(ki_trackingObject.ki_trackSim)
   {
      return ki_trackingObject.ki_trackSim(simName,simStatus,simScore);
   
   }
   
   return false;

}

//NOT RENAMED for resource loader compatibility
/******************************************************************************************
**
** Function     setSimulation
** Inputs:	loader - the ResourceApplet applet
**              simList - the list of simulations to load with this applet.
**              
**              
**              
**              
**				   
** Return:	boolean value returned to java code. (works better if a value returned).
**              
**			
**
** Description:
** This Function is called by the ResourceApplet upon starting the applet.It then
** calls the StartApplet's loadSim method, passing in itself and the list of 
** simulations to load. 
** 
******************************************************************************************/
function setSimulation(loader,simList)
{
    
    if(document.Start)
    { 
       document.Start.loadSimulation(loader,simList);
       return true;
    
    }
    
    return false;

}



/////////////////////////////////////////////  Helper Functions //////////////////////////



/******************************************************************************************
**
** Function     ki_layerWrite
** Inputs:	htmlText - the html code to write into the layer
**              
**              
**				   
** Return:	boolean value indicating success. The function will be successful if 
**              the current browser is supported.
**			
**
** Description:
** This Function dynamically writes html code into a layer. It requires browsersniff.js
** so that it can use a browser-specific implementation. This code will
** ultimately consist of an applet tag and parameters for the ResourceApplet
** 
******************************************************************************************/
function ki_layerWrite(htmlText,id)
{
   if(kisNetscape4x())
   {
     if(document.layers[id])
     {
     
        if(document.layers[id].document)
        {
          var lyr = document.layers[id].document;
          lyr.open();
          lyr.write(htmlText);
          lyr.close();
          return true;
        
        }
     
     }
     
   
   }
   else if(kisIE4())
   {
      var ie4lyr = eval("document.all."+id);
      ie4lyr.innerHTML = htmlText;
      return true; 
   
   }
   else if(kisNetscape6Up() || kisIE() || kisFirefox())
   {
     if(document.getElementById(id))
     {
        document.getElementById(id).innerHTML = htmlText;
        
        return true;
     
     }
    
   
   }
   
   
   return false;
   

}



/******************************************************************************************
**
** Function     ki_loadSimulations
** Inputs:	simList - comma delimited list of simulation names
**              simDir - directory path relative to the location of this api.
**              
**				   
** Return:	boolean value indicating success.
**			
**
** Description:
** This Function dynamically loads the simulation by generating an html applet tag
** and writing it to the "simLayer".
** 
******************************************************************************************/
function ki_loadSimulations(simList, simDir)
{

    if(kiUseStreaming)
    {
    
       if(document.Start)
       {
       
          if(kiLibraryPath != null && kiLibraryPath.length != 0)
          {
             //overrides all paths set by content... 
             document.Start.setLibraryPath(kiLibraryPath);
          }
          else
          {
          
             document.Start.setLibraryPath(ki_convertPath(simDir));
          }
          
          
          document.Start.requestSim(simList);
          
          if(ki_demandOnReady)
          {
             ki_demandOnReady = false;
             document.Start.demandSim(ki_simWeAreWaitingFor);
          
          }
          
          return true;
       
       }
       
       return false;
    
    }
    
    //Make sure that old ResourceApplet gets destroyed before we do anything.
    ki_layerWrite("blank",ki_simulationLayer);
    var appletTag = ki_createAppletTag(simList,simDir);
    if(appletTag == null)
    {
    
       return false;
    }
    
    return ki_layerWrite(appletTag,ki_simulationLayer);


}


function bugToolReady()
{
   
   ki_bugReady = true;
   
   setTimeout("showBugToolDelayed()",2);
   return true;


}

function showBugToolDelayed()
{
   showBugTool(ki_bugParam0,ki_bugParam1,ki_bugParam2,ki_bugParam3,ki_bugParam4,ki_bugParam5,ki_bugParam6,ki_bugParam7,ki_bugParam8,ki_bugParam9,ki_bugParam10);



}

function ki_loadBugTool()
{
    if(!ki_bugtracking)
    {
       return false;
    
    }
    
    
    
    var appletTag = ki_createBugToolAppletTag(ki_bugToolPath,document.location.toString());
    if(appletTag == null)
    {
       return false;
    
    }
    
    
    
    var ok = ki_layerWrite(appletTag,"bugLayer");

    if(ok)
    { 
    
       return true;
    
    }

    return false;

}

/******************************************************************************************
**
** Function     ki_createAppletTag
** Inputs:	simList - comma delimited list of simulation names
**              simPath - relative location of simulations
**              
**              
**				   
** Return:	string representing the applet tag to write. 
**              
**			
**
** Description:
** This Function creates an applet tag for the ResourceApplet that will load the 
** simulations. 
** 
******************************************************************************************/
function ki_createAppletTag(simList,simPath)
{
    var codebase = simPath;
    if(!ki_isNullString(codebase))
    {
      //convert all backslashes to slashes
      ki_stringReplace(codebase,ki_backslash,ki_slash);
    
    }
    
    if(kisNetscape() || kisIE5() || kisIE4()|| kisOpera7())
    {
       
       codebase = ki_convertPath(codebase);
    }
    
    var gecko = kisNetscape6Up();
    var useHierarchyFor14 = !gecko;  
    var defaultCodebase = ki_quote + "." + ki_quote;
    var suffix = "sim";
    

    var archiveString = ki_buildArchiveString(simList,kisNetscape());


    var simString = "\"com.kimpact.firefly.runtime.ResourceApplet\" archive=\"resourceloader.jar," + archiveString + ki_quote;


    var codebaseString = "codebase=";
    if(ki_isNullString(codebase) || codebase == ".")
    {

      codebase = defaultCodebase;
    }
    else
    {
       if(!ki_endsWith(codebase,ki_slash))
       {
          codebase += ki_slash;
       }
       codebase = ki_quote + codebase + ki_quote;
    
    }

    codebaseString += codebase;



    var appletTag = "<applet name=\"ResourceLoader";
    appletTag = appletTag + ki_resourceAppletNumber;
    ki_resourceAppletNumber = ki_resourceAppletNumber + 1;
    appletTag = appletTag + "\" MAYSCRIPT ";
    appletTag = appletTag + codebaseString;
    appletTag = appletTag + " code=" + simString + " height=1>";
    appletTag = appletTag + "<param name=sim value=\"" + simList + "\">" ;
    appletTag = appletTag + "<param name=useHierarchyFor14 value=\"" + useHierarchyFor14 + "\">";
    appletTag = appletTag + "<param name=ki_simframe_hierarchy value=\"" + ki_simframe_hierarchy + "\">";
    

    appletTag = appletTag + "</applet>";

    return appletTag;



}


//NOT RENAMED for engine compatibility
/******************************************************************************************
**
** Function:   showBugToolFromContent 
** Inputs:	   docURL - location of the content that is showing the bug tool
**				   
** Return:	   boolean value indicating success
**			
**
** Description:
**This Function shows the bug tool if it is loaded.
******************************************************************************************/
function showBugToolFromContent(docURL)
{
   //var app = null;
   //if(!ki_bugToolLoaded)
   //{
     // return false;
   
   //}
   
   //if(!ki_bugReady)
   //{
      //alert("The Bug Tool has not finished loading yet, please try again in a moment.");
      //return false;
   
   //}
   
   //app = ki_getBugTool();
   //if(app == null)
   //{
     // return false;
   
   //}
   
   //app.showFrame(true,docURL);

   return false;
}

/******************************************************************************************
**
** Function:    ki_getBugTool
** Inputs:	    none
**				   
** Return:	    the BugTool applet, if found
**			
**
** Description:
**This Function finds the BugTool applet in the bugToolLayerName layer
******************************************************************************************/
function ki_getBugTool()
{
   var app = null;
   if(!ki_bugtracking)
   {
      return app;
   
   }
   
   if(parent)
   {
      if(parent.ki_bugFrame)
      {
        if(parent.ki_bugFrame.document)
        {
           if(parent.ki_bugFrame.document.BugTool)
           {
              app = parent.ki_bugFrame.document.BugTool;
              return app;
           }
        
        }
      }
           
   
   }
   
   if(kisNetscape4x())
   {
   
      if(document.layers[ki_bugLayerName])
      {
         if(document.layers[ki_bugLayerName].document)
         {
            var lyr = document.layers[ki_bugLayerName].document;
            if(lyr.applets && lyr.applets.length >= 1)
            {
               app = lyr.applets[0];
               
            }
         }
      }
   
   }
   else if(kisIE() || kisNetscape6Up() || kisFirefox())
   {
     if(document.BugTool)
     {
       app = document.BugTool;
      

     
     }
     else if(document.getElementById(ki_bugLayerName))
     {
        var doc = document.getElementById(ki_bugLayerName);
         
        if(doc.document)
        {
          doc = doc.document;
          if(doc.applets && doc.applets.length >= 2)
          { 
              var index = 0;
              for(index = 0; index < doc.applets.length; index++)

              {
              
                 var docapplet = doc.applets[index];
                 if(docapplet.name)
                 {
                    if(docapplet.name == "BugTool");
                    {
                       app = docapplet[index];
                       
                    
                    }
                 
                 }
              
              }
              
          }

           
        }
       
        
     }
   
   }
   
   if(app != null )
   {
       return app;
     
   }
   
   alert("bug tool app is null.");
   
   return null;



}

//NOT RENAMED for engine compatibility
/******************************************************************************************
**
** Function:    showBugTool
** Inputs:      s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10 values passed in from Start applet
**				   
** Return:	    boolean value indicating success

**			
**
** Description:
**This Function shows the bug tool if it is loaded.
******************************************************************************************/
function showBugTool(s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10)
{
   if(ki_debug)
   {  
      alert("showBugTool(" + s0 + "," + s1 + "," + s2 + "," + s3 + "," + s4 + "," + s5 + "," + s6 + "," + s7 + "," + s8 + "," + s9 +")");
   }
   
   if(ki_bugReady)
   {

      return launchBugTool(s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10);
      
         }
   else
      	{
      ki_bugParam0 = s0;
      ki_bugParam1 = s1;
      ki_bugParam2 = s2;
      ki_bugParam3 = s3;
      ki_bugParam4 = s4;
      ki_bugParam5 = s5;
      ki_bugParam6 = s6;
      ki_bugParam7 = s7;
      ki_bugParam8 = s8;
      ki_bugParam9 = s9;
      ki_bugParam10 = s10;
         
         }
      
      
   //load the bug tool
   setTimeout("ki_loadBugTool()",2);
   return true;
   
   
   }
   
/******************************************************************************************
**
** Function:    launchBugTool
** Inputs:	s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10 values passed in from Start applet
**				   
** Return:	boolean value indicating success

**			
**
** Description:
**This Function launches the bug tool if it finds the app.
******************************************************************************************/

function launchBugTool(s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10)
{
   var app = null;
   
   app = ki_getBugTool();
   if(app == null)
   {
      return false;
   }
   
   app.showFrame(s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10);
   return true;
   
   
}

/******************************************************************************************
**
** Function:   ki_createBugToolAppletTag 
** Inputs:	   path - path relative to base directory
**				   
** Return:	   none
**			
**
** Description:
**This Function creates an applet tag for launching the bug tool in the 
**same frame as the the runtime (in a div tag called bugLayer)
******************************************************************************************/
function ki_createBugToolAppletTag(path,docURL)
{
    var codebase = path;
    if(!ki_isNullString(codebase))
    {
      //convert all backslashes to slashes
      ki_stringReplace(codebase,ki_backslash,ki_slash);
    
    }
    
    if(kisNetscape() || kisIE5() || kisIE4()|| kisOpera7())
    {
       
       codebase = ki_convertPath(codebase);
    }
    
   
    var defaultCodebase = ".";
    
    var codebaseString = "codebase=";
    if(ki_isNullString(codebase) || codebase == ".")
    {

      codebase = defaultCodebase;
    }
    else
    {
       if(!ki_endsWith(codebase,ki_slash))
       {
          codebase += ki_slash;
       }
       
    
    }

    codebaseString += ki_quote + codebase + ki_quote;
    
    var archiveString = "archive=" + "\"ffrt.jar\"";
    var appletTag = "<applet name=\"BugTool\" MAYSCRIPT " +  archiveString + " code=\"com.kimpact.bugtool.BugToolApplet.class\" width=0 " + codebaseString + "><br />";
    
    appletTag = appletTag + "<param name=\"CABBASE\" value=\"ffrt.cab\">"+ "<br />";
    appletTag = appletTag + "<param name=\"Location\" value=\"" + ki_stringReplace(docURL,ki_spacer,ki_urlSpacer) + "\">" + "<br />";
    appletTag = appletTag + "<param name=\"Project\" value=\"" + ki_bugProjectName + "\">" ;
    appletTag = appletTag + "<param name=\"Browser\" value=\"" + ki_stringReplace(kibrowserType,ki_spacer,ki_urlSpacer) + "\">" + "<br />";
    appletTag = appletTag + "<param name=\"OS\" value=\"" + ki_stringReplace(kiyourOS,ki_spacer,ki_urlSpacer) + "\">"+ "<br />";
    appletTag = appletTag + "</applet>"+ "<br />";


    return appletTag;


}

function ki_appendBugToolParams(appletTag, path, docURL)
{

    
    appletTag = appletTag + "<param name=\"Location\" value=\"" + ki_stringReplace(docURL,ki_spacer,ki_urlSpacer) + "\">" + "<br />";
    appletTag = appletTag + "<param name=\"Project\" value=\"" + ki_bugProjectName + "\">" ;
    appletTag = appletTag + "<param name=\"Browser\" value=\"" + ki_stringReplace(kibrowserType,ki_spacer,ki_urlSpacer) + "\">" + "<br />";
    appletTag = appletTag + "<param name=\"OS\" value=\"" + ki_stringReplace(kiyourOS,ki_spacer,ki_urlSpacer) + "\">"+ "<br />";
    return appletTag;

}



/******************************************************************************************
**
** Function:  ki_convertPath  
** Inputs:	  path - the path to convert
**          
**				   
** Return:	  converted path
**			
**
** Description:
**This Function takes a path that is relative to the base dir and converts
**it to a path relative to the runtime dir.
******************************************************************************************/
function ki_convertPath(path)
{
  if(ki_debug)
  {
    alert("ki_convertPath(" + path + ")");
  }
  var updir = "..";
  var curdir = ".";
  var basePath = null;
  var runtimePath = null;
  var currentPath = path;
  
  if(ki_isNullString(path))
  {
     currentPath = curdir;
  
  }
  
 
  var convertedPath = "";
  
  //get the relative path of the runtime 

  if(ki_runtimeRelativePath == null)
  {
     //Commented out - Not needed for Firefly standalone output
     //Originally needed for Manifest Maker output, but causes Permission Denied
     //Errors when sim is loaded in custom frames.  
     //if(parent && parent.location)
     //{
     //	basePath = parent.location.toString();
     //}
     
     if(document && document.location)
     {
        runtimePath = document.location.toString();
     
     }
     
     ki_runtimeRelativePath = ki_getRelativePath(basePath,runtimePath);
     if(ki_debug)
     {
        alert("ki_runtimeRelativePath = " + ki_runtimeRelativePath);
     }
     
  

  }
  
  if(ki_isNullString(ki_runtimeRelativePath))
  {
     //we cannot do a conversion... this should not be null
     //and it represents a situation that needs further 
     //investigation..
     return currentPath;
  
  }
  
  runtimePath = ki_runtimeRelativePath;
  
  
  //1) Situation 1: The runtime path IS the base directory, i.e. it is "."
  //In this situation we do not need to convert because the currentPath 
  //is already relative to the base directory.
  if(runtimePath == curdir)
  {
     
      convertedPath = currentPath;
      if(ki_debug)
      {  
         alert("Situation 1: Original path = " + path + " converted path = " + convertedPath);
      }
      return convertedPath;

      
  }
  
  //2) Situation 2: The currentPath IS the runtimePath. In this situation
  //we need to return "." to represent the current directory.
  if(runtimePath == currentPath)
  {
     convertedPath = curdir;
     if(ki_debug)
     { 
        alert("Situation 2: Original path = " + path + " converted path = " + convertedPath);
     }
     
     return convertedPath;

  
  }
  
  //3) Situation 3: The currentPath is a path above the base directory, i.e.
  //it starts with ".." In this situation we need only count the number
  //of slashes in the runtimePath and prepend that number of "../" strings
  //to the currentPath.
  if(ki_startsWith(currentPath,updir))
  {
      var count = ki_countOccurrences(runtimePath,ki_slash);
      if(count != 0 )
      {
         count += 1;
      
      }
      
      for (var cnt = 0; cnt < count; cnt++)
      {
         convertedPath += updir;
         convertedPath += ki_slash;
         
      }  
      
      convertedPath += currentPath;
      if(ki_debug)
      { 
         alert("Situation 3: Original path = " + path + " converted path = " + convertedPath);
      }
      
      return convertedPath;

  }
  
  //4) Situation 4: The currentPath is a subdirectory of the runtimePath.
  //This will be true if the currentPath startsWith the runtimePath.
  //In this case we need to return the path relative to runtimePath
  //by calling ki_getRelativePath function
  if(ki_startsWith(currentPath,runtimePath))
  {
     convertedPath = ki_getRelativePath(runtimePath + ki_slash,currentPath + ki_slash);
     if(ki_debug)
     {
        alert("Situation 4: Original path = " + path + " converted path = " + convertedPath);
     }
     
     return convertedPath;

  
  }
  
  //5) Situation 5: There may be directories in common between the 
  //currentPath and the runtimePath. We need to find where they 
  //diverge, count the number of directories to travel up, then
  //prepend that number of "../" to the currentPath.
  var runtimeSub = ki_getDifference(runtimePath,currentPath);
  var currentSub = ki_getDifference(currentPath,runtimePath);
  var slashCount = ki_countOccurrences(runtimeSub,ki_slash);
  slashCount += 1;
  for (var cnt = 0; cnt < slashCount; cnt++)
  {
      convertedPath += updir;
      convertedPath += ki_slash;
         
  }  
  
  convertedPath += currentSub;
  if(ki_debug)
  { 
     alert("Situation 5: Original path = " + path + " converted path = " + convertedPath);
  }
      
  return convertedPath;

}


/******************************************************************************************
**
** Function:   ki_getRelativePath 
** Inputs:	   basePath - the base path
**             otherPath - a path representing a sub diretory of base path
**				   
** Return:	   the other path relative to basePath
**			
**
** Description:
**This Function finds the path relative to the basePath given the basePath and
** a path representing a subdirectory.
******************************************************************************************/
function ki_getRelativePath(basePath,otherPath){
   

   if(ki_isNullString(basePath))
   {
   
      return null;
   
   }
   
   if(ki_isNullString(otherPath))
   {
  
      return null;
   
   }
   
   basePath = ki_stringReplace(basePath, ki_backslash,ki_slash);
   otherPath = ki_stringReplace(otherPath,ki_backslash,ki_slash);
   

   var index = ki_getLastIndexOf(otherPath,ki_slash,ki_zeroBase); 
   
   if(index < 0)
   { 
  
      return null;
   
   }
   
   var baseIndex = ki_getLastIndexOf(basePath,ki_slash,ki_zeroBase); 
   if(baseIndex < 0)
   {
   
      return null;
   
   }
   
   
   
   var baseDir = basePath.substring(ki_zeroBase,baseIndex-1);
   


   var otherDir = otherPath.substring(ki_zeroBase,index-1);
  
   var baseLen = baseDir.length;
   var otherLen = otherDir.length;
   if(otherDir == baseDir)
   {
      return ".";
   
   }
   
   var startIndex = baseLen + 1;
   if(startIndex > (otherLen - 1))
   {
   

      return null;
   
   }
   
   var relPath = otherDir.substring(startIndex);
   
   return relPath;
}




/******************************************************************************************
**
** Function     ki_buildArchiveString
** Inputs:	simList - comma delimited list of simulation names and any plugins archives
**                    required.
**              ns - boolean indicating if the browser is netscape and we should use jar files
**              
**              
**				   
** Return:	string representing a list of archive sim or jar files.
**              
**			
**
** Description:
** This Function creates a string representing the archives to be loaded.
** 
******************************************************************************************/
function ki_buildArchiveString(simList, ns)
{

  //Need to parse a comma delimited list of sims.
   var archiveList = " ";
   var ch = "";
   var index = 0;
   var extension = ".sim";
   if(ns)
   {
      extension = ".jar";
   
   }
   
   while(index < simList.length)
   {
      ch = simList.substring(index,index+1);
  
  

      if(ch == ",")
      {
         archiveList = archiveList + extension;
  
      }
  
      archiveList = archiveList + ch;
      index = index + 1;
  
   }
  
   archiveList = archiveList + extension;
   
   //If there are plugins, add the archive string
   if(!ki_isNullString(ki_pluginsArchive))
   { 
      archiveList = archiveList + ki_pluginsArchive;
   
   }
   
   return archiveList;


}




/******************************************************************************************
**
** Function     ki_showWindow
** Inputs:	simName - the name of the simulation to show
**              
**              
**              
**				   
** Return:	boolean value indicating success
**              
**			
**
** Description:
** This Function calls the StartApplet's showSim method
** 
******************************************************************************************/
function ki_showWindow(simName)
{
   
   if(ki_engineReady)
   {
      
      var val = document.Start.showSim(simName,ki_simulations[simName]);
      if(val == 1)
      {
         
         ki_removeSimFromReadyList(simName);
         return true;
      
      }
   
   }
   
   
   var hash = ki_simulations[simName];
   alert("Could not show the window for " + simName + "  hashcode = " + hash + "  -- Check your java console for possible runtime error");
   return false;

}




/******************************************************************************************
**
** Function     ki_addSimToReadyList
** Inputs:	simName - the name of the simulation
**              simHash - hashcode of the ResourceApplet that will load this sim 
**
**              
**              
**				   
** Return:	none
**               
**              
**			
**
** Description:
** This Function sets the value of simName in the ki_simulations array to the hashcode
** of the ResourceApplet indicating that it is ready to show.
** 
******************************************************************************************/
function ki_addSimToReadyList(simName,simHash)
{
   if(ki_simulations == null)
   {
      return false;
   
   }
   ki_simulations[simName] = simHash;
   return true;

}


/******************************************************************************************
**
** Function     ki_isSimInReadyList
** Inputs:	key - the name of the simulation
**              value - value we are searching for 
**
**              
**              
**				   
** Return:	boolean value indicating that the simulation is in the list with the 
**              specified value
**               
**              
**			

**
** Description:
** This Function allows us to determine if the simulation is ready to be viewed. If the
** value "preloading" is passed as the value we can determine that a particular sim 
** is NOT ready if we do not yet know the hashcode of the ResourceApplet
** 
******************************************************************************************/
function ki_isSimInReadyList(key,value)
{
   if(ki_simulations == null)
   { 
   
      return false;
   
   }
   
   
   if(ki_simulations[key] == value)
   {

      return true;

   }

   return false;

}





/******************************************************************************************
**
** Function     ki_removeSimFromReadyList
** Inputs:	simName - the name of the simulation to remove
**              
**              
**				   
** Return:	none
**               
**              
**			
**
** Description:
** This Function resets the status of the simulation in the ki_simulations
** array to that of "preloading", i.e. the simulation is no longer ready
** to be viewed until the next call to simReady.
** 
******************************************************************************************/
function ki_removeSimFromReadyList(simName)
{
   if(ki_simulations != null)
   {
     ki_simulations[simName] = ki_preloading;
   
   }
   else
   {
     alert("ki_simulations array was null!");
   

   }
   

   return true;

}






/////////////////////////  Utility Functions /////////////////
/******************************************************************************************
**
** Function:  ki_getDifference
** Inputs:	  sourceStr - a string
**            searchStr - the string to compare sourceStr with
**				   
** Return:	  a substring of sourceStr that does not match with searchStr
**			
**
** Description:
**This Function finds and returns the substring of sourceStr that doesn not
**match searchStr. Used for converting paths from a path relative to the 
**base directory, to one relative to the runtime dir, required for Netscape
**browsers to assure the correct codebase of the ResourceApplet
******************************************************************************************/
function ki_getDifference(sourceStr, searchStr)
{
   
   if(ki_isNullString(sourceStr) || ki_isNullString(searchStr))
   {
      return null;
   
   }
   var lastMatchingIndex = -1;

   var index = 0;
   var ch1 = sourceStr.substring(index,index + 1);
   var ch2 = searchStr.substring(index,index + 1);
   
   if(ch1 == ch2)
   {
      lastMatchingIndex = 0;
   
   }
   else
   {
      return sourceStr; //no matches
   
   }
   
   index += 1;
   
   while(ch1 == ch2 && index < sourceStr.length && index < searchStr.length)
   {
       ch1 = sourceStr.substring(index, index + 1);
       ch2 = searchStr.substring(index, index + 1);
       if(ch1 == ch2)
       {
          lastMatchingIndex = index;
       }
       
       index += 1;
   
   }
   
   index = lastMatchingIndex + 1;
   if(index >= sourceStr.length)
   {
      
      return sourceStr;
   }
   var sourceSub = sourceStr.substring(index);
  
   return sourceSub;
  
}



/******************************************************************************************
**
** Function     ki_stringReplace
** Inputs:	sourceStr - the string to search
**              searchStr - the string to search for
**              replaceStr - the string to replace the searchStr with
**              
**              
**              
**				   
** Return:	the modified string
**               
**              
**			
**
** Description:
** This Function performs a search and replace on a string. 
** 
******************************************************************************************/
function ki_stringReplace(sourceStr, searchStr, replaceStr)
{

   var parseString="";

   if (ki_isNullString(sourceStr))
   {
      return sourceStr;   
     
   }
   
   if(ki_isNullString(searchStr) || ki_isNullString(replaceStr))
   {
      return sourceStr;
   
   }
			

   var searchIndex = 0;
   var oldSearchIndex = searchIndex;
   var parseString="";

   while (searchIndex < sourceStr.length &&
	 (searchIndex = sourceStr.indexOf(searchStr, searchIndex)) >= 0)
   {

	parseString= parseString+sourceStr.substring(oldSearchIndex, searchIndex);
	parseString = parseString + replaceStr;
        searchIndex += searchStr.length;
	oldSearchIndex = searchIndex;

   }
   
   if (oldSearchIndex < sourceStr.length)
   {

	parseString = parseString + sourceStr.substring(oldSearchIndex);
   }


   return parseString;
}

function ki_getLastIndexOf(sourceStr, searchStr, startIndex)
{

   
   if(ki_isNullString(sourceStr) || ki_isNullString(searchStr))
   {
      return -1;
   
   }
   
   var searchIndex = startIndex;
   var oldSearchIndex = searchIndex;
   while(searchIndex < sourceStr.length && 
   (searchIndex = sourceStr.indexOf(searchStr, searchIndex)) >= 0)

   {
      searchIndex += searchStr.length;
      oldSearchIndex = searchIndex;
   
   }
   
   return oldSearchIndex;


}

/******************************************************************************************
**
** Function     ki_trim
** Inputs:	inputString - the string to trim
**              
**              
**              
**				   
** Return:	the newly trimmed string
**               
**              
**			
**
** Description:
** This Function removes leading and trailing spaces from the passed in string. 
** 
******************************************************************************************/
function ki_trim(inputString)
{
   if(inputString == null)
   {
      return inputString;
   
   }
   
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") 
   { 
      //check for spaces at beginning of the string.
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") 
   { 
      // check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }


   return retValue;
}

/******************************************************************************************
**
** Function:   ki_startsWith  
** Inputs:	   sourceStr - the string to search
**             searchStr - the string to look for at the beginning of sourceStr
**				   
** Return:	   boolean value 
**			
**
** Description:
**This Function determines if the sourceStr starts with the searchStr
******************************************************************************************/
function ki_startsWith(sourceStr, searchStr)
{
   if(ki_isNullString(sourceStr) || ki_isNullString(searchStr))
   {
      return false;
   
   }
   
   
   var sourceLen = sourceStr.length;
   var searchLen = searchStr.length;
   if(searchLen > sourceLen)
   {
      return false;
   
   }
   
   
   var sourceSub = sourceStr.substring(0,searchLen);
   
   
   if(sourceSub == searchStr)
   {
      return true;
   
   }
   
   return false;



}

/******************************************************************************************
**
** Function:   ki_countOccurrences 
** Inputs:	   sourceStr - the string to search
**             searchStr - the string to count
**				   
** Return:	   number of occurrences of searchStr within sourceStr
**			
**
** Description:
**This Function counts the number of occurrences of the searchStr within the sourceStr
******************************************************************************************/
function ki_countOccurrences(sourceStr,searchStr)
{
    var searchIndex = -1;
    var startIndex = 0;
    var count = 0;
           
    if(ki_isNullString(sourceStr) || ki_isNullString(searchStr))

    {
      return 0;
   
    }
   
   
   var sourceLen = sourceStr.length;
   var searchLen = searchStr.length;
   if(searchLen > sourceLen)
   {
      return 0;
   
   }
   
   if(sourceStr == searchStr)
   {
     return 1;
   
   }

   
   searchIndex = sourceStr.indexOf(searchStr,startIndex);
   if(searchIndex < 0)
   {
      return 0;
   
   } 
   else
   {
      count += 1;
      startIndex = searchIndex + 1;
   
   }  
   
   while(searchIndex >= 0 && startIndex < sourceLen)
   {
      searchIndex = sourceStr.indexOf(searchStr,startIndex);
      if(searchIndex >= 0)
      {
         count += 1;
         startIndex = searchIndex + 1;
      
      }
   
   }
   
   return count;
    
}



/******************************************************************************************
**
** Function:   ki_endsWith  
** Inputs:	   sourceStr - the string to search
**             searchStr - the string to look for at the end of sourceStr
**				   
** Return:	   boolean value 
**			
**
** Description:
**This Function determines if the sourceStr ends with the searchStr
******************************************************************************************/
function ki_endsWith(sourceStr, searchStr)
{
   if(ki_isNullString(sourceStr) || ki_isNullString(searchStr))
   {
      return false;
   
   }
   
   
   var sourceLen = sourceStr.length;
   var searchLen = searchStr.length;
   if(searchLen > sourceLen)
   {
      return false;
   
   }
   
   
   var sourceSub = sourceStr.substring(sourceLen - searchLen);
   
   
   if(sourceSub == searchStr)
   {
      return true;
   
   }

   
   return false;



}
/******************************************************************************************
**
** Function     ki_isNullString
** Inputs:	s - the string to test for nullness
**              
**              
**              
**				   
** Return:	boolean value indicating if the string is "null"
**               
**              
**			
**
** Description:
** This Function determines the "nullness" of a string by first "trimming" the string
** and then checking its length.
** 
******************************************************************************************/
function ki_isNullString(s)
{

    if(s == null || s == "null")
    { 
    
      return true;
    }
    
    if(s)
    {

       var testString = ki_trim(s);
       if(testString.length > 0)
       {
          return false;

       }



    }



    return true;

}


/******************************************************************************************
**
** Function     ki_createArray
** Inputs:	list - comma delimited list of simulation names
**              initialValue - default initial value in the "hashtable"
**              
**              
**              
**				   
** Return:	Array which acts as a "hashtable" with the sim names as keys
**               
**              
**			
**
** Description:
** This Function creates an array which actually acts like a Java hashtable. The key
** to the entry is the name in the list and the value is set to the passed-in 
** initialValue. In multiple sim preloading, this array will allow us to keep track
** of which sims are still loading and which are ready to be displayed. When the
** simulation is loaded we set the value to the hashcode of the ResourceApplet.
** 
******************************************************************************************/
function ki_createArray(list,initialValue)
{

   var array = new Array();

   var index = 0;
   var ch = "";
   var arrayItem = "";
   while(index < list.length)
   {

      ch = list.substring(index,index + 1);

      if(ch == ",")
      {
         array[arrayItem] = initialValue;
         arrayItem = "";


      }
      else
      {
         arrayItem = arrayItem + ch;



      }

      index = index + 1;

   }


   array[arrayItem] = initialValue;
   return array;


}

/******************************************************************************************
**
** Function:   ki_addSimListener 
** Inputs:	   object that will act as a listener for events in the life of 
**             both the engine and any sims.
**				   
** Return:	   true
**			
**
** Description:
** Adds a listener to the array of listeners (var ki_listeners)
****************************************************************************************/

function ki_addSimListener(listener)
{
   if(ki_listeners == null)
   { 
      ki_listeners = new Array();

   }
   
   ki_listeners[ki_listenerLen] = listener;
   ki_listenerLen++;
   return true;
}

/******************************************************************************************
**
** Function:   ki_removeSimListener 
** Inputs:	   object that will act as a listener for events in the life of 
**             both the engine and any sims.
**				   
** Return:	   true 
**			
**
** Description:
** Removes a listener from the array of listeners (var ki_listeners)
****************************************************************************************/

function ki_removeSimListener(listener)
{
   if(ki_listeners == null)
   { 
      return true;
   }
   
   //If anyone knows a better way to remove an item from array
   //then please let me know
   var currentListener = null;
   var index = 0;
   var array = new Array();
   while(index < ki_listenerLen)
   {
      currentListener = ki_listeners[index];
      if(currentListener != listener)
      {
          array[index] = currentListener;
      
      }
      else
      {
          ki_listenerLen--;
      }
      
      index++;
   
   }
   
   ki_listeners = array;
   return true;
   
}





/******************************************************************************************
**
** Function:   ki_jsLoaded  
** Inputs:	   none
**				   
** Return:	   true
**			
**
** Description:
** This Function's purpose is to indicate to other code that all the javascript functions
** have been loaded so that we do not try to call any functions of this file until
** this func is legitimate.
******************************************************************************************/
function ki_jsLoaded()
{
  
   
   return true;
}

/******************************************************************************************
**
** Function:   openBrowserWindow 
** Inputs:	   none
**				   
** Return:	   none
**			
**
** Description:
** This Function's purpose is to open a browser window

******************************************************************************************/

function openBrowserWindow()
{
    if(arguments.length < 3)
    {
    	return;
    }
		
    window.open(arguments[0],arguments[1],arguments[2]);
			
}

/******************************************************************************************
**
** Function:   openDirectionsWindow 
** Inputs:	   none
**				   
** Return:	   none
**			
**
** Description:
** This Function's purpose is to open a window for viewing of directions and 
** About Firefly information.

******************************************************************************************/

function openDirectionsWindow()
{		
    openBrowserWindow();
			
}








