//////////////////////////////////////////
//
// Rodeo and the Lollipop Kingdom
// @author: Rocco Augusto
// @url: http://nerdofsteel.com
//
//////////////////////////////////////////

var gamestatus = 0,
	i = 1,
	dialog = ['Once upon a time in the <strong>Lollipop Kingdom</strong> there was an adorable girl named <strong>Princess Jennypop</strong>. She was the princess of all things candy and delicious.',
			  'Being a princess was a hard job and like all princesses, <strong>Princess Jennypop</strong> longed for adventure and love from a cute rugged candy loving boy',
			  'Unfortunately all of her subjects were made out of candy which made <strong>Princess Jennypop</strong> sad with grief since candy is only good to eat and not meant for dating.',
			  'Not wanting her subjects to see her sad, <strong>Princess Jennypop</strong> would often sneak away from her castle to walk along the wide open feilds of the <strong>Lollipop Kingdom</strong> and day dream about one day meeting a cute boy.',
			  'During one of these walks <strong>Princess Jennypop</strong> bumped into a real life handsome and rugged boy! Not only was he real, he was a looker too and <strong>Princess Jennypop</strong> knew she had to have him... but at the same time she had to play it cool since she was a princess and all',
			  'The boy, whos name was <strong>Rodeo</strong>, was very smitten with <strong>Princess Jennypop</strong> as well. Unfortunately though, like all dumb boys, he figured with her being a princess she would never want to date him which made him a very <strong>sad panda</strong>',
			  'Not one to give up hope, <strong>Rodeo</strong> decided to win <strong>Princess Jennypop\'s</strong> heart by making her a <strong>video game</strong>...',
			  'But <strong>video games</strong> take a <em>really</em> long time to create so he made her a <strong>demo</strong> of the opening scene of his video game instead which asked her a very simple question...',
			  '<em>"<strong>Princess Jennypop</strong>, would you do <strong>Rodeo</strong> the honor of going out on a real date with him?"</em> <p><a href="mailto:rocco@nerdofsteel.com?subject=Yes, I\'ll go out with you, silly boy :)">Yes</a> <a href="mailto:rocco@nerdofsteel.com?subject=Sorry, boys are creepy! :(">No</a></p> '];

function startGame()
{
	gamestatus = 1;
	$('#start').fadeOut('fast');
	
	$('#dialog').html(dialog[0]);
	setTimeout(function(){ $('#dialog').fadeIn('slow'); $('#jennypop, #rodeo').removeClass('hidden'); },500);
	
	setInterval(function()
	{
		$('#dialog').html(dialog[i]);
		
		if(i <= 7){
			$('#jennypop').animate({"left": "+=40px"}, 'slow');
			$('#rodeo').animate({"right": "+=40px"}, 'slow');
		}
		
		if(i < 8) 
			i++
		else
			clearTimeout();
	},10000);
}
	
$(document).ready(function(){
  //browser check
  if($.browser.msie)
  	$('#wrapper').css('overflow', 'hidden');
	
  //Start Game
  $(document).keydown(function(e)
  {
	 if(e.which == 13 && gamestatus == 0) { startGame(); }
  });	  
});
