﻿// Inserts the Meet Steve SWF
function meetSteve() {
	
	// if the video is playing, stop it and play Steve instead
	if (thispage == "mainpage") {
 		jQuery("#main-video-link").remove();
		jQuery("#slideshow_container").html('<a id="main-video-link" href="#"><img src="video/StayToPlay_610x342.jpg" /></a>');
		replaceWholeSlideshow();
	}
	
	var flashvars = {};
	var params = {
		loop: "false",
		wmode: "transparent",
		quality: "high"
	};
	var attributes = {
		style: "position: relative; left:-54px;"
	};

	if (thispage == "subpage") {
		swfobject.embedSWF("../swf/intro2a.swf", "myContent", "290", "560", "9.0.0","/slideshow/flvplayer_no_flash/swfobject/expressInstall.swf", flashvars, params, attributes);
	}
	else {
		swfobject.embedSWF("swf/intro2a.swf", "myContent", "290", "560", "9.0.0","/slideshow/flvplayer_no_flash/swfobject/expressInstall.swf", flashvars, params, attributes);
	}
	jQuery('#meet-steve').hide();
	jQuery('#steve-nav').hide();
	jQuery('#substeve').height(550);
	jQuery('#substeve').width(250);
	jQuery('#substeve').unbind('mousedown');
	jQuery('#substeve').mousedown(function() { byeSteve(); });
	jQuery('#steve-header').mousedown(function() { byeSteve(); });
	jQuery('#steve-sidebar').mousedown(function() { byeSteve(); });
	
	// so that Steve stops when the video is played
	jQuery('#main-video-link').mousedown(function() { byeSteve(); });
	
}

// Bye Steve! - replaces the Steve SWF
function byeSteve() {
	
	jQuery('#steve-header').hide();
	jQuery('#steve-sidebar').hide();
 	
	// to stop the videos, we remove them and then replace them
	// these copies are made when meetSteve() is called
 	jQuery("#myContent-header").remove();
 	jQuery("#myContent-sidebar").remove();
	jQuery("#steve-header").html('<div id="myContent-header"></div>');
	jQuery("#steve-sidebar").html('<div id="myContent-sidebar"></div>');
	
	jQuery('#steve-nav').show();
	jQuery('#steve').show();
	
	var flashvars = {};
	var params = {
		loop: "true",
		wmode: "transparent",
		quality: "high"
	};
	var attributes = {
		style: "position: relative; left:-54px;"
	};

	if (thispage == "subpage") {
		swfobject.embedSWF("../swf/wave.swf", "myContent", "285", "550", "9.0.0","/slideshow/flvplayer_no_flash/swfobject/expressInstall.swf", flashvars, params, attributes);
	}
	else {
		swfobject.embedSWF("swf/wave.swf", "myContent", "285", "550", "9.0.0","/slideshow/flvplayer_no_flash/swfobject/expressInstall.swf", flashvars, params, attributes);
	}
	jQuery('#meet-steve').show();
	jQuery('#substeve').height(130);
	jQuery('#substeve').width(180);
	jQuery('#substeve').unbind('mousedown');
	jQuery('#substeve').mousedown(function() {meetSteve();});
	
}


// Slideshow
function replaceWholeSlideshow() {

	jQuery('#main-video-link').mouseup(function(event) {
			
		var flashvars = {
			flvpFolderLocation: "/slideshow/flvplayer_no_flash/flvplayer/", 
			flvpVideoSource: "http://www.staytoplay.com/video/StayToPlay_610x342.flv",
			flvpAutoStartMovie: true, 
			flvpWidth: "610", 
			flvpHeight: "342",
			flvpTurnOnCorners: false,
			
			flvpInitVolume: 50,
			flvpInterfaceDisplay: 'autohide',
			flvpVidConstraints: 'fit to width',
			
			flvpBgColor: '0x000000',
			flvpShowbInfo: false,
			flvpShowbCc: false,
			flvpShowbMenu: false,
			flvpShowbStop: false,
			flvpShowbBack: false,
			flvpShowbForward: false,
			
			flvpScrubBarFrontColor: '0x777777',
			flvpScrubBarDragColor: '0x000000',
			flvpScrubBarDragRollOverColor: '0xFFFFFF',
			flvpVolumeFrontColor: '0x777777',
			flvpVolumeDragColor: '0x000000',
			flvpVolumeDragRollOverColor: '0xFFFFFF'
		};
		
		var params = {
			wmode: "opaque",
			allowfullscreen: true
		};
		
		swfobject.embedSWF("slideshow/flvplayer_no_flash/FLVplayer.swf", "main-video-link", "610", "342", "9.0.0", "/slideshow/flvplayer_no_flash/swfobject/expressInstall.swf", flashvars, params);
		
	});
	
	
}


// for switching between swf files
// second intro file -- underneath the header bar
function introHeader() {
	
	jQuery('#steve').hide();
	jQuery('#steve-header').show();
	
	var flashvars = {};
	var params = {
		loop: "false",
		wmode: "transparent",
		quality: "high"
	};
	var attributes = {
		//style: "position: relative; left:-54px;"
	};

	if (thispage == "subpage") {
		swfobject.embedSWF("../swf/intro2b.swf", "myContent-header", "262", "300", "9.0.0","/slideshow/flvplayer_no_flash/swfobject/expressInstall.swf", flashvars, params, attributes);
	}
	else {
		swfobject.embedSWF("swf/intro2b.swf", "myContent-header", "262", "300", "9.0.0","/slideshow/flvplayer_no_flash/swfobject/expressInstall.swf", flashvars, params, attributes);
	}
}
// third intro file -- next to the right sidebar
function introWhere() {
	
	jQuery('#steve-header').hide();
	jQuery('#steve-sidebar').show();
	
	var flashvars = {};
	var params = {
		loop: "false",
		wmode: "transparent",
		quality: "high"
	};
	var attributes = {
		//style: "position: relative; left:-54px;"
	};

	if (thispage == "subpage") {
		swfobject.embedSWF("../swf/intro2c.swf", "myContent-sidebar", "249", "415", "9.0.0","/slideshow/flvplayer_no_flash/swfobject/expressInstall.swf", flashvars, params, attributes);
	}
	else {
		swfobject.embedSWF("swf/intro2c.swf", "myContent-sidebar", "249", "415", "9.0.0","/slideshow/flvplayer_no_flash/swfobject/expressInstall.swf", flashvars, params, attributes);
	}
	
}
// the very last intro file -- same location as first intro file
function finishIntro() {
	
	jQuery('#steve-sidebar').hide();
	
	jQuery('#substeve').width(302);
	jQuery('#steve').show();
	
	// for now, this replaces old Steve with new Steve, just like meetSteve() does -- just for testing purposes
	var flashvars = {};
	var params = {
		loop: "false",
		wmode: "transparent",
		quality: "high"
	};
	var attributes = {
		style: "position: relative; left:-44px;"
	};

	if (thispage == "subpage") {
		swfobject.embedSWF("../swf/intro2d.swf", "myContent", "350", "550", "9.0.0","/slideshow/flvplayer_no_flash/swfobject/expressInstall.swf", flashvars, params, attributes);
	}
	else {
		swfobject.embedSWF("swf/intro2d.swf", "myContent", "350", "550", "9.0.0","/slideshow/flvplayer_no_flash/swfobject/expressInstall.swf", flashvars, params, attributes);
	}
	
}
