

/**************************************************************

	Script		: Sortable Table
	Version		: 1.4
	Authors		: Samuel Birch
	Desc			: Sorts and filters table elements
	Licence		: Open Source MIT Licence

**************************************************************/

/*var sortableTable = new Class(
{							  
	getOptions: function()
	{
		return {
			overCls: false,
			onClick: false,
			sortOn: 0,
			sortBy: 'ASC',
			filterHide: true,
			filterHideCls: 'hide',
			filterSelectedCls: 'selected'
		};
	},

	initialize: function(table, options)
	{
		this.setOptions(this.getOptions(), options);
		this.table = $(table);
		this.tHead = this.table.getElement('thead');
		this.tBody = this.table.getElement('tbody');
		this.tFoot = this.table.getElement('tfoot');
		this.rows = this.tBody.getElements('tr');
		this.cells = this.tBody.getElements('td');
		
		this.filtered = false;
		
		this.rows.each(function(el,i)
				   {
			if(this.options.overCls)
			{
				el.addEvent('mouseover', function(){
					el.addClass(options.overCls);
				}, this);
				el.addEvent('mouseout', function(){
					el.removeClass(options.overCls);
				});
			}
			
			
			this.altRow();
		}, this);
		
		
		this.cells.each(function(el,i)
				{
					hasScript = true;
					if(el.attributes.getNamedItem('id') != null && el.attributes.getNamedItem('id').nodeValue == "noscript") hasScript = false;
		if(this.options.onClick && hasScript){
				el.addEvent('click', options.onClick);
			}
		}, this);
		
		
	},

	altRow: function(){
		this.rows.each(function(el,i){
			if(i % 2){
				el.removeClass('altRow');
			}else{
				el.addClass('altRow');
			}
		});
	}
});
sortableTable.implement(new Events);
sortableTable.implement(new Options);*/

function setDetailTable()
{
	var dTable = document.getElementById('detailTable');
	tableRows = dTable.getElementsByTagName('tbody')[0].getElementsByTagName('tr');
	for(var i = 0; i < tableRows.length; i++)
	{
		tr = tableRows[i];
		if(i % 2)
		removeClass(tr, 'altRow');
		else
		addClass(tr, 'altRow');
		
		addEvent(tr, "mouseover", function(){addClass(this, "over")});
		addEvent(tr, "mouseout", function(){removeClass(this, "over")});
		addEvent(tr, 'click', function(){window.location.href = "?page=addcart&id=" + this.id});
	}
}

/*************************************************************/
