// JavaScript Document
$(document).ready(
	function(){
		
		leftScroll = 0;
		teamLength = $('.team_member').length;
		
		$('.next_butt').each(function(i){
			$(this).click(function(){
				leftScroll = $('#my_team_hldr').scrollLeft();
				maxVal = teamLength*760-760;
				if (leftScroll < maxVal) {
					leftScroll = leftScroll + 760;
					$('#main h1').fadeOut('fast',function(){
						$(this).html(member[i+1]).fadeIn('fast');
					});
					$('#my_team_hldr').animate({scrollLeft: leftScroll},'slow');
				}
			});
		});
		
		$('.prev_butt').each(function(i){
			$(this).click(function(){
				leftScroll = $('#my_team_hldr').scrollLeft();
				maxVal = teamLength*760-760;
				if (leftScroll <= maxVal) {
					leftScroll = leftScroll - 760;
					$('#main h1').fadeOut('fast',function(){
						$(this).html(member[i]).fadeIn('fast');
					});
					$('#my_team_hldr').animate({scrollLeft: leftScroll},'slow');
				}
			});
		});
		
		$('.next_butt, .prev_butt').each(function(){
			$(this).hover(function(){
				imgSRC = $(this).find('img').attr('src').replace('.gif','_over.gif');	
				$(this).find('img').attr('src',imgSRC);
			},function(){
				imgSRC = $(this).find('img').attr('src').replace('_over.gif','.gif');
				$(this).find('img').attr('src',imgSRC);
			});										   
		});
		
		$('#my_team_thumbs ul li').each(function(j){
			$(this).click(function(){
				leftScroll = 760*(j+1);
				$('#main h1').fadeOut('fast',function(){
					$(this).html(' '+member[j]).fadeIn('fast');
				});
				$('#my_team_hldr').animate({scrollLeft: leftScroll},'slow');			
			});
		});
		
		$('#my_team_thumbs ul li').each(function(){
			$(this).hover(function(){
				imgSRC = $(this).find('img').attr('src').replace('.jpg','_over.jpg');
				$(this).find('img').attr('src',imgSRC);
			},function(){
				imgSRC = $(this).find('img').attr('src').replace('_over.jpg','.jpg');
				$(this).find('img').attr('src',imgSRC);
			});
		});
	
	}
);
