$.fn.tablerowChecker = function(over_color,selected_color)
{
	this.each(
		function()
		{
			this.orig_color = $(this).css('background-color');
			$(this).css('cursor','pointer');
			$(this).mouseover(function(){
				$(this).css('background-color',over_color);
			});
			if($('td input:checkbox',this).length > 0){
				$(this).click(function(){
					$('input:checkbox',this).each(function(){
						val = $(this).attr('checked');
						$(this).attr('checked',!val);
					});
					if($('input:checkbox',this).attr('checked')){
						$(this).css('background-color',selected_color);
					} else {
						$(this).css('background-color',this.orig_color);
					}
				});
				$('input:checkbox',this).click(function(){
					val = $(this).attr('checked');
					$(this).attr('checked',!val);
				});
				$(this).mouseout(function(){
					if($('td input:checkbox',this).attr('checked')){
						$(this).css('background-color',selected_color);
					} else {
						$(this).css('background-color',this.orig_color);
					}
				});
			} else {
				$(this).mouseout(function(){
					if(this.selected==false){
						$(this).css('background-color',selected_color);
					} else {
						$(this).css('background-color',this.orig_color);
					}
				});			
				$(this).click(function(){
					if(this.selected==false){
						this.selected=true;
					} else {
						this.selected=false;
					}
				});
			}
		}
	);
		
	return this;
};