/**
 * Carousel
 */
var Carousel = Class.create({
		
	/**
	 * Init Carousel
	 */
	initialize: function(element, options) {
		this.options = Object.extend({
			container : '',
			feedheight : '',
			feedURL : ''
		}, options || { });
		
		// load content
    this.element = $(element);
    this.id = this.element.id;
    this.container   = this.element.down(this.options.container);

		var strURL = this.options.feedURL + "?feedheight="+this.options.feedheight;
		new Ajax.Request(strURL, {
			onSuccess: function(response) {
				this.container.innerHTML = response.responseText;
				this.carousel = new UI.Carousel(element, {
					container : this.options.container,
					nextButton : false,
					previousButton : false,
					direction : 'vertical'
				});
				// fire event
				document.fire("feed:ready", {});
			}.bind(this),
			onFailure: function(response) {
			}.bind(this)
		});
	},
	
	scroll: function() {
		this.carousel.scrollTo(1);		
	}	
}); 
