$(document).ready(function() {

	$('body').append('<div id="movie"></div>');
	$('#movie').hide();

	if($('.videoBanner').length > 0) {
		
		// show small movie in banner
		var sWidth = 570;
		var sHeight = 320;
		var sContainer = '#movieInBanner';
		$('.movieSmall').click(function() {
			if($('#movieInBanner').length == 0) {
				$('.videoBanner').append('<div id="movieInBanner"></div>');
			} else {
				$('#movieInBanner').fadeIn(2000);
			}
		});
	
	} else {
	
		// show small movie in popup
		var sWidth = 500;
		var sHeight = 281;
		var sContainer = '#movie';
		$('.movieSmall').showPage({
			show: '#movie',
			width: sWidth,
			height: sHeight
		});
	}
	
	// show large movie in popup
	var mWidth = 950;
	var mHeight = 534;
	$('.movieLarge').showPage({
		show: '#movie',
		width: mWidth,
		height: mHeight
	});
	
	
	$('a.movieSmall:not(.keep)').html('');
	$('a.movieLarge:not(.keep)').html('');
	$('.movieButton a').html('');
	
	if($('.videoBannerPlay').length > 0) {
		$('.videoBannerPlay a').html('').css('opacity','.5').hover(function() {
			$(this).css('opacity','1');
		},function() {
			$(this).css('opacity','.5');
		});
	}
	
	$('.nowhereMovieSmall').click(function() {
		$(sContainer).putMovie({
			container: sContainer,
			location: '/videos/whatIsNowhereSmall.flv',
			width: sWidth,
			height: sHeight
		});
		return false;
	});
	$('.nowhereMovieLarge').click(function() {
		$('#movie').putMovie({
			container: '#movie',
			location: '/videos/whatIsNowhereLarge.flv',
			width: mWidth,
			height: mHeight
		});
		return false;
	});
	
	$('.eqsMovieSmall').click(function() {
		$(sContainer).putMovie({
			container: sContainer,
			location: '/videos/eqsMovieSmall.flv',
			width: sWidth,
			height: sHeight
		});
		return false;
	});
	$('.eqsMovieLarge').click(function() {
		$('#movie').putMovie({
			container: '#movie',
			location: '/videos/eqsMovieLarge.flv',
			width: mWidth,
			height: mHeight
		});
		return false;
	});
	
	$('.eclMovieSmall').click(function() {
		$(sContainer).putMovie({
			container: sContainer,
			location: '/videos/eclMovieSmall.flv',
			width: sWidth,
			height: sHeight
		});
		return false;
	});
	$('.eclMovieLarge').click(function() {
		$('#movie').putMovie({
			container: '#movie',
			location: '/videos/eclMovieLarge.flv',
			width: mWidth,
			height: mHeight
		});
		return false;
	});
	
	$('.ccmMovieSmall').click(function() {
		$(sContainer).putMovie({
			container: sContainer,
			location: '/videos/ccmMovieSmall.flv',
			width: sWidth,
			height: sHeight
		});
		return false;
	});
	$('.ccmMovieLarge').click(function() {
		$('#movie').putMovie({
			container: '#movie',
			location: '/videos/ccmMovieLarge.flv',
			width: mWidth,
			height: mHeight
		});
		return false;
	});
	
	$('.storeMovieSmall').click(function() {
		$(sContainer).putMovie({
			container: sContainer,
			location: '/videos/storeMovieSmall.flv',
			width: sWidth,
			height: sHeight
		});
		return false;
	});
	$('.storeMovieLarge').click(function() {
		$('#movie').putMovie({
			container: '#movie',
			location: '/videos/storeMovieLarge.flv',
			width: mWidth,
			height: mHeight
		});
		return false;
	});
		
});