$(function() {

	$('#Meet_Inventor').click(function(){	$('#Inventor_Modal').modal(); });

	$('#Install_Video_Button').click(openInstallVideo);

	$('#Commercial_Video_Button').click(openAboutVideo);

	

	initQuantityUpdater();

	

	swfobject.embedSWF(

		"home_video.swf",

		"Home_Video",

		"558",

		"319",

		"9.0.0",

		null,

		null,

		{

			"wmode":"transparent",

			"menu":"false"

		}

	);

	

	swfobject.embedSWF(

		"cool_designs.swf",

		"Cool_Designs",

		"994",

		"394",

		"9.0.0",

		null,

		null,

		{

			"wmode":"transparent",

			"menu":"false"

		}

	);

});



function openInstallVideo() {

	$('#Video_Panel').html('<div id="Install_Video"></div>');

	swfobject.embedSWF(

		"video_player.swf",

		"Install_Video",

		"600",

		"465",

		"8.0.0",

		null,

		{

			"movieSource":"install_video.flv"

		},

		{

			"wmode":"transparent",

			"menu":"false"

		}

	);

	$('#Video_Panel').modal();

}



function openAboutVideo() {

	$('#Video_Panel').html('<div id="About_Video"></div>');

	swfobject.embedSWF(

		"video_player.swf",

		"About_Video",

		"600",

		"465",

		"8.0.0",

		null,

		{

			"movieSource":"about_flutterblade.flv"

		},

		{

			"wmode":"transparent",

			"menu":"false"

		}

	);

	$('#Video_Panel').modal();

}



function closePanel() {

	// setTimeout is to fix a quirky bug in Windows Safari

	setTimeout(function(){

		$.modal.close();

		swfobject.removeSWF('About_Video');

		swfobject.removeSWF('Install_Video');

	},1);

}



function initQuantityUpdater() {

	$('img.quantityUpdater').click(

		function(evt){

			updateQuantity(evt.target.id.replace('Quantity_',''));

		}

	);

}



function updateQuantity(bladeNum) {

	$('#Blade_'+bladeNum).val(Number($('#Blade_'+bladeNum).val())+1);

}