$(function(){
	animate_whats_new();
	$('#whats_new_prev').click(function(){
		switch_whats_new_prev();
		animate_whats_new();
	})
	$('#whats_new_next').click(function(){
		switch_whats_new_next();
		animate_whats_new();
	})
	
	
	$('.people-saying').each(function(){
		$('.tabs A',this).click(function(){
			$('.people-saying .list-info').hide();
			$('#'+$(this).attr('id')+'-info').slideDown('slow');
			$('.people-saying .tabs A').removeClass('active');
			$(this).addClass('active');
		});
		$('.tabs A.active',this).click();
	});
	
	hide_partner_grid();
	$('.partner').each(function(){
		$('.grid-tbase A',this).click(function(){
			$('.partner .more-info').hide();
			$('#'+$(this).attr('id')+'-info').slideDown('slow');
			$('.partner .grid-tbase A').removeClass('active');
			$(this).addClass('active');
			//$('.partner .more-info').localScroll();
		});
		$('.grid-tbase A.active',this).click();

	});
	
	
	$('.reasons-axcient').each(function(){
		$('LI',this).click(function(){
			$('.reasons-axcient .active div').animate({width:'0px'},'fast',function(){$(this).hide()});
			$('.reasons-axcient .active A').animate({width:'56px'},'fast');
			$('.reasons-axcient .active').removeClass('active');			
			$('div',this).animate({width:'190px'},'slow');
			$('A',this).animate({width:'0px'},'slow');
			$(this).addClass('active');
		});
		//$('LI A',this).hover(function(){$(this).parent().click()},function(){});
		$('LI.active',this).click();
	});
	
	window.setTimeout("switch_auto()",5000);
	
});

function switch_auto(){
	if($('.reasons-axcient .active').next().size()==0){
		$('.reasons-axcient LI:first').click();
	}
	else{
		$('.reasons-axcient .active').next().click();
	}
	window.setTimeout("switch_auto()",12000);
}


function switch_whats_new_next(){
	$('.whats-new-items .active').removeClass('active').next().addClass('active');
	if($('.whats-new-items .active').size()==0){
		$('.whats-new-items LI:first').addClass('active');
	}
}

function switch_whats_new_prev(){
	$('.whats-new-items .active').removeClass('active').prev().addClass('active');
	if($('.whats-new-items .active').size()==0){
		$('.whats-new-items LI:last').addClass('active');
	}
}

function animate_whats_new(){
	$('.whats-new-items .active').each(function(){
		$('.whats-new div div p span').css('top','20px').html($(this).html()).animate({top:'2px'},'slow');
	});
}


function hide_partner_grid() {
	$('.partner .more-info').hide();
}
