$(document).ready(function(){
	
	switch (section){
		case 'game_info' : $('#btnGameInfo').css({'top':'-38px'});
		break;
		case 'media' : $('#btnMedia').css({'top':'-38px'});
		break;
		case 'story' : $('#btnStory').css({'top':'-38px'});
		break;
		case 'weaponry' : $('#btnWeap').css({'top':'-38px'});
		break;
		case 'enemies' : $('#btnEnemies').css({'top':'-38px'});
		break;
		case 'leaderboards' : $('#btnLead').css({'top':'-38px'});
		break;
		case 'multiplayer' : $('#btnMulti').css({'top':'-38px'});
		break;
	}
	
	//MAIN MENU
	function mainmenu(){
		var clearQueue = true;
		var gotoEnd = true;
		$('#mainNavbarUl li').hover(
			function(){
				$(this).children('a').children('img').animate({top:-38},{duration:700,easing:'easeOutBack'});
				$(this).children('ul').css({visibility:"visible",display:"none"}).show();
			},
			function(){
				$(this).children('a').children('img')
					.stop(clearQueue, gotoEnd)
					.animate({top:0},{duration:700,easing:'easeOutBack'});
				$(this).children('ul').hide();
			});
	}
	mainmenu();
	
	//FOOTER FLAG HOVERS
	$('#flagsContainer ul li a').animate({opacity:0.5},1);
	
	$('#flagsContainer ul li a').hover(
		function(){ $(this).animate({opacity:1},1); },
		function(){ $(this).animate({opacity:0.5},1); }
	);
	//DEFAULT MEDIA
	$('#videosIphone').hide();
	$('#btnScreenshots').css({'background-position':'top left'});
	
	//MEDIA TOGGLER
	$('#btnScreenshots').click(function(){
		$('#videosIphone').hide();
		$('#screenshotsIphone').fadeIn(300);
		$('#submenu ul li').css({'background-position':'bottom left'});
		$(this).css({'background-position':'top left'});
	});
	$('#btnVideos').click(function(){
		$('#screenshotsIphone').hide();
		$('#videosIphone').fadeIn(300);
		$('#submenu ul li').css({'background-position':'bottom left'});
		$(this).css({'background-position':'top left'});
	});
	
	//MULTIPLAYER TOGGLER
	$('#btnPlay').click(function(){
		$('#media').hide();
		$('#multiplayer').fadeIn(300);
		$('#submenu ul li').css({'background-position':'bottom left'});
		$(this).css({'background-position':'top left'});
	});
	$('#btnMaps').click(function(){
		$('#multiplayer').hide();
		$('#media').fadeIn(300);
		$('#submenu ul li').css({'background-position':'bottom left'});
		$(this).css({'background-position':'top left'});
	});
	
	//IPHONE VIDEOS
	$('#videosIphone ul li div:first').show();
	$('#videosIphone ul li label').animate({opacity:0.5},1);
	$('#videosIphone ul li label:first').animate({opacity:1},1);
	$('#videosIphone ul li label').click(function(){
		$('#videosIphone ul li label').animate({opacity:0.5},100);
		$(this).animate({opacity:1},100);
		$('#videosIphone ul li div').hide();
		$(this).parent('li').children('div').fadeIn(300);
	});
	
	//IPHONE SCREENSHOTS PAGER
	$('#iphoneScreens_0 li div:first').show();
	$('#iphoneScreens_0 li label').animate({opacity:0.5},1);
	$('#iphoneScreens_0 li label:first').animate({opacity:1},1);
	
	$('#screenshotsIphone ul li label').click(function(){
		$('#screenshotsIphone ul li label').animate({opacity:0.5},100);
		$(this).animate({opacity:1},100);
		$('#screenshotsIphone ul li div').hide();
		$(this).parent('li').children('div').fadeIn(300);
	});
	
	var init = 0;
	var maximo = 1; // PAGER MAX VALUE
	
	$('#btnPrev').click(function(){
		if (init > 0)
		{
			$('#iphoneScreens_'+init).hide();
			init--;
			$('#iphoneScreens_'+init+' li label').animate({opacity:0.5},1);
			$('#iphoneScreens_'+init+' li label:first').animate({opacity:1},1);
			$('#iphoneScreens_'+init+' li div:first').show();
			$('#iphoneScreens_'+init).fadeIn(300);
		}
	});
	
	$('#btnNext').click(function(){
		if (init < maximo)
		{
			$('#iphoneScreens_'+init).hide();
			init++;
			$('#iphoneScreens_'+init+' li label').animate({opacity:0.5},1);
			$('#iphoneScreens_'+init+' li label:first').animate({opacity:1},1);
			$('#iphoneScreens_'+init+' li div:first').show();
			$('#iphoneScreens_'+init).fadeIn(300);
		}
	});
	
	//WEAPONRY
	$('#weaponry ul li div:first').show();
	$('#weaponry ul li label').animate({opacity:0.5},1);
	$('#weaponry ul li label:first').animate({opacity:1},1);
	$('#weaponry ul li label').click(function(){
		$('#weaponry ul li label').animate({opacity:0.5},100);
		$(this).animate({opacity:1},100);
		$('#weaponry ul li div').hide();
		$(this).parent('li').children('div').fadeIn(300);
	});
	
	//ENEMIES
	$('#enemList li div:first').show();
	$('#enemList li label').animate({opacity:0.5},1);
	$('#enemList li label:first').animate({opacity:1},1);
	
	$('#enemList ul li label').click(function(){
		$('#enemList ul li label').animate({opacity:0.5},100);
		$(this).animate({opacity:1},100);
		$('#enemList ul li div').hide();
		$(this).parent('li').children('div').fadeIn(300);
	});
	
	// AVAILABLE PLATFORMS
	$('#availableHeader').css({'background':'url(images/texts_'+lang+'/available_header.jpg) top left no-repeat'});
	$('#av_iphone').hover(
		function() { $(this).css({'background':'url(images/texts_'+lang+'/av_iphone_hover.jpg) top left no-repeat'}) },
		function() { $(this).css({'background':'none'}) }
		);
	$('#av_ipad').hover(
		function() { $(this).css({'background':'url(images/texts_'+lang+'/av_ipad_hover.jpg) top left no-repeat'}) },
		function() { $(this).css({'background':'none'}) }
		);
	$('#av_palmpre').hover(
		function() { $(this).css({'background':'url(images/texts_'+lang+'/av_palmpre_hover.jpg) top left no-repeat'}) },
		function() { $(this).css({'background':'none'}) }
		);
	$('#av_android').hover(
		function() { $(this).css({'background':'url(images/texts_'+lang+'/av_android_hover.jpg) top left no-repeat'}) },
		function() { $(this).css({'background':'none'}) }
		);
	/*
	#av_ipad {
			width:76px;}
			#av_ipad:hover {background:url(../images/av_ipad_hover.jpg) top left no-repeat;}
		#av_palmpre {
			width:106px;}
			#av_palmpre:hover {background:url(../images/av_palmpre_hover.jpg) top left no-repeat;}
		#av_android {
			width:162px;}
			#av_android:hover {background:url(../images/av_android_hover.jpg) top left no-repeat;}
	*/
});