     // This is a function called by the GUI applet to transfer the Command Center's code into the Communicator Applet
function setRunAndProc(cc, procs)
{
 document.CRKinterface.setRunandProc(cc, procs);
}
function SetType(name, type)
{
 document.board.SetType(name, type);
}
function disable(sensa, sensb, outpa, outpb)
{
 if(sensa == true)
  document.board.DisableObject("sensor", "a");
 if(sensb == true)
  document.board.DisableObject("sensor", "b");
 if(outpa == true)
  document.board.DisableObject("output", "a");
 if(outpb == true)
  document.board.DisableObject("output", "b");
}
function CommandTransfer(command, val1, val2)
{
 if(command == null)
  window.alert("Communication Error: No command to transfer.");
 else
  {
   if(val1 == null && val2 == null){
    if(command == "getIRData")
     return document.CRKinterface.getMonitorData();
    else
     document.board.getCommand(command);
   }
   else if(command == "putIRData"){
    if( val1 != null)
     document.CRKinterface.setMonitorData(val1);
    else if( val2 != null)
     document.CRKinterface.setMonitorData(val2);
    else
     alert("Invalid arguments in command (putIRData): \n putIRData needs an integer value.");
   }
   else if(command == "getSensorData") {
    if( val1 != null)
     return board.getSensorData(val1);
    else if(val2 != null)
     return board.getSensorData(val2);
    else
     alert("Invalid arguments in command (getSensorData): \n getSensorData needs an ID.");
   }
   else if(val1 == null && val2 != null)
    document.board.getCommand(command, val2);
   else if(val1 != null && val2 == null)
    document.board.getCommand(command, val1);
   else if(val1 != null && val2 != null)
    document.board.getCommand(command, val1, val2);
   else
    window.alert("Communication Error: Invalid Argument values/types.");
  }
}
function TransferSensorData(val)
{
 document.communicator.setSensorReturn(val);
}
function RSButton()
{
 document.communicator.RSButton();
}
function setMonitorData(val)
{
 document.CRKinterface.setMonitorData(val);
}
function boardRunning(){
 document.board.Running();
}
function boardNotRunning(){
 document.board.NotRunning();
}
function isRunning()
{
 if(document.communicator.isRunning())
  return "running";
 else
  return "not_running";
}

function CompileCC(codeline)
{
 if( document.communicator.isRunning() )
  alert(" The Cricket is currently running.\n In order to load additional or new code, you must:\n 1. Press the Run/Stop button.\n 2. Reload new code.");
 else
  document.communicator.CompileCC(codeline);
}

    // This is a function called by the GUI applet to transfer the Runthis and Procedure codes into the Communicator Applet
function CompileProcs(procedure_code, runthis_code)
{
 if( document.communicator.isRunning() )
  alert(" The Cricket is currently running.\n In order to load additional or new code, you must:\n 1. Press the Run/Stop button.\n 2. Reload new code.");
 else
  document.communicator.CompileProcs(procedure_code, runthis_code);
}
