var frozenButtons = [];

function freezeButton (event) {
  var button = Event.element(event);
  var origText = button.value;
  button.value = "Please wait...";
  button.addClassName("frozen");
  frozenButtons.push(button);
  button.disable();
  setTimeout('thawButton("' + origText + '")', 5000);
}

function thawButton (origText) {
  var button = frozenButtons.pop();
  button.value = origText;
  button.removeClassName("frozen");
  button.enable();
}

function makeFreezableButtons () {
  $$("input.freezable").each(
    function (button) {
      Event.observe(button, "click", freezeButton);
    }
  );
}

function fireActionPixel (_uid, _sid, _name, _group, _location, _action) {
  var pixel = '/images/count.gif';
  var rand = Math.random() * 10000000000000000;
  new Ajax.Request(pixel, {
    method: 'get',
    parameters: { "uid": _uid, "sid": _sid, "name": _name, "group": _group, "location": _location, "action": _action, "r": rand },
    onSuccess: function (transport) {
    },
    onFailure: function (transport) {
    },
    onComplete: function (transport) {
    }
  });
}
