/** 
 * @author Arianna Winters <arianna.winters@nfl.com>
 * @copyright 2007 NFL
 * @package nfl.ui.behaviors.stats
 * @version 1.0
 * @requires prototype
 * @requires nfl
 * 
 * @deprecated stats.js
 * @deprecated stats_home.js
 **/
nfl.namespace("nfl.ui.behaviors.thumbs.images.stats");
nfl.ui.behaviors.thumbs.images.stats.rowClasses	= {on:'selectedPlayer',off:'deselectedPlayer'};
nfl.ui.behaviors.thumbs.images.stats.image		= Class.create();
nfl.ui.behaviors.thumbs.images.stats.image.prototype = {
	initialize: function(src,uri,title,rosrc,target){
		this.src	= src;
		this.target	= target;
		this.uri	= uri;
		this.title	= title;
		this.thumb	= $('pictureLink');
		
		this.image			= new Image();
		this.image.onerror	= function(){ this.src	= nfl.global.imagepath +'/img/sr_pic0.gif'; }
		this.image.src		= this.src;

		Event.observe($(rosrc),'mouseover',this.onMouseOver.bind(this));
		Event.observe($(rosrc),'click',function(){
			//location.replace(this.uri);
		}.bind(this));
	},
	onMouseOver: function(event){
		//change thumbnail image to preloaded one
		$(this.target +'_thumb').src	= this.image.src;
		var currentRow	= (Event.findElement(event, 'tr'));
		currentRow.addClassName(nfl.ui.behaviors.thumbs.images.stats.rowClasses.on);
		//set classname to off state on all other rows
		var widgetRows	= new Array('r1c1_1','r1c1_2','r1c1_3','r1c1_4');
		for(r=0; r<widgetRows.length; r++){
			var cRow	= $(widgetRows[r]);
			if(cRow){ if(cRow.id != currentRow.id){ cRow.removeClassName(nfl.ui.behaviors.thumbs.images.stats.rowClasses.on); }}
		}
		//now change featured href
		if(this.uri != ('/players//profile?id=')){
			this.thumb.href		= this.uri;
			this.thumb.title	= this.title;
			this.thumb.alt		= this.title;
		}
	},
	onMouseOut: function(event){
		Event.findElement(event, 'tr').removeClassName(nfl.ui.behaviors.thumbs.images.stats.rowClasses.on);
	},
	onError: function(){
		$(this.target +'_thumb').src = nfl.global.imagepath + '/img/sr_pic0.gif'; 
	}
}
//document.fire('script:libStatsBehaviorsLoaded');
