// JavaScript Document

$(document).ready(function() {  
  //toggle consoleGameSelect with button
  $("#toggleConsoleGameSelect a").click(function() {
		$("#consoleGameSelect").slideToggle(500);
		$("#toggleConsoleGameSelect a").toggleClass('current');
		$("#backToGame").toggle();
		gameObj.hideGame();
  });
});

$(document).ready(function() {
	var gameSelectAPI = $("#gameSelect").scrollable({
		api: true,
    size: 1,
		clickable: false
  });
  
	var gameSelectNavAPI = $("#gameSelectNav").scrollable({
    size: 5,
    clickable: false,
    prev: '#gameSelectPrev',
    next: '#gameSelectNext'
  }).circular({api: true});
	
	$("#toggleConsoleGameSelect a").click(function(){
		gameSelectAPI.seekTo(curGameIndex);
    gameSelectNavAPI.move(curGameIndex - 2);
		$("#game" + curGameIndex).css('display', 'block');
	});	
	
	$("#gameSelectNav .items img").click(function() {
    var target = $(this).attr("rel");
		//gameSelectAPI.seekTo(target);
		$("#game" + curGameIndex).fadeOut(500, function(){
			$("#game" + target).fadeIn(500);
		});
		
		curGameIndex = target;
	});
});

