top.document.title					= "Dirty Dancing America - Official Site - Cast and Creative";
$(document).ready(function() {
	$('#btn_cast').addClass('active');
	baseY	= $("#banner_cast").height() + $("#content_top").height() + $("#content_bottom").height() + $("#ticker").height() + $("#footer").height() + 100;
	castY	= baseY + $("#cast").height();
	creativeY	= baseY	+ $("#creative").height();
	partnersY	= baseY	+ $("#partnersSection").height() + 40;
	$("#iframe", top.document).css({ height: castY });
	$('#content').css({ height: $('#cast').height() });
	$('#cast ul li:last, #creative ul li:last').css({ border: 'none' });
	
	//Subnav Slide
	$('#btn_cast a').click(function(event) { 
		$('#slider').animate({ left: 0 }, 500); 
		$('#content').animate({ height: $('#cast').height() }, 500); 
		$("#iframe", top.document).animate({ height: castY }, 500);
		$('#btn_cast').addClass('active'); 
		$('#btn_creative').removeClass('active'); 
		$('#btn_partners').removeClass('active');
		event.preventDefault();
	});
	$('#btn_creative a').click(function(event) { 
		$('#slider').animate({ left: -834 }, 500); 
		$('#content').animate({ height: $('#creative').height() }, 500); 
		$("#iframe", top.document).animate({ height: creativeY }, 500);
		$('#btn_creative').addClass('active'); 
		$('#btn_cast').removeClass('active'); 
		$('#btn_partners').removeClass('active'); 
		event.preventDefault();
	});
	
	// This is what actually controls the tabs; the other bindings you had at the bottom
	// were actually for the cast and creative sections, for opening/closing their bios.
	// Since there was dead space after the Arthur Murray callout and it was showing
	// the bottom border, I took 20px off of the height so that it didn't look retarded.
	// This will probably still be fine if you need to add more stuff.
	$('#btn_partners a').click(function(event) { 
		$('#slider').animate({ left: -1668 }, 500); 
		$('#content').animate({ height: $('#partnersSection').height() - 20 }, 500); 
		$("#iframe", top.document).animate({ height: partnersY }, 500);
		$('#btn_partners').addClass('active'); 
		$('#btn_creative').removeClass('active'); 
		$('#btn_cast').removeClass('active'); 
		event.preventDefault();
	});

	$("#cast ul li .open").click(function(e) {
		oH	= $(this).siblings("div.lefty").height();
		iH	= $(this).siblings("div.lefty").children(".desc").height() + $(this).siblings(".lefty").children("h2").height();
		$(this).siblings("div.lefty").animate({ height: iH }, 300);
		$("#content").animate({ height: "+=" + (iH - oH) });
		$("#iframe", top.document).animate({ height: "+=" + (iH - oH) });
		$(this).addClass("hideme");
		$(this).next().removeClass("hideme");
		e.stopPropagation();
		return false;
	});

	$("#cast ul li .close").click(function(e) {
		oH	= $(this).siblings("div.lefty").height();
		iH	= $(this).siblings("div.lefty").children(".desc").height();
		$(this).siblings("div.lefty").animate({ height: 155 }, 300);
		$("#content").animate({ height: "-=" + (iH - 155) });
		$("#iframe", top.document).animate({ height: "-=" + (iH - 155) });
		$(this).addClass("hideme");
		$(this).prev().removeClass("hideme");
		e.stopPropagation();
		return false;
	});

	$("#creative ul li .open").click(function(e) {
		oH	= $(this).siblings("div.lefty").height();
		iH	= $(this).siblings("div.lefty").children(".zoom").height();
		$(this).siblings("div.lefty").animate({ height: iH+30 }, 300);
		$("#content").animate({ height: "+=" + (iH - oH) });
		$("#iframe", top.document).animate({ height: "+=" + (iH) });
		$(this).addClass("hideme");
		$(this).next().removeClass("hideme");
		e.stopPropagation();
		return false;
	});

	$("#creative ul li .close").click(function(e) {
		oH	= $(this).siblings("div.lefty").height();
		iH	= $(this).siblings("div.lefty").children(".zoom").height();
		$(this).siblings("div.lefty").animate({ height: 155 }, 300);
		$("#content").animate({ height: "-=" + (iH - 155) });
		$("#iframe", top.document).animate({ height: "-=" + (iH) });
		$(this).addClass("hideme");
		$(this).prev().removeClass("hideme");
		e.stopPropagation();
		return false;
	});
});