var browserName = navigator.appName;

$('#video1').click(function(){
	playMyVideoInFlash('video-js-replace1');
	stopMyVideoInFlash('video-js-replace2');
	$('#video-js-replace1').attr('height',284);
	$('.video-preview #title-background').css('display','');
	if (browserName == "Microsoft Internet Explorer") {
		$('#video-js-replace2').attr('height','1');
	} else {
		$('#video-js-replace2').attr('height','0');
	}
	$('.video-preview #thumb').css('display','none');
	$('.video-preview #play').fadeOut(500);
	$('.video-preview #control-cover').fadeOut(500);
	if ($('.video-preview #title-1').position().left == 110) {
		$('.video-preview #title-1').animate({left:'37px'},500);
	} else {
		$('.video-preview #title-2').fadeOut(500,function(){
			$('.video-preview #title-1').fadeIn(500);
		});
	}
	$('.video-player .wrapper').css('z-index','0');
	$('.video-player .wrapper1').css('z-index','1');
	playMyVideoInFlash('video-js-replace1');
});
/* THIS WAS NEEDED FOR WHEN THE SECOND VIDEO ON THE INTERNAL PAGES HAS A TITLE ON THE BOTTOM; not the case for the user video
$('#video2').click(function(){
	stopMyVideoInFlash('video-js-replace1');
	$('#video-js-replace2').attr('height',284);
	if (browserName == "Microsoft Internet Explorer") {
		$('#video-js-replace1').attr('height','1');
	} else {
		$('#video-js-replace1').attr('height','0');
	}
	$('.video-preview #thumb').css('display','none');
	$('.video-preview #play').fadeOut(500);
	$('.video-preview #control-cover').fadeOut(500);
	$('.video-preview #title-1').fadeOut(500,function(){
		$('.video-preview #title-2').fadeIn(500);
		$('.video-preview #title-1').css('left','37px');
	});
	$('.video-player .wrapper').css('z-index','0');
	$('.video-player .wrapper2').css('z-index','1');
	playMyVideoInFlash('video-js-replace2');
});
*/
$('#video2').click(function(){
	stopMyVideoInFlash('video-js-replace1');
	$('#video-js-replace2').attr('height',284);
	if (browserName == "Microsoft Internet Explorer") {
		$('#video-js-replace1').attr('height','1');
	} else {
		$('#video-js-replace1').attr('height','0');
	}
	$('.video-preview #thumb').css('display','none');
	$('.video-preview #play').css('display','none');
	$('.video-preview #title-background').css('display','none');
	$('.video-preview #control-cover').css('display','none');
	$('.video-preview #title-1').css('display','none');
	$('.video-player .wrapper').css('z-index','0');
	$('.video-player .wrapper2').css('z-index','1');
	$('.video-preview #title-1').css('left','37px');
	playMyVideoInFlash('video-js-replace2');
});
$('.play-btn').click(function(){
	if ($('.video-preview #title-1').position().left == 110) {
		stopMyVideoInFlash('video-js-replace2');
		$('#video-js-replace1').attr('height',284);
		if (browserName == "Microsoft Internet Explorer") {
			$('#video-js-replace2').attr('height','1');
		} else {
			$('#video-js-replace2').attr('height','0');
		}
		$('.video-preview #thumb').css('display','none');
		$('.video-preview #play').fadeOut(500);
		$('.video-preview #control-cover').fadeOut(500);
		if ($('.video-preview #title-1').position().left == 110) {
			$('.video-preview #title-1').animate({left:'37px'},500);
		} else {
			$('.video-preview #title-2').fadeOut(500,function(){
				$('.video-preview #title-1').fadeIn(500);
			});
		}
		$('.video-player .wrapper').css('z-index','0');
		$('.video-player .wrapper1').css('z-index','1');
		playMyVideoInFlash('video-js-replace1');
	}
});

//User Video Page
$('#user-videos #preview').click(function(){
	$(this).fadeOut(500, function(){
		$('.shroud').css('display','none')
		playMyVideoInFlash('video-js-replace1');
	})
})
