$(document).ready(function() {
	$(".video_screen li a").click(function() {
		var title = $(this).attr("href");
		$.ajax({
		  type:'GET',
		  url: $(this).attr('href'),
		  success:function(data) {
				$.openWindow(630, 522, title, data);
				video_player(video, image);
				navigation();
		  }
		});
		return false;
	});
});

function video_player(file, image, autoplay){
	embed_video_player($("#video_show").html(""), 425, 319, file, image, true);
	high_low();
}

function navigation(){
	$(".thickbox").click(function() {
		var title = $(this).attr("href");
		$.ajax({
		  type:'GET',
		  url: $(this).attr('href'),
		  success:function(data) {
				$("#TB_ajaxContent").html(data);
				video_player(video, image);
				navigation();
		  }
		});
		return false;
	});
}

function high_low() {
	$(".video").click(function() {
		var type = $(this).attr("href").replace("#", "");
		
		// remove class
		$(".video").removeClass("selected");
		
		// add class to seleted
		$("#" + type).addClass("selected");
		
		video = video.replace(/(high|low)/, type);
		video_player(video, image, true);
		return false;
	});
}
