$(document).ready(function(){
	$('input[title!=""]').hint();	
	$("#ticker_holder").liScroll({travelocity: 0.03});

	$('.hero_wrapper > div').hide();
	$('.hero_wrapper > div:first').show();
	$('#hero_tabs > li:first > a').addClass('selected');

	$('#hide_show').click(function(e) {
			$('#add').toggleClass('selected');
			$('#add_info').toggle();
			e.preventDefault();
	});

	$('#hero_tabs > li > a').click(function(e){
		e.preventDefault(); 
		var index = $(e.currentTarget).parent('li').index() + 1;
		$(e.currentTarget).parents('ul').find('li > a.selected').removeClass('selected');
		$(e.currentTarget).addClass('selected');

		$('.hero_wrapper > div:visible').fadeOut('fast',function(){
			$('.hero_wrapper > div:nth-child('+index+') .hero_message').hide();
			$('.hero_wrapper > div:nth-child('+index+')').fadeIn('normal',function(){
				var heroMessage = $('.hero_wrapper > div:nth-child('+index+') > div.hero_message');
				heroMessage.show().css('bottom','-'+heroMessage.outerHeight()+'px').animate({'bottom':0});
			});
		})
	})

	$('#find_a_tyre_panel .tab_content > div').hide();
	$('#find_a_tyre_panel .tab_content > div:first').show();
	$('#find_a_tyre_panel .tabs > li:first > a').addClass('selected');

	$('#find_a_tyre_panel .tabs > li > a').click(function(e){
		e.preventDefault(); 
		var index = $(e.currentTarget).parent('li').index() + 1;
		$(e.currentTarget).parents('ul').find('li > a.selected').removeClass('selected');
		$(e.currentTarget).addClass('selected');
		$('#find_a_tyre_panel .tab_content > div:visible').hide();
		$('#find_a_tyre_panel .tab_content > div:nth-child('+index+')').show();
	})



    $('#get_a_price_panel .tab_content > div').hide();
    $('#get_a_price_panel .tab_content > div:first').show();
    $('#get_a_price_panel .tabs > li:first > a').addClass('selected');

    $('#get_a_price_panel .tabs > li > a').click(function (e) {
        e.preventDefault();
        var index = $(e.currentTarget).parent('li').index() + 1;
        $(e.currentTarget).parents('ul').find('li > a.selected').removeClass('selected');
        $(e.currentTarget).addClass('selected');
        $('#get_a_price_panel .tab_content > div:visible').hide();
        $('#get_a_price_panel .tab_content > div:nth-child(' + index + ')').show();
    })


	$('.tyre_filter .detailed_spec > a').click(function(e) {
			e.preventDefault();
			$(e.currentTarget).parents('div.tyre_filter').next().slideToggle('normal');
			$(e.currentTarget).toggleClass('on').toggleClass('off');
	})
});

