var autoRotation = 4;

function grgslideone() {

	$('div#grg-three').fadeOut('slow');
	$('div#grg-one').fadeIn('slow');

	setTimeout("grgslidetwo()", autoRotation * 1000);

}

function grgslidetwo() {

	$('div#grg-one').fadeOut('slow');
	$('div#grg-two').fadeIn('slow');

	setTimeout("grgslidethree()", autoRotation * 1000);

}

function grgslidethree() {

	$('div#grg-two').fadeOut('slow');
	$('div#grg-three').fadeIn('slow');

	setTimeout("grgslideone()", autoRotation * 1000);

}

$(document).ready(function() {

	$("div.home-banner").css("background-image","none");

	$("div.home-banner-i").show();
	$("div#grg-home-banner").show();

	$("ul#home-bottom-tabs li a").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);

   	// alert("[" + tab + "]");

		$("div.tab-content").hide();

		$("a.current-tab").removeClass("current-tab");

		$("div#" + tc_tab).fadeIn();

		$("a#tab-" + a_tab).addClass("current-tab");

   	return false;

   },function(){
   });

	$("div.home-banner-i ul a").click(function() {

		// Form the id of the new banner to show.
		id = $(this).attr("id");
		hypen = id.indexOf('-');
		banner = id.substring(hypen+1,id.length);

		// Create an id for the old banner.
		currentBanner = $("div.home-banner-i").attr("id");
		hypen = currentBanner.indexOf('-');
		currentBanner = currentBanner.substring(hypen+1,currentBanner.length);

		$("div.home-banner-i").hide();
		$("div.home-banner-i").attr("id","b-" + banner);
		$("div.home-banner-i").show();

   	return false;

   },function(){
   });

	$("select#number-children").change(function() {

		switch ($(this).val()) {

				case '1':
					$('p#child-quote-amount').show();
					$('p#child-quote-amount').html("&pound;13.50");
 					$('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;26.00");
 					$('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;32.50");
 					$('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.00");
 					$('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;45.50");
 					$('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;

   },function(){
   });

	setTimeout("grgslidetwo()", autoRotation * 1000);

});



