/*
---
description:     ZebraTable

authors:
  - David Walsh (http://davidwalsh.name)

license:
  - MIT-style license

requires:
  core/1.2.1:   '*'

provides:
  - ZebraTable
...
*/
var ZebraTable = new Class({
	/* implements */
	Implements: [Options],

	/* options */
	options: {
		elements: 'table.list-table',
		even: 'even',
		odd: 'odd',
		cssHighlight: 'highlight',
		cssMouseEnter: 'mo'
	},

	/* initialization */
	initialize: function(options) {
		/* set options */
		this.setOptions(options);
		/* zebra-ize! */
		$$(this.options.elements).each(function(el) {
				this.zebraize(el);
		},this);
	},

	/* a method that does whatever you want */
	zebraize: function(el) {
		if(el.match('table'))
		{
			/* for every row in this table... */
			el.getElements('tr').each(function(tr,i) {
				/* check to see if the row has th's
					if so, leave it alone
					if not, move on */
				if(tr.getFirst().get('tag') != 'th') {
					/* set the class for this based on odd/even */
					var self = this, klass = i % 2 ? self.options.even : self.options.odd;
					/* start the events! */
					tr.addClass(klass);
				}
			},this);
		}
		if(el.match('ul'))
		{
			
			el.getElements('li').each(function(li,i){
				if(i == 0){
					li.addClass('first');
				}
				var self = this, klass = i%2 ? self.options.even : self.options.odd;
				li.addClass(klass);
			},this);
		}

	}
});
