showTest = function () {
	$("#btn_ba").unbind("click");$("#btn_prods").unbind("click");$("#btn_test").css('cursor','auto');
	$("#content_ba").css('display','none').hide(10, function(){
		$("#content_prods").css('display','none').hide(10, function(){
			$("#content_test").css('display','block').fadeIn(600, function(){
				trackUrl = trackPath + pageName + "/Testimonials";
				pageTracker._trackPageview(trackUrl);
				$("#btn_ba").click(showBA).css('cursor','pointer');
				$("#btn_prods").click(showProds).css('cursor','pointer');
			});
		});
	});
	$("#bat_buttons > div > span").css('color','#888888');$("#bat_buttons > div > img").css('border-color','#888888');$("#bat_buttons > div").addClass('bat_btn_inac');$("#btn_test").removeClass('bat_btn_inac');
	$("#btn_test > span").css('color','#cb2322');$("#btn_test > img").css('border-color','#cb2322');
	$('.testimoVideo h1 > img').css('display','block').attr('src','images/results/bat/hdr_intensiveTestimo.gif').attr('alt','testimonials').attr('width','305').attr('height','14');
	$('.testimo h1 > img').css('display','block').attr('src','images/results/bat/hdr_testimonials.gif').attr('alt','testimonials').attr('width','88').attr('height','18');
	$('.textbat').replaceWith('<span class="hiddentext textbat">Testimonials</span>');
	$('.textVid').replaceWith('<span class="hiddentext textVid">Intensive Wrinkle Protocol: Testimonials</span>');
}
showBA = function () {
	$("#btn_test").unbind("click");$("#btn_prods").unbind("click");$("#btn_ba").css('cursor','auto');
	$("#content_test").hide(10, function(){
		$("#content_prods").hide(10, function(){
			$("#content_ba").fadeIn(600, function(){
				trackUrl = trackPath + pageName + "/BeforeAfter";
				pageTracker._trackPageview(trackUrl);
				$("#btn_test").click(showTest).css('cursor','pointer');
				$("#btn_prods").click(showProds).css('cursor','pointer');
			});
		});
	});
	$("#bat_buttons > div > span").css('color','#888888');$("#bat_buttons > div > img").css('border-color','#888888');$("#bat_buttons > div").addClass('bat_btn_inac');$("#btn_ba").removeClass('bat_btn_inac');
	$("#btn_ba > span").css('color','#cb2322');$("#btn_ba > img").css('border-color','#cb2322');
	$('.testimoVideo h1 > img').css('display','block').attr('src','images/results/bat/hdr_intensiveBefore.gif').attr('alt','testimonials').attr('width','376').attr('height','14');
	$('.testimo h1 > img').css('display','block').attr('src','images/results/bat/hdr_before_after.gif').attr('alt','before & after').attr('width','105').attr('height','18');
	$('.textbat').replaceWith('<span class="hiddentext textbat">before &amp; after</span>');
	$('.textVid').replaceWith('<span class="hiddentext textVid">Intensive Wrinkle Protocol: Before &amp; After Results</span>');
}
showProds = function () {
	$("#btn_ba").unbind("click");$("#btn_test").unbind("click");$("#btn_prods").css('cursor','auto');
	$('#content_test').hide(10, function(){
		$("#content_ba").hide(10, function(){
			$("#content_prods").hide().fadeIn(600, function(){
				trackUrl = trackPath + pageName + "/Products";
				pageTracker._trackPageview(trackUrl);
				$("#btn_test").click(showTest).css('cursor','pointer');
				$("#btn_ba").click(showBA).css('cursor','pointer');
			});
		});
	});
	$('#bat_buttons > div > span').css('color','#888888');$("#bat_buttons > div > img").css('border-color','#888888');$("#bat_buttons > div").addClass('bat_btn_inac');$("#btn_prods").removeClass('bat_btn_inac');
	$('#btn_prods > span').css('color','#cb2322');$("#btn_prods > img").css('border-color','#cb2322');
	$('.testimoVideo h1 > img').css('display','block').attr('src','images/results/bat/hdr_intensiveProd.gif').attr('alt','testimonials').attr('width','273').attr('height','14');
	$('.testimo h1 > img').css('display','block').attr('src','images/results/bat/hdr_products.gif').attr('alt','products').attr('width','64').attr('height','18');
	$('.textbat').replaceWith('<span class="hiddentext textbat">products</span>');
	$('.textVid').replaceWith('<span class="hiddentext textVid">Intensive Wrinkle Protocol: Products</span>');
}

function handleStateChange( subject, showResults ) {
	if(subject == 1){
		$(".ba_description").html('The Wrinkle Image Analysis revealed improvement in appearance of crow&rsquo;s feet and wrinkles under the eyes of subject 1. Her results represent the average. Many responders performed even better.');
		$(".eyeArea").html('16%');
		//$(".cheekArea").html('45%');
		trackUrl = trackPath + pageName + "/Subject1";
	}
	if(subject == 2){
		$(".ba_description").html('Subject 2 performed in the top percentile of all respondents. Her skin is noticeably more hydrated and the appearance of crow&rsquo;s feet and wrinkles is significantly reduced.');
		$(".eyeArea").html('52%');
		//$(".cheekArea").html('29%');
		trackUrl = trackPath + pageName + "/Subject2";
	}
	if(subject == 3){
		$(".ba_description").html('The Facial Appearance Benefits Study once again revealed anti-aging results, most noticeably under the eyes. This is an average response. Many responders performed even better.');
		$(".eyeArea").html('14%');
		//$(".cheekArea").html('55%');
		trackUrl = trackPath + pageName + "/Subject3";
	}
	if(subject == 4){
		$(".ba_description").html('The 3-product wrinkle reduction protocol diminished deep wrinkles under subject 4’s eyes. She performed in the top percentile of all respondents.');
		$(".eyeArea").html('65%');
		//$(".cheekArea").html('16%');
		trackUrl = trackPath + pageName + "/Subject4";
	}
	if(showResults == true){
		trackUrl = trackPath + pageName + "/ShowResults";
	}
	if(showResults == false){
		trackUrl = trackPath + pageName + "/HideResults";
	}
	
}

batInit = function(){
	var tab = jQuery.url.param("tab");
	if(tab != undefined) {
		if(tab == 1) {
			showTest();
		} else if(tab == 2) {
			showBA();
		} else if(tab == 3) {
			showProds();
		} else {
			showTest();
		}
	} else {
		showTest();
	}
}
$(document).ready(function () {
	$("#bat_buttons > div").hover( function () {
			if($(this).hasClass('bat_btn_inac')){
				var imgPath = $(this).find("img").attr("src");
				imgPath = imgPath.replace(/off/g, "on");
				$(this).find("img").attr("src", imgPath);
				$(this).find("img").css('border-color','#cb2322');$(this).find("span").css('color','#cb2322');
			}
		},
		function () {
			var imgPath = $(this).find("img").attr("src");
			imgPath = imgPath.replace(/on/g, "off");
			$(this).find("img").attr("src", imgPath);
			if($(this).hasClass('bat_btn_inac')){
				$(this).find("img").css('border-color','#888888');$(this).find("span").css('color','#888888');
			}
		}
	)
});

$(batInit);
