$(document).ready(function(){
	$("li.viewMore a").each(function(){
		$(this).click(function(e){
			e.preventDefault();
			var which = $(this).attr("rel");
			$("#"+which).css("display","block");
			$(this).parent().remove();
		});
	})
	
	
	// Disclaimer for email addresses
	$("a[href^='email_disclaimer']").bind("click",function(){
		// Create the overlay and coverup
		var overlay = $("<div id='overlay' />")
		var coverup = $("<div id='coverup' />")
		// Insert overlay and coverup into DOM
		$("body").append(coverup).append(overlay);
		// Prep the links in overlay
		var addy = $(this).attr("href").substring($(this).attr("href").indexOf("=")+1);
		var links = $("<p class='links'>I Agree, e-mail <a href='mailto:"+addy+"'>"+addy+"</a><br /><span><a href='#'>Close this window</a></span></p>");
		// Populate the overlay
		$("#overlay").load("email_disclaimer.cfm #disclaimer p",function(){
			$("#overlay").append(links);
			// Position Overlay
			$.positionDiv("#overlay");
		});
		$("#overlay a[href^='mailto']").live("click",function(){
			$("#coverup, #overlay").remove();
			return true;
		});
		$("#overlay span a, #coverup").live("click",function(){
			$("#coverup, #overlay").remove();
			return false;
		});
		// Show overlay
		$("#coverup").css("opacity",0).show().animate({opacity: .3}, 300);
		$("#overlay").css("opacity",0).show().animate({opacity: 1}, 300);
		//$("#overlay").fadeIn(300);
		return false;
	});
	
	
	
	
	// News Section Videos
	$('#nbc5video2008').flash(
        { 
          src: 'TETC_player.swf',
          width: 320,
          height: 240,
          flashvars: 	{ 
		  					video:'videos/March2008.flv',
							skin: 'TetcSkinOverPlayStopSeekMuteVol.swf',
							skinBackgroundAlpha: 0.65,
							skinBackgroundColor: 0x543019,
							skinAutoHide: true,
							skinFadeTime: 200
		  				}
        },
        { version: 10 }
    );
	$('#nbc5video2010').flash(
        { 
          src: 'TETC_player.swf',
          width: 320,
          height: 240,
          flashvars: 	{ 
		  					video:'videos/March2010.flv',
							skin: 'TetcSkinOverPlayStopSeekMuteVol.swf',
							skinBackgroundAlpha: 0.65,
							skinBackgroundColor: 0x543019,
							skinAutoHide: true,
							skinFadeTime: 200
		  				}
        },
        { version: 10 }
    );
	
	
});






// Position element centered on the screen
//========================================
$.positionDiv = function(id){
	var l = ($(window).width()-$(id).width())/2;
	var t = ($(window).height()-$(id).height())/2;
	$(id).css("left",l);
	$(id).css("top",t);	
	
	//If the User resizes the window, adjust the #container height
	$(window).bind("resize", function(){
		updatePosition(id)
	});
	
}
function updatePosition(id,w) {
	var l = ($(window).width()-$(id).width())/2;
	var t = ($(window).height()-$(id).height())/2;
	if(w!=1){
		$(id).css("left",l);
		$(id).css("top",t);	
	} else {
		$(id).css("left",l);
	}
}