TGP.Home= { 
	Scroller:null,
	Timer:null,
	CurrentFeature:1, 
	TotalFeatures:7,
	Timeout:12000,
	ThumbPreviewTexts:[],
	init:function(){ 
		this.Scroller = $('FeatureScroller'); 
		this.GoPane(); 
		this.Timer = setTimeout(this.Listeners.GoNextAuto,TGP.Home.Timeout); 
		this.ThumbPreviewTexts = TGP.Init.initData.HomeThumbs;
		// E.addListener(this.Scroller,'mouseenter',function(){ clearTimeout(TGP.Home.Timer); })
		// E.addListener(this.Scroller,'mouseleave',function(){ TGP.Home.Timer = setTimeout(TGP.Home.Listeners.GoNextAuto,TGP.Home.Timeout);  }); 
		E.addListener(Dom.getElementsByClassName('scrollthumb'),'click',this.Listeners.JumpToFeature); 
		E.addListener(Dom.getElementsByClassName('scrollthumb'),'mouseover',this.Listeners.ShowThumbPreview); 
		E.addListener(Dom.getElementsByClassName('scrollthumb'),'mouseout',function(){$('InfoTable').style.display='none';}); 
	},
	GoPane:function(){ 
		var up = new YAHOO.util.Anim('FeatureText_'+this.CurrentFeature,{bottom:{to:0 }},0.7); 
		up.animate(); 
	},
	Listeners:{ 
		GoNextAuto:function(){ 
			clearTimeout(TGP.Home.Timer);
			var S = TGP.Home.Scroller;
			var N = TGP.Home.CurrentFeature; var NextNum;
			var nextleft; 
			if(N==7){
				nextleft= ((0*800)+735) * -1;
				NextNum = 1; 
			} else { 
				nextleft= ((N*800)+735) * -1;
				NextNum = parseInt(N)+1; 
			}
			var down = new YAHOO.util.Anim('FeatureText_'+N,{bottom:{to:-70 }},0.7); 
			var move = new YAHOO.util.Anim('FeatureScroller',{left:{to:nextleft }},1.5); 

			down.onComplete.subscribe(function(){ move.animate(); } ); 			
			move.onComplete.subscribe(function(){ TGP.Home.GoPane(); }); 
			down.animate(); 
			TGP.Home.CurrentFeature = NextNum; 
			Dom.removeClass($('FeatureThumb_'+N),'selected');
			Dom.addClass($('FeatureThumb_'+NextNum),'selected');
			TGP.Home.Timer = setTimeout(TGP.Home.Listeners.GoNextAuto,TGP.Home.Timeout); 
			
		},
		JumpToFeature:function(){ 
			clearTimeout(TGP.Home.Timer);
			var N = TGP.Home.CurrentFeature; 
			var goto = this.id.split('_')[1]; 
			var nextleft= (((goto-1)*800)+735) * -1;
			var down = new YAHOO.util.Anim('FeatureText_'+N,{bottom:{to:-70 }},0.7); 
			var move = new YAHOO.util.Anim('FeatureScroller',{left:{to:nextleft }},1.5); 
			down.animate(); 
			move.animate(); 
			move.onComplete.subscribe(function(){ TGP.Home.GoPane(); }); 
			down.animate(); 
			TGP.Home.CurrentFeature = goto; 
			Dom.removeClass($('FeatureThumb_'+N),'selected');
			Dom.addClass($('FeatureThumb_'+goto),'selected');
			TGP.Home.Timer = setTimeout(TGP.Home.Listeners.GoNextAuto,20000);
		},
		ShowThumbPreview:function(){ 
			
			var id = parseInt(this.id.split("_")[1])-1;
			var copy = TGP.Home.ThumbPreviewTexts[id]; 
			$('ThumbnailPopUpCopy').innerHTML = copy; 
			if(id<4){ 
				Dom.removeClass($('PopUpArrow'),'top-right'); 
				Dom.addClass($('PopUpArrow'),'top-left'); 
			} else { 
				Dom.removeClass($('PopUpArrow'),'top-left'); 
				Dom.addClass($('PopUpArrow'),'top-right'); 
			} 
			switch(id){ 
				case 0:
					$('InfoTable').style.left = '30px';
					$('InfoTable').style.right = '';
					break;  
				case 1:
					$('InfoTable').style.left = '145px';
					$('InfoTable').style.right = '';
					break;  
				case 2:
					$('InfoTable').style.left = '255px';
					$('InfoTable').style.right = '';
					break;  
				case 3:
					$('InfoTable').style.left = '369px';
					$('InfoTable').style.right = '';
					break; 
				case 4:
					$('InfoTable').style.left = '';
					$('InfoTable').style.right = '255px';
					break; 
				case 5:
					$('InfoTable').style.left = '';
					$('InfoTable').style.right = '145px';
					break; 
				case 6:
					$('InfoTable').style.left = '';
					$('InfoTable').style.right = '30px';
					break; 
				
			}
			$('InfoTable').style.display='';
	 }
	}  
} 
TGP.Init.initThese.push("Home"); 
