window.site = {
  message: {
    remove: function() {
      $.removebar();
    },
    custom: function(message, params) {
      if(!message)
        return;
      
      var params = $.extend({
        position: 'top',
        removebutton: false,
        color: '#666',
        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('Processing...', {background_color: '#393536', color: '#fff', time: 999999});
};

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

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

function custom_alert(text) {
  site.message.custom(text, {background_color: '#393536', color: '#fff', time: 5000});
}

