DEVMODE = true;
(function($) {
  $.translate = function(word, path) {
    var translation = word;
    if ($.translations && $.translations[path] && $.translations[path][word]) {
        translation = $.translations[path][word];
    } else if (DEVMODE) {
      $.post('json.php?controller=general&action=translate', {
        path : path,
        word : word
      });
    }
    return translation;
  };

  $.json = function(controller, action, data, callback) {
    if (!callback && $.isFunction(data)) {
      callback = data;
      data = {};
    }
    $.getJSON('json.php?controller=' + controller + '&action=' + action, data, function(j, textStatus) {
      if (typeof(callback) == 'function') {
        callback(j);
      }
    }, 'json');
  };

  $.unique_id = function() {
    return ((new Date()).getTime() + "" + Math.floor(Math.random() * 1000000)).substr(0, 18);
  };


})(jQuery);
