ElLandingPage = Class.create({
	current: null,
	total: null,
	timerID: null,
	delay: null,

	initialize: function(delay) {
	    this.total = $('elLandingPageArticleMenu').down('div.headingWrapper').select('div.heading').length;
	    this.current = 0;
	    this.delay = delay * 1000;

	    // show the first one
	    this.showCurrentItem();

	    // set up interval
	    this.startInterval();
	},

	startInterval: function(){
	    // start interval if it's not already running
	    if (this.timerID == null) {
		this.timerID = setInterval("ellp.timerShowItem();", this.delay);
	    }
	},

	stopInterval: function(){
	    // stop interval if running
	    if (this.timerID != null) {
		clearInterval(this.timerID);
		this.timerID = null;
	    }
	},

	userShowItem: function(i){
	    // stop interval if running
	    this.stopInterval();

	    // update only if current pointer has changed
	    if (i != this.current) {
		this.hideCurrentItem();
		this.current = i;
		this.showCurrentItem();
	    }
	},

	timerShowItem: function(){
	    this.hideCurrentItem();
	    this.current = (this.current + 1) % this.total;
	    this.showCurrentItem();
	},

	showCurrentItem: function(){
	    $('elLandingPageArticleMenu').down('div.headingWrapper').down('div.heading', this.current).addClassName('active');
	    $('elLandingPageArticleMenu').down('div.bodyWrapper').down('div.body', this.current).removeClassName('hidden');
	},

	hideCurrentItem: function(){
	    $('elLandingPageArticleMenu').down('div.headingWrapper').down('div.heading', this.current).removeClassName('active');
	    $('elLandingPageArticleMenu').down('div.bodyWrapper').down('div.body', this.current).addClassName('hidden');
	}

});
var ellp;
