/**
 * @fileOverview A collection of classes and functions for this project.
 * @name Project name
 * @author Tobias Kreß, kress@kupferwerk.com
 * @version 1.0
 */



/**
 * @class Description for this application class
*/
var Application = Class.create(KWStandard, {
	/**
	 * @constructor
	 */
	initialize: function() {

	},
	
	/**
	 * Dummy function description
	 * @param {string} HTML element id
	 * @return {boolean} Returns true/false
	*/
	dummyFunction: function(id) {
		return false;
	}
	
});

/**
 * @class Looping through list
*/
var listLoop = Class.create(KWStandard, {
  /**
   * @constructor
   */
  list: false,
  active_item: false,
  
  initialize: function(list) {
    this.list = list;
    this.active_item = list.down('li').addClassName('active');

    new PeriodicalExecuter(function() {
      this.startLoop();
    }.bind(this), 7);
  },
  
  startLoop: function() {
    list = this.list;
    trigger = this.active_item.next('li');
    if(!trigger)
      trigger = this.list.down('li');
	  this.switchItem(trigger);
  },
  
  switchItem: function(trigger) {
	  this.active_item.fade({
	    duration: 0.3,
	    afterFinish: function() {
	      trigger.addClassName('active');
    	  trigger.appear({duration: 0.3});
    	  this.active_item = trigger;
	    }.bind(this)
	  }).removeClassName('active');
	  return false;
	}
  
});
