/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Setting up the scene
 */

$(window).load(function(){



	var screenW = $(window).width();

	var pageWidth = 1020;

	var diff = parseInt(screenW/2 - pageWidth /2);

	
	
	var logoX = diff + 30
	var logoY = 0;

	var charX = diff + 800;
	var charY = 600;

	$("#logo").css("left", logoX + "px");
	$("#logo").css("top", logoY + "px");

	$("#character").css("left", charX + "px");
	$("#character").css("top", charY + "px");
	

});


$(document).ready(function(){

	
	var locale = "en";
	/* GET TO KNOW WHAT LANG IS BEING USED! */
	$.ajax ({
		type: "POST",
		url: "/utils/getlocale.php",
		success: function(msg){
			locale = msg;
		}
	});

	$(".nav-item").mouseover(function(){
		$(this).css("padding-top", "1px");
		$(this).css("color" , "#e54607");
		$(this).css("border-bottom", "2px solid #ffcc00");
	});
	$(".nav-item").mouseout(function(){
		$(this).css("padding-top", "0px");
		$(this).css("color", "#ffcc00");
		$(this).css("border-bottom", "none");
	});

	$(".nav-item").click(function(){
		$("#logo").fadeOut();
		var page = $(this).attr("id");
		
		$(this).css("color", "#e54607");
		$(".nav").slideUp("slow", function(){
			
			
			window.location = page;
		});
	});
	$(".content").fadeIn("slow", function(){
		$(".nav").slideDown("slow");
	});


	/* EFFECTS FOR THE START BUTTONS */

	$(".gfx-button").mouseover(function(){
		var btn = $(this).attr("id");
		btn = btn.split("-");
		var buttonId = btn[0];
		$(this).attr("src", "/images/buttons/" + buttonId + "_1_" + locale + ".png");
	});

	$(".gfx-button").mouseout(function(){
		var btn = $(this).attr("id");
		btn = btn.split("-");
		var buttonId = btn[0];
		$(this).attr("src", "/images/buttons/" + buttonId + "_0_" + locale + ".png");
	});

});