$(document).ready(function() {	
 
	//Show Banner
	var $links = $("#tab_container a")
	fillTemplate($links.first());	
	$links.first().parent().addClass('active'); 
	
	/*$links.click(function(){ 
		
		if ($(this).parent().is(".active")) {  //If it's already active, then...
			return false; // Don't click through
		} else {
			//Animate the Teaser				
			fillTemplate($(this))
		}
		
		$links.parent().removeClass('active'); //Remove class of 'active' on all lists
		$(this).parent().addClass('active');  //add class of 'active' on this list only
		return false;
		
	});*/
	
	$("ul.altRows li").hover(function(){
		$(this).addClass('hover');
		}, function() {
		$(this).removeClass('hover');
	});
	
});

function fillTemplate($obj)
{
	var ytid = $obj.attr("ytid");
	var eid = $obj.attr("eid");
	var sid = $obj.attr("sid");
	var template = '';
	
	template = $("#ytTemplate").html();
	
	if( template )
	{
		template = template.replace(/--ID--/gi, ytid);	
	}
	
	$("#exampleTrailersContainer").html(template);
	$("#exampleTrailersButton").attr("href", "/detail/" + eid + "/trailer");
	$("#exampleTrailers h2").html( $obj.attr('title') );
	
	Cufon.replace("#exampleTrailers h2");
	/*$("#btnReserve").attr("href", "/detail/" + eid + "/trailer");*/
}
