$(document).ready(function(){
	
	if (ie && !ie6plus) return;
	
	// - - - - - - - - - - - - - - - - - - - - - - -
	
	video_marquee();
	video_scroll();
	
	// - - - - - - - - - - - - - - - - - - - - - - -
	// video play 
	
	$("a.stop").hide();
	
	$(".play").click(function () { play_video($(this).attr('rel')); return false; });
	$(".stop").click(function () { stop_video(); return false; });
	
	// - - - - - - - - - - - - - - - - - - - - - - -
	
	marquee.trigger('stop'); 
	video_bookmark();
	
	marquee.mouseover(function () {
		if (!marquee_clicked && !video_playing) $(this).trigger('start');
	});
	
	marquee.mouseout(function () {
		$(this).trigger('stop');
	});
	
	$('#marquee').mouseenter( function () {
		$('#marquee .cover').fadeOut("fast");
	});
	
	$('#marquee').mouseleave( function () {
		$('#marquee .cover').fadeIn("fast");
	});
	
});

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function video_bookmark() {

	var bookmark = get_bookmark();
	var wait     = 1000;
	
	if (bookmark) {
		
		if (bookmark) {
			if (bookmark == 'play') {
				setTimeout(function(wait) { $('a.play').trigger('click') }, wait);
			} else if (!isNaN(bookmark)) { 
				setTimeout(function(wait) { $('a.scroll-'+bookmark).trigger('click') }, wait);
			}
			
			window.location.hash = bookmark;
		}
	}
}