//////////////////////index.jsp

var tutorials = {};
tutorials["tourCreate"] = {
	title:"Create content & Collaborate everywhere", 
	color:"#21CDF8",
	desc:"Leave personalized blabs <b>anywhere across the Web!</b><br/>\
	Virtually blog or simply Show off your creative skills to your friends,\
	anywhere across the Web!\
	<br/><br/>\
	Scribble colorful doodles on your friend's Facebook page, \
	lead your followers to checkout virtual blogs you scatter arround the web, \
	show everyone what you think or feel about anything!\
	<br/><br/>\
	<b>Start Blabbing with your friends now!</b>",
	strip:"images_new/tut_comic_3.png", 
	ytId:"j4Q_9e4ZozE"};
	
tutorials["tourSurprise"] = {
	title:"Surprise your friend around the Web", 
	color:"#F6379E",
	desc:"Plant virtual surprises for your friends <b>anywhere around the Web</b> and create a more personalized experience for you and your buddies.\
	<br/><br/>\
	Wow your girlfriend the next time she enters Facebook or Pow your buddies the next time they sneak on a naughty site! \
	<br/><br/>\
	<b>Feeling romantic? Cheesy? Naughty or nice? plant a cool surprise and WOW your friends!</b>", 
	strip:"images_new/tut_comic_2.png", 
	ytId:"NbkYrCheXXU"};
	
tutorials["tourWhistle"] = {
	title:"Interact with your friends from everywhere",
	color:"#9EE541",
	desc:"Lead your friends on a virtual ride through the Web! <br/>\
	<b>Whistle your friends</b>&nbsp;while you are surfing the Web, use it to <b>recommend, share information</b> or <b>leave a trail</b> of notes on any Webpage \
	\
	<br><br>Whether you're shopping, reading, checking the weather report or just fooling around - \
	make a Whistle to get your friends attention!<br/>\
	invite them to join you in real-time or leave a trail of whistles for them to find as they enter specific sites.", 
	strip:"images_new/tut_comic_1.png", 
	ytId:"QQ_yfwIVyg4"};

var lastYtId;

function embedYoutube() {
	var agent = navigator.userAgent.toLowerCase();
	return ((agent.indexOf('iphone')!=-1) || (agent.indexOf('ipad')!=-1));
}

function playMovie() {
	$("#swfFrame").html('<div id="swfContainer"></div>');
	if (embedYoutube()) {
		$("#swfContainer").html('<object width="740" height="440"><param name="movie" value="http://www.youtube.com/v/' + lastYtId + '&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' + lastYtId + '&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="740" height="440"></embed></object>');
	} else {
		swfobject.embedSWF("images_new/demo_player.swf", "swfContainer", "740", "440", "9.0.0", "images/expressInstall.swf", {}, {wmode: "transparent", allowFullScreen: "true", "allowScriptAccess": "always"} );
	}
}

function handleMovie() {
	lastYtId = 'XI9GB10dch4';
	
	$("#swfFrame").html('<div id="swfContainer"></div>');
	if (embedYoutube()) {
		$("#swfContainer").html('<object width="740" height="440"><param name="movie" value="http://www.youtube.com/v/' + lastYtId + '&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' + lastYtId + '&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="740" height="440"></embed></object>');
	} else {
		swfobject.embedSWF("images_new/demo_player.swf", "swfContainer", "740", "440", "9.0.0", "images/expressInstall.swf", {}, {wmode: "transparent", allowFullScreen: "true", "allowScriptAccess": "always"} );
	}
	
	$(".tutorial-wnd").css("top", "100px").fadeIn('slow');
}

function handleTour(e) {
	var tutData = tutorials[e.id];
	lastYtId = tutData.ytId;
	$("#swfContainer").html('<div id="swfContainer"></div>');
	$(".tutorial-wnd").css("top", "100px").fadeIn('slow');
	$(".tutorial-wnd .title").text(tutData.title).css("color", tutData.color);
	$(".tutorial-wnd .comicstrip").attr("src", tutData.strip);
	$(".tutorial-wnd .desc").html(tutData.desc);
	$(".tutorial-wnd #tutFlashHolder").css("background-color", tutData.color);
}
/*
function handleTourByName(name) {
	var tutData = tutorials[name];
	lastYtId = tutData.ytId;
	$(".tutorial-wnd").css("top", "100px").fadeIn('slow', function() {
			//swfobject.embedSWF("images_new/demo_player.swf", "divDemoSWFContainer", "290", "200", "9.0.0", "images/expressInstall.swf", {}, {wmode: "transparent", allowFullScreen: "true", "allowScriptAccess": "always"} );
      });
	$(".tutorial-wnd .title").text(tutData.title).css("color", tutData.color);
	$(".tutorial-wnd .comicstrip").attr("src", tutData.strip);
	$(".tutorial-wnd .desc").text(tutData.desc);
}
*/
function flGetDemoId() {
	return lastYtId;
}

function closeTutorial() {
	$("#swfFrame").html('<div id="swfContainer"></div>');
	$(".tutorial-wnd").fadeOut();
}
