//
// TableHover jQuery Plug-in:
// Called using: $(selected).tableHover();
// Adds classes 'highLightCol', 'highLightRow', and 'highLightCell' to appropriate cells.
//

(function($){
	$.fn.tableHover = function(){
		this.each(function(){
			var table = $(this),
				tr = table.find('tr'),
				td = table.find('td'),
				col, par;
				
			td.live('mouseover',function(){
				par = $(this).parent();
				col = $.inArray(this, par.find('td'));
				tr.each(function(){
					$(this).find('td').eq(col).addClass('hightLightCol');
				});
				par.addClass('highLightRow');
				$(this).addClass('highLightCell');
			});
			
			td.live('mouseout',function(){
				td.removeClass('hightLightCol');
				$(this).removeClass('highLightCell');
				$(this).parent().removeClass('highLightRow');
			});
			
		});
	};
})(jQuery);
