
$(document).ready(function(){
	
	comeIn(3);


$('#radio a').lightBox({fixedNavigation:true});
		
swfobject.embedSWF("spititout.swf", "game-holder", "714", "480", "8.0.0","swf/expressInstall.swf", false, false, false);

//$('body#game div#content div#game').css({top:"0px"});


$('body#video div#content div#tv').css({top:"0px"});


//intro in function

function comeIn(div) {
	//alert("comeIn" + div);
	if (div == 1) {
		//goAway(active);
		
		$('img#jackalope').css({left:"-1000px"});
		$('img#jackalope2').css({right:"-400",top:"20px"});
		$('img#jackalope3').css({top:"-600px",right:"200px"});

		$('img#dirty').css({right:"-400px"});
		$('div#content div#intro').css({top:"0px"});
		
		$('img#jackalope').animate({left:"0px"}, 500, "easeInBounce");
		$('img#jackalope').queue(function() {
			$('img#dirty').animate({right:"11px"}, 1000, "easeInElastic");
		});
		
		active = 1;		
	}//close if intro in
	
	else if (div == 2) {
		$('p#game-holder').flash({
			src: 'spititout.swf',
			width: 714,
			height: 480
		});
		$('div#content div#game').dequeue();
		$('div#content div#game').css({top:"-480px"});
		$('div#content div#game').animate({top:"0px"}, 300, "easeInOutQuint");

		active = 2;
	}
	
	else if (div == 3) {
		var params = {};
		params.flashVars = "newPath=spititout.flv";
		swfobject.embedSWF("video.swf", "video-holder", "714", "482", "8.0.0","swf/expressInstall.swf", false, params, false);

		$('div#content div#tv').dequeue();
		$('div#content div#tv').css({top:"-480px"});
		$('div#content div#tv').animate({top:"-2px"}, 300, "easeInOutQuint");
	
		active = 3;	
	}
	
	else if (div == 4) {

		swfobject.embedSWF("radio.swf", "radio_holder", "714", "480", "8.0.0","swf/expressInstall.swf", false, params, false);		

		$('div#content div#radio').dequeue();
		$('div#content div#radio').css({top:"-480px"});
		$('div#content div#radio').animate({top:"0px"}, 300, "easeInOutQuint");
	
		active = 4;	
	}

	else if (div == 5) {
		$('div#content div#facts').dequeue();
		$('div#content div#facts').css({top:"-480px"});
		$('div#content div#facts').animate({top:"0px"}, 300, "easeInOutQuint");
	
		active = 5;	
	}
}



function factsIn() {

}



function goAway(active,div) {
	//alert("goAway" + active);
	$('img#jackalope').css({left:"-400px"});
	$('img#jackalope2').css({right:"-400px"});
	$('img#jackalope3').css({top:"-600px"});
	
	if (active == 1) {
		$('div#content div#intro').animate({top:"-600px"}, 300, "easeInOutQuint");
		$('div#content div#intro').queue(function() {
			jackalope(div);
		});
	}//close if intro

	if (active == 2) {
		$('#game-holder').replaceWith("<p id='game-holder'></p>");
		$('div#content div#game').animate({top:"-600px"}, 300, "easeInOutQuint");
		$('div#content div#game').queue(function() {
			jackalope(div);
		});
	}//close if intro
	
	if (active == 3) {
		$('#video-holder').replaceWith("<p id='video-holder'></p>");
		$('div#content div#tv').animate({top:"-600px"}, 300, "easeInOutQuint");
		$('div#content div#tv').queue(function() {
			jackalope(div);
		});
	}//close if intro
	
	if (active == 4) {
		$('#radio_holder').replaceWith("<p id='radio_holder'></p>");
		$('div#content div#radio').animate({top:"-600px"}, 300, "easeInOutQuint");
 		$('div#content div#radio').queue(function() {
			jackalope(div);
		});
	}//close if intro

	if (active == 5) {
		$('div#content div#facts').animate({top:"-600px"}, 300, "easeInOutQuint");
		$('div#content div#facts').queue(function() {
			jackalope(div);
		});
	}//close if intro

}


function jackalope(div) {
	var randomNumber = Math.floor(Math.random()*3);
	//var randomNumber = 2;
	//alert('jackalope');
	$('img#jackalope').dequeue();
	$('img#jackalope2').dequeue();
	$('img#jackalope3').dequeue();
	$('img#dirty').dequeue();

	
	if (randomNumber == 0) {
		//alert(randomX);
		$('img#jackalope').css({left:"-400px"});	
		$('img#jackalope2').css({top:"80px",right:"-400px"}).dequeue();	
		//$('img#jackalope3').css({top:"-600px",right:"-400px"});	
		$('img#dirty').css({right:"-400px"});
		$('div#content div#intro').css({top:"0px"});	
		$('img#jackalope2').animate({right:"0px"}, 700, "easeInOutQuint").animate({right:"0px"}, 400, "easeInOutQuint").animate({right:"-400px"}, 450, "easeInOutQuint");
		$('img#jackalope2').queue(function() {
			comeIn(div);			
		});	
	}//close if 0

	else if (randomNumber == 1) {
		var randomX = Math.floor(Math.random()*400);
		//alert(randomX);
		$('img#jackalope').css({left:randomX + "px",top:"900px"}).dequeue();	
		$('img#dirty').css({right:"-400px"});
		$('div#content div#intro').css({top:"0px"});	
		$('img#jackalope').animate({top:"100px"}, 700, "easeInOutQuint").animate({top:"100px"}, 400, "easeInOutQuint").animate({top:"900px"}, 450, "easeInOutQuint");
		$('img#jackalope').queue(function() {
			comeIn(div);			
		});
	}//close else if 1

	else if (randomNumber == 2) {
		var randomX = Math.floor(Math.random()*400);
		//alert(randomX);
		$('img#jackalope3').css({left:randomX + "px",top:"-600px"}).dequeue();	
		$('img#dirty').css({right:"-400px"});
		$('div#content div#intro').css({top:"0px"});	
		$('img#jackalope3').animate({top:"-100px"}, 700, "easeInOutQuint").animate({top:"-100px"}, 400, "easeInOutQuint").animate({top:"-600px"}, 450, "easeInOutQuint");
		$('img#jackalope3').queue(function() {
			comeIn(div);			
		});
	}//close else if 1


}









//CLICKS
$('li#link_game a').click(function() {

		goAway(active,2);
		return false;
	
});

$('li#link_tv a').click(function() {
		goAway(active,3);
		return false;
});

$('li#link_radio a').click(function() {
	goAway(active,4);
	return false;
});

$('li#link_facts a').click(function() {
	goAway(active,5);
	return false;
});



 });//close on ready
