$(function(){
		//Check height and turn on back to top

		var contentHeight = $("#content").height();
		var position =  $("#content").position();
		var total = contentHeight + position.top;
		var browserHeight = $(window).height();
		if(total > browserHeight){
			$("a#back-to-top").css("display","block")
		}
		
		//E-News
		var eNewsToggle = false;
		$("ul.e-news li").click(function(){
			if(eNewsToggle == false){
				$(this).addClass("active");	
				eNewsToggle = true;
			}else{
				$(this).removeClass("active");
				eNewsToggle = false;
			}
			$("#e-news-signup").slideToggle();								 
		});
		   
		/*Zebra stripe table border */
		
		$("table.zebra tbody tr").find("td:last").each(function(){
			$(this).addClass("rb")
		})
		
		//Fix for IMAX-images and .msc-images positioning with straight CSS weird
		$(".IMAX-images").css("margin-top","0px");
		$(".msc-images").css("margin-top", "0px");
		
		/*sIFR */
		$('#content h1').sifr({
							  
			font: 'chaparral',
			path: '/fonts',
			embedOptions:{
				wmode:'transparent',
				width: 480
			},
			flashvars:{
				w: 480
			},
			save: true,
			after:function(){
				//newHeight - Gets the height of the embed tag, converts it to a number ads the desired bottom spacing and ads px turning it back to a string.
				newHeight = parseFloat($("#content h1 embed").attr("height"));
				//console.log($("#content h1 embed").height());
				//console.log(newHeight);
				if(newHeight > 40){
					$("#content h1.sIFR-replaced").css({"margin-bottom": "45px", "overflow":"visible"});
				}
			}
		});	
			
});

function activeMenu(i, i2, i3){
	i = i - 1;
	i2 = i2 - 1;
	i3 = i3 - 1;
	
	$("#sub-nav ul > li:eq("+i+")").addClass("active");
	if(i == 0){
		$("#sub-nav ul > li:eq("+i+")").addClass("first-active");
	}
	$("#sub-nav ul > li:eq("+i+") > ul > li:eq("+i2+")").addClass("active");
	$("#sub-nav ul > li:eq("+i+") > ul > li:eq("+i2+") > ul > li:eq("+i3+")").addClass("active");
}


