
var msgBox = null;
var msgBoxChain = null;
var demoTool = null;
var mySmoothScroll = null;

window.addEvent('domready', function(){
	
	// assign demo tool
	demoTool = $('DraftMVPDemo');
	
	mySmoothScroll = new SmoothScroll();

});

function RegisterNow()
{
	var myFx = new Fx.Scroll(window).toElement('DemoRegister');
}	


function changeStage(strStage)
{
	var strHTML = "";

	var myFx = new Fx.Scroll(window).toElement('DemoScroll');
	
	switch (strStage)
	{
		case "LeagueSetup":
			strHTML = "<span style='font-size:20px;'>First, you'll want to tell us about how your league is set up.</span><br><br><br><div style='width:100%;text-align:right;'><a href=\"javascript:changeStage('LeagueCat');\" style='text-decoration: none; color: green; font-weight: bold; font-size: 22px;'>CONTINUE</a><div>";
			break;
		case "LeagueCat":
			strHTML = "<span style='font-size:20px;'>Then, tell us about the Stat Categories that matter in your league.</span><br><br><br><div style='width:100%;text-align:right;'><a href=\"javascript:changeStage('PlayerSearch');\" style='text-decoration: none; color: green; font-weight: bold; font-size: 22px;'>CONTINUE</a></b>";
			demoTool.ChangeStep('LeagueCat');
			break;
		case "PlayerSearch":
			strHTML = "<span style='font-size:20px;'>Imagine you're in the middle of your draft, the 4th round, to be specific:</span><br><br>";
			strHTML += "<span style='font-size:16px;'>So far, you've taken: Ryan Howard, Carl Crawford and Derek Jeter (see charts above).</span><br>"; 
			strHTML += "<div style='width:100%;text-align:right;'><a href=\"javascript:changeStage('PlayerSearch2');\" style='text-decoration: none; color: green; font-weight: bold; font-size: 22px;'>CONTINUE</a></div>";
			demoTool.ChangeStep('PlayerSearch');
			break;
		case "PlayerSearch2":
			strHTML = "See the \"Player Search\" Box above? <span style='color: green;font-weight:bold'>CLICK ON IT NOW</span><br>";
			strHTML += "Now, type in 3 different players, hitting enter after highlighting them:<br>";
			strHTML += "Eric Byrnes, Ken Griffey, Jr. and Pat Burrell.<br><br>";
			strHTML += "<span style='color:red; font-size:22px;'>SELECT THE THREE PLAYERS AND WE'LL CONTINUE</span>";
			demoTool.ChangeStep('PlayerSearch2');
			break;
		case "PlayerSearch3":
			strHTML = "<span style='font-size:20px;'>CONGRATULATIONS! You've done your very first draft evaluation. Easy, right?<br>Review each column and hover over them to see stats & specifics.</span><br><br>";
			strHTML += "<div style='width:100%;text-align:right;'><a href=\"javascript:changeStage('DraftPlayer');\" style='text-decoration: none; color: green; font-weight: bold; font-size: 22px;'>CONTINUE</a></span><br>";
			break;
		case "DraftPlayer":
			strHTML = "<span style='font-size:16px;'>In addition to our charts, the \"On Deck\" section gives detailed views of a player's historical statistics.<br> <span style='color: green;font-weight:bold'>DRAFT ONE PLAYER NOW BY CLICKING DRAFT UNDER THIER NAME</span></span><br><br>";
			strHTML += "<span style='color:red; font-size:22px;'>DRAFT A PLAYER TO CONTINUE</span>";
			demoTool.ChangeStep('DraftPlayer');
			break;
		case "DraftUpdate":
			strHTML = "<span style='font-size:18px;'>CONGRATULATIONS! You've drafted a player.  The cumulative totals (orange columns) have updated. Time to think about your next pick - looks like you need 3Bs and RBIs...</span><br><br>";
			strHTML += "<div style='width:100%;text-align:right;'><a href=\"javascript:changeStage('AdvancedSearch');\" style='text-decoration: none; color: green; font-weight: bold; font-size: 22px;'>CONTINUE</a></div>";
			break;
		case "AdvancedSearch":
			strHTML = "If you've ever struggled with mid to late round picks, <b><u>Advanced Search</u></b> is for you. Let's assume that you need a batter (specifically a catcher) who can contribute 3Bs and RBIs. <span style='color: green;font-weight:bold'>RUN THE SEARCH NOW</span><br><br>";
			strHTML += "<span style='color:red; font-size:22px;'>SEARCH FOR PLAYERS TO MOVE ON</span>";
			demoTool.ChangeStep('AdvancedSearch');
			break;
		case "AdvancedSearch2":
			strHTML = "<span style='font-size:16px;'>The results of your search are listed here. Now, choose one of the catchers by <span style='color: green;font-weight:bold'>DOUBLE CLICKING ON HIM</span></span>.<br><br><br>";
			strHTML += "<span style='color:red; font-size:22px;'>SELECT A PLAYER TO MOVE ON</span>";
			break;
		case "Done":
			strHTML = "";
			break;
	}




	
	var msgBox = $('demoText');
	var msgBoxChain = new Chain();

	var myEffectOut = new Fx.Tween(msgBox, {duration:600, onComplete: function (){msgBoxChain.callChain();}});
	var myEffectIn = new Fx.Tween(msgBox, {duration:600});

	
	msgBoxChain.chain(
	    function(){ myEffectOut.start('opacity', 1, 0);},
	    function(){ msgBox.set('html', strHTML); this.callChain();},
	    function(){ myEffectIn.start('opacity', 0, 1); }
	);
	
	msgBoxChain.callChain();



}
