var cssBackground = new Class({
  Implements: Options,
	options: {
	 bgClass:'.moduleBodyWrap',
	 pid:1
	},
	initialize: function(options) {
		if(Browser.loaded){
			this.setup(options);
		} else{
		  window.addEvent('domready', this.setup.pass([options],this));
		}
	},
	setup: function(options) {  
	  this.setOptions(options);
	  
	  var items = $$(this.options.bgClass);
	  items.each(function(item){
	      var size = item.getSize();
        
        ajaxRequest = new Request.JSON({
          method:'get',
          url:'index.php?eID=user_cssbackground&pid='+this.options.pid+'&width='+size.x+'&height='+size.y,
          onSuccess: function(JData) {
            item.setStyle('background-image','url('+JData.image+')');
          }
        }); 
       ajaxRequest.send();
    }.bind(this));
    
  }
});
