﻿$(document).ready(function () { showMovies() });

function showMovies() {
	$('.media').media({
	    width:     330,
	    height:    250,
	    autoplay:  true,
	    bgColor:  '#262626',
	    src:       '/content/videos/'+productswfsmall,
	    params:    { wmode: 'opaque', menu: 'false' }
	});
	$('#videoenlargebtn').addClass('hidden').fadeTo(1500, 0, function() {
		$(this).removeClass('hidden')
	}).fadeTo(2500, 1);
}

function enlargeVideo() {
	$('.media').fadeTo(300, 0, function () {
		$(this).addClass('hidden').media({
		    width:     330,
		    height:    250,
		    autoplay:  true,
		    bgColor:  '#262626',
		    src:       '/content/videos/blank.swf',
		    params:    { wmode: 'opaque', menu: 'false' }
		});
	});
	
	$('#videoenlargebtn').fadeTo(400, 0, function () { $(this).addClass('hidden') });
	$('#container').show();
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
		$('#container').media({
			width:     530,
			height:    377,
			autoplay:  true,
			bgColor:  '#0a0a0a',
			src:       '/content/videos/'+productswflarge,
			params:    { wmode: 'transparent', menu: 'false' }
		});
	} else {
		$.dimScreen(1000, 0.8, function() {
			$('#container').media({
			width:     530,
			height:    377,
			autoplay:  true,
			bgColor:  '#0a0a0a',
			src:       '/content/videos/'+productswflarge,
			params:    { wmode: 'transparent', menu: 'false' }
			});
		});
	}
}

function doClose()
{
	$('#videoenlargebtn').fadeTo(1000, 1, function () {
		$(this).removeClass('hidden');
	});
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
		$('#container').media({
			width:     530,
			height:    377,
			autoplay:  true,
			bgColor:  '#0a0a0a',
			src:       '/content/videos/blank.swf',
			params:    { wmode: 'transparent', menu: 'false' }
		}).hide();
		$('#container').removeClass('hidden');
		$('.media').removeClass('hidden');
		$('#videoenlargebtn').fadeTo(10, 0);
		showMovies();
	} else {
		$('#container').media({
			width:     530,
			height:    377,
			autoplay:  true,
			bgColor:  '#0a0a0a',
			src:       '/content/videos/blank.swf',
			params:    { wmode: 'transparent', menu: 'false' }
		});
		$('#container').fadeTo(600, 0, function() {
			$.dimScreenStop(function () { $('#container').hide(); });
		});
		$('.media').fadeTo(700, 1, function () {
			$(this).removeClass('hidden');
			showMovies();
		});
	}
}
