	var movieVisible;
	var movieState;
	var playing;
	var redflag;
	
	function getMovie(id) {
	    if(navigator.appName.indexOf("Microsoft") != -1) return window[id];
	    return document[id];
	}
	
	function switchMovie(spotlight) {
	    if(typeof(spotlight.sendEvent)==='function')
  		try { spotlight.sendEvent('playpause',''); } catch(e) { }
	}

	function showMovie(show) {
		if(redflag) return;
		
		var spotlight = getMovie('spotlight');
	
		if (show) {
			if (!movieVisible) {
				spotlight.style.visibility = 'visible';
		
				movieVisible = true;
				
				if(playing==0 && movieState!=0)
				switchMovie(spotlight);
			}
			
		} else {	
			if (movieVisible) { 
				movieState = playing; 
				movieVisible = false;
				
				if (playing!=0)
				switchMovie(spotlight);
				
				spotlight.style.visibility = 'hidden';
			}
		}
	};
	
	function loadMovie(autostart) {
			var so = new SWFObject('mediaplayer.swf','spotlight','720','540','9.0.60');
				so.addParam('allowscriptaccess','always');
				so.addParam('allowfullscreen','true');
				so.addParam('wmode','transparent');
				so.addVariable('enablejs','true');
				so.addVariable('javascriptid','spotlight');
				so.addVariable('height','540');
				so.addVariable('width','720');
				so.addVariable('displayheight','540');
				so.addVariable('displaywidth','720');
				so.addVariable('file','video/erich_main.mp4');
				so.addVariable('showdigits','false');
				so.addVariable('usefullscreen','false');
				so.addVariable('backcolor','0x000000');
				so.addVariable('overstretch','true');
				so.addVariable('autostart', autostart);
				so.addVariable('repeat','false');
				so.addVariable('type','flv');
				so.addVariable('image','images/screen.jpg');
				
				try { 
					so.write('player'); 
					redflag = false; 
					
					if(autostart=='true') 
					showMovie(true);
					else
					showMovie(false);
				} catch(e) { }
	};
	
	function getUpdate(typ, pr1, pr2, pid) {
		if(typ=="state") {
			playing = pr1;
		}
	};

jQuery(function(){
	jQuery("div.csw").prepend("<p class='loading'>Loading...<br /><img src='images/ajax-loader.gif' alt='loading...'/ ></p>");
});
var j = 0;
jQuery.fn.codaSlider = function(settings) {
	 settings = jQuery.extend({
     easeFunc: "expoinout",
     easeTime: 850,
     toolTip: false
  }, settings);
	return this.each(function(){
		var container = jQuery(this);
		container.find("p.loading").remove();
		container.removeClass("csw").addClass("stripViewer");
		var panelWidth = container.find("div.panel").width();
		var panelCount = container.find("div.panel").size();
		var stripViewerWidth = panelWidth*panelCount;
		container.find("div.panelContainer").css("width" , stripViewerWidth);
		var navWidth = panelCount*2;
		var cPanel = 1;
		
		// Specify the current panel.
		// If the loaded URL has a hash (cross-linking), we're going to use that hash to give the slider a specific starting position...
		if (location.hash && parseInt(location.hash.slice(1)) <= panelCount) {
			var cPanel = parseInt(location.hash.slice(1));
			var cnt = - (panelWidth*(cPanel - 1));
			jQuery(this).find("div.panelContainer").css({ left: cnt });
		// Otherwise, we'll just set the current panel to 1...
		}
		
		// Create appropriate nav
		container.each(function(i) {
			// Create the Tabs
			jQuery(this).before("<div class='stripNav' id='stripNav" + j + "'><div class='stripNavB'><div>&nbsp;</div></div><ul><\/ul><\/div>");
			jQuery(this).find("div.panel").each(function(n) {
				jQuery("div#stripNav" + j + " ul").append("<li><a href='#" + (n+1) + "'>" + jQuery(this).attr("title") + "<\/a><\/li>");												
			});
			
			// Tab nav
			jQuery("div#stripNav" + j + " a").each(function(z) {
				jQuery(this).bind("click", function() {
					jQuery(this).addClass("current").parent().parent().find("a").not(jQuery(this)).removeClass("current"); // wow!
					var cnt = - (panelWidth*z);
					cPanel = z + 1;
					
					//oyoaha smart interface (tm)
					if(settings.easeTime>450)
					settings.easeTime -= 10;
					
					if(cPanel==1)
					{ 
						jQuery(this).parent().parent().parent().next().find("div.panelContainer").animate({ left: cnt}, settings.easeTime, settings.easeFunc, function(){showMovie(true);});
					} else {
						showMovie(false);
						jQuery(this).parent().parent().parent().next().find("div.panelContainer").animate({ left: cnt}, settings.easeTime, settings.easeFunc);
					}
				});
			});
			
			jQuery("div#stripNav" + j + " a:eq(" + (cPanel - 1) + ")").addClass("current");
		});

		playing = 0;
		movieState = 0;
		redflag = true;
		
		//initialize movie
		if(cPanel==1) {
			movieVisible = false;
			loadMovie('true');
		} 
		else {
			movieVisible = true;
			loadMovie('false');
		}
		// Same-page cross-linking
		jQuery("a.cross-link").click(function(){
			jQuery(this).parents().find(".stripNav ul li a:eq(" + (parseInt(jQuery(this).attr("href").slice(1)) - 1) + ")").trigger('click');
		});
				
		jQuery("div#slider").fadeIn("slow");
  		jQuery("div#slider").css("visibility", "visible");
		
		j++;
  });
};