$(document).ready(function() {

	$("ul#home-bottom-tabs li a").bind('click', function() {

		id = $(this).attr("id");
		hypen = id.indexOf('-');
		tc_tab = "tc-" + id.substring(hypen+1,id.length);
		a_tab = id.substring(hypen+1,id.length);

		$("div.tab-content").hide();
		$("a.current-tab").removeClass("current-tab");
		$("div#" + tc_tab).fadeIn();
		$("a#tab-" + a_tab).addClass("current-tab");

		return false;

	});
		
	$("select#number-children").change(function() {

		switch ($(this).val()) {

			case '1':
				$('p#child-quote-amount').show();
				$('p#child-quote-amount').html("&pound;9.99");
				$('p#child-quote-supp').css({
					'margin-left' : '30px'
				});
				$('p#child-quote-supp').html("per month for a single child");
				break;

			case '2':
				$('p#child-quote-amount').show();
				$('p#child-quote-amount').html("&pound;19.98");
				$('p#child-quote-supp').css({
					'margin-left' : '30px'
				});
				$('p#child-quote-supp').html("per month for two children");
				break;

			case '3':
				$('p#child-quote-amount').show();
				$('p#child-quote-amount').html("&pound;29.97");
				$('p#child-quote-supp').css({
					'margin-left' : '30px'
				});
				$('p#child-quote-supp').html("per month for three children");
				break;

			case '4':
				$('p#child-quote-amount').show();
				$('p#child-quote-amount').html("&pound;39.96");
				$('p#child-quote-supp').css({
					'margin-left' : '30px'
				});
				$('p#child-quote-supp').html("per month for four children");
				break;

			case '5':
				$('p#child-quote-amount').show();
				$('p#child-quote-amount').html("&pound;49.95");
				$('p#child-quote-supp').css({
					'margin-left' : '30px'
				});
				$('p#child-quote-supp').html("per month for five children");
				break;

			case '6':
				$('p#child-quote-amount').hide();
				$('p#child-quote-amount').html("");
				$('p#child-quote-supp').css({
					'margin-left' : '10px'
				});
				$('p#child-quote-supp').html("To receive a quote for more than five children please call us.");
				break;

			default:

		}

		return false;

	});
	
	$('.home-slider div:first').addClass('active');
	
	function slideShow() {
		
		var current = $('.home-slider div.active');
		var next = current.next().length ? current.next('div.slide') : $('.home-slider div.slide:first');
		
		current.hide().removeClass('active');
		next.fadeIn(500).addClass('active');
		
		
	}
	
	$(function(){
		return setInterval(slideShow, 4500);
	});

	$('.home-slider li').bind('click', function() {
		
		$('.home-slider div').hide();
		$('.home-slider div').eq($(this).index()).show();

		return false;
	});

	
});

