var cssBackground = new Class({
	initialize: function(options) {
	  var me = this;
		if(Browser.loaded){
			this.setup(element, options);
		} else{
			window.addEvent('domready', this.setup.pass([this, options]));
		}
	},
	setup: function(me, options) {  
	  
	  var items = $$('div.'+options.divtop+' div.'+options.divsub);
	  items.each(function(item){
	      var size = item.getSize();
        // alert("The element is "+size.x+" pixels wide and "+size.y+"pixels high.");
       
        ajaxRequest = new Request.JSON({
          method:'get',
          url:'index.php?eID=user_cssbackground&pid='+options.pid+'&width='+size.x+'&height='+size.y,
          onSuccess: function(JData) {
            item.setStyle('background-image','url('+JData.image+')');
          }
        }); 
       ajaxRequest.send();
    });
    
  }
});

