MTJax.Action = {

  receive : function(Response)
  {
    eval('Response = ' + Response.responseText);

    if (Response.Actions)
    {
      MTJax.Action.execute(Response.Actions);
    }

    Behaviour.apply();
  },

  execute : function(Actions)
  {
    for (OnAction = 0; OnAction < Actions.length; OnAction++)
    {
      var act = Actions[OnAction];
      try
      {
        this.executeAction(act);
      } catch (e)
      {
        console.log('errrrrorr ....', act, e);
      }
    }
  },

  executeAction : function(Action)
  {
    var Elem = $(Action.OnId);

    switch (Action.Do)
    {
    case 'eval':
      eval(Action.Value);
      break;

    case 'Reload':
      document.location.reload();
      break;

    case 'SetValue':
      if (Elem.value)
      {
        Elem.value = Action.Value;
				if (!Browser.Engine.trident) Elem.highlight('#f00');
      }
      break;

    case 'SetChecked':
      Elem.checked = Action.Value;
      break;

    case 'SetHTML':
      Elem.set('html', Action.Value);
      break;

    case 'AddHTML':
      Elem.set('html', Elem.get('html') + Action.Value);
      break;

    case 'Overlibs':
      for (Thing in Action.Value.OverLibs)
      {
        if (Thing == 'IDs')
        {
          IDs = Action.Value.OverLibs[Thing];
          for (i = 0; i < IDs.length; i++)
            Overlibs.Pre.IDs.push(IDs[i]);
        } else
        {
          Overlibs.Pre[Thing] = Action.Value.OverLibs[Thing];
        }
      }
      Overlibs.prepare();
      break;

    case 'Glow':
      // new fx.TextColorPump(Elem, {Duration: 400});
      // new MTJax.Action.Glow(Elem);
      break;
    }
  }
};

