
 $(document).ready(function() {
 
   $('.WomenTabHeader').click(function() {
	//set all Tabs to no show
			$('.WomenTabHeader').removeClass('TabOn');
	
	//Flip the clicked tab background	
			$('#'+this.id).addClass('TabOn');

	//set all innerTab to no show
			//HideOnLoad
			$('.innerTab').removeClass('ShowNow');
			$('.innerTab').addClass('HideOnLoad');

	//set the clicked class to contain
			var ContentID = this.id + '_content'; 		
			$('#'+ContentID).removeClass('HideOnLoad');
			$('#'+ContentID).addClass('ShowNow');
			
	});
	
	$('.DecadeTabHeader').click(function() {
	//set all Tabs to no show
			$('.DecadeTabHeader').removeClass('selectedDecade');
	//Flip the clicked tab background	
			$('#'+this.id).addClass('selectedDecade');
			
	//set all AdsContainer to no show
			$('.AdsContainer').removeClass('Ads_Selected');
			$('.AdsContainer').addClass('HideOnLoad');

		//set the clicked class to contain
			var ContentID = this.id + '_content'; 		
			$('#'+ContentID).removeClass('HideOnLoad');
			$('#'+ContentID).addClass('Ads_Selected');
	});
	
	$('#SlicePineappleContainer > div:gt(0)').hide();
	
   $('.ArrowRight').click(function() {
		//slide the container 641px to the right
		
		var index = $('#SlicePineappleContainer > div ').index($(this).parent().parent());
		var next = index + 1;
		if(index===4){
			next=0;
		}
		//place the next one so it can slide later. 
		$('#SlicePineappleContainer > div:eq('+(next)+')').css({left:'641px'}).show();
		$('#SlicePineappleContainer > div:eq('+(index)+'), #SlicePineappleContainer > div:eq('+(next)+')').animate({left:'-=641px'});
		
	});
   
     $('.ArrowLeft').click(function() {
		var index = $('#SlicePineappleContainer > div ').index($(this).parent().parent());
		var next = index - 1;
		if(index===0){
			next=4;
		}
		//place the next one so it can slide later. 
		$('#SlicePineappleContainer > div:eq('+(next)+')').css({left:'-641px'}).show();
		$('#SlicePineappleContainer > div:eq('+(index)+'), #SlicePineappleContainer > div:eq('+(next)+')').animate({left:'+=641px'});
		
		
   });
   
   	runAccordion(1, 100);
   
 });
 
//Accordion on the Mens page
 
//var ContentHeight = 200;
var TimeToSlide = 250.0;

var openAccordion = '';

function runAccordion(index, ContentHeight)
{

  var nID = "Accordion" + index + "Content";
  if(openAccordion == nID)
    nID = '';
   
  setTimeout("animate(" + new Date().getTime() + "," + TimeToSlide + ",'"
      + openAccordion + "','" + nID + "','" + ContentHeight + "')", 33);
 
  openAccordion = nID;
}

function animate(lastTick, timeLeft, closingId, openingId, ContentHeight)
{  
	
  var curTick = new Date().getTime();
  var elapsedTicks = curTick - lastTick;
 
  var opening = (openingId == '') ? null : document.getElementById(openingId);
  var closing = (closingId == '') ? null : document.getElementById(closingId);
 
  if(timeLeft <= elapsedTicks)
  {
    if(opening != null)
      opening.style.height = ContentHeight + 'px';
   
    if(closing != null)
    {
      closing.style.display = 'none';
      closing.style.height = '0px';
    }
    return;
  }
 
  timeLeft -= elapsedTicks;
  var newClosedHeight = Math.round((timeLeft/TimeToSlide) * ContentHeight);

  if(opening != null)
  {
    if(opening.style.display != 'block')
      opening.style.display = 'block';
    opening.style.height = (ContentHeight - newClosedHeight) + 'px';
  }
 
  if(closing != null)
    closing.style.height = newClosedHeight + 'px';

  setTimeout("animate(" + curTick + "," + timeLeft + ",'"
      + closingId + "','" + openingId + "','" + ContentHeight + "')", 33);
}
