$(function() {
	// Set DOM elements
	update_area = $('#video');
	video_list_item = $('#mycarousel li');
	video_thumb = $('#mycarousel li a');
	audio_thumb = $('#leftCol li a');
	
	// Video thumbnail opacity rollovers
	video_thumb.live('mouseover', rollOn);
	video_thumb.live('mouseout', rollOff);
	video_thumb.live('click', loadVideo);
	audio_thumb.live('mouseover', rollOn);
	audio_thumb.live('mouseout', rollOff);
	audio_thumb.live('click', loadAudio);
	video_reload_max = 5;
	video_reload = 0;
	setintid = null;
	/*$('.video_fail').livequery(function() {
		if (video_reload < video_reload_max) {
			showLoader(update_area);
			video_reload++;
			setintid = setInterval("loadVideo()", 1000);
		} else {
			update_area.html('<br /><br /><h2>Sorry, the videos are not currently available. Please refresh the page, or try again later.</h2>');
		}
	});*/
	loadVideos();
	$('#mycarousel li a span').livequery(function() {
		if($(this).closest('li').hasClass('on')) {
			$(this).css({opacity:0});
		} else {
			$(this).css({opacity:0.7});
		}
	});
	active_video_id = $('li.on a').attr('href');
	notes_divs = $('#notesWrap div');
	notes_divs.livequery(function() {
		if($(this).attr('id') == active_video_id) {
			$(this).fadeIn(2000);
		}
	});
	
	$('#audioNotes').hide().fadeIn(1000);
	
	// Carosel
	$('a#mycarousel-prev').live('click', function() { 
		return false;
	});
	$('a#mycarousel-next').live('click', function() {
		return false;
	});
	$('#mycarousel').livequery(initCarousel);
	
	$('#content').find('ul:first').find('li:first').addClass('on');
	
	$('.field input').css('width', '520px');
	$('.field textarea').css('width', '513px');
		$('#security').css('width', '50px');
});