/**
 *	new product list mouse over
 *  @version 1.0 2008/10/17
 */
var ProductListRollover = {
	products			: null,
	productBottomLines	: null,
	
	initProductEvent : function (){
		this.products = $$("td.product");
		this.productBottomLines = $$("td.product-bottom-line");

		var length = this.products.length;
	
		for( var i = 0; i < length; i++ ){
	    	//product name
			var productNameLink = $( "a" + i );
			productNameLink.index = i;
		
			Event.observe( productNameLink, 'mouseover', this.setSelected.bindAsEventListener( productNameLink ), false );
			Event.observe( productNameLink, 'mouseout', this.setDefault.bindAsEventListener( productNameLink ), false );
		    //product image
    		var productImageLink = $( "img" + i );
			productImageLink.index = i;

			Event.observe( productImageLink, 'mouseover', this.setSelected.bindAsEventListener( productImageLink ), false );
			Event.observe( productImageLink, 'mouseout', this.setDefault.bindAsEventListener( productImageLink ), false );
		}
	},


	setSelected : function(){
		var index = this.index;
		ProductListRollover.products[index].removeClassName("default");
		ProductListRollover.products[index].addClassName("selected");
		ProductListRollover.productBottomLines[index].removeClassName("default");
		ProductListRollover.productBottomLines[index].addClassName("selected");
	},


	setDefault : function(){
		var index = this.index;
		ProductListRollover.products[index].removeClassName("selected");
		ProductListRollover.products[index].addClassName("default");
		ProductListRollover.productBottomLines[index].removeClassName("selected");
		ProductListRollover.productBottomLines[index].addClassName("default");
	}
}

Event.observe( window, "load", ProductListRollover.initProductEvent.bindAsEventListener( ProductListRollover ));

