	
	jQuery.writeFlashError = function(sel) {
		var func = function() {
			$(sel).html('<div class="flash_error"><p><strong>Adobe Flash Player is required to view this content.</strong></p><p>Download the latest version from <a target="_blank" href="http://www.adobe.com/go/getflashplayer">here</a></p></div>');
		};
		return func;
	};
	
	jQuery.fn.swappableSwf = function(startingSwf) {
		return this.each(function() {
			var root = $(this);
			var id = $(this).attr('id');
			var ctrlClass = '.'+id+'_ctrl';
		
			if (startingSwf) {
				$(root).find('*').remove();
				// $(root).flashembed(startingSwf);
				$(root).flashembed({
					src: 		startingSwf,
					onFail: 	$.writeFlashError('#'+id)
				});
			}
			
			$(ctrlClass).each(function(intIndex) {
				$(this).bind('click', function() {
					$(root).find('*').remove();
					// $(root).flashembed($(this).attr('href'));
					$(root).flashembed({
						src: 		$(this).attr('href'),
						onFail: 	$.writeFlashError('#'+id)
					});
					
					return false;
				});
			});
		});
	};
