window.site = {
  message: {
    remove: function() {
      $.removebar();
    },
    custom: function(message, params) {
      if(!message)
        return;
      
      var params = $.extend({
        position: 'top',
        removebutton: false,
        color: '#FFF',
        message: message,
        time: 5000
      }, params || {});
      
      jQuery(document).ready(function($) {
        $.bar(params);
      });
    },
    addToCart: function() {
      site.message.custom('Your selection has been added to the cart!', {time: 3000});
    }
  }
};

Phpr.showLoadingIndicator = function() {
  site.message.custom('<img src="/resources/images/ajax-loader.gif" width="32" height="32" /> <span class="text">Loading...</span>', {background_color: '#FFF', color: '#808080', time: 999999});
};

Phpr.hideLoadingIndicator = function() {
  site.message.remove();
};

Phpr.response.popupError = function() {
  site.message.custom(this.html.replace('@AJAX-ERROR@', ''), {background_color: '#FFF', color: '#808080', time: 10000});
};
