$(document).ready(function(){

	//Init prettySociable och prettyPhoto
	$.prettySociable();
	$.prettySociable.settings.urlshortener.bitly.active = true;
	$("a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'});

	$("#slider").easySlider({
		auto: true,
		controlsShow: false,
		continuous: true
	});

	$("#favorite").jFav();

	$("#toolbox img").fadeTo(10, 0.30);
	$(".bannerbyte img").fadeTo(10, 0.30);
	$("#slider").fadeTo(10, 0.30);

	var infoprev = "Hejsan";
	var hdimg = $("#headerdisplay").css("background-image");
	$("#headerdisplay img").hide();

  $("#toolbox img").hover(function(){
  $(this).stop(true, true).fadeTo("fast", 1.00);
  }, function(){
  $(this).stop(true, true).fadeTo("normal", 0.30);
  });

  $(".bannerbyte img").hover(function(){
  $(this).stop(true, true).fadeTo("normal", 1.00);
  }, function(){
  $(this).stop(true, true).fadeTo("slow", 0.30);
  });

  $("#slider").hover(function(){
  $(this).stop(true, true).fadeTo("normal", 1.00);
  }, function(){
  $(this).stop(true, true).fadeTo("slow", 0.30);
  });

  $("#brown").click(function(){
  $("body").css("background-image","url(graphics/bg2.png)");
  });

  $("#gray").click(function(){
  $("body").css("background-image","url(graphics/bg1.png)");
  });

  $("#blue").click(function(){
  $("body").css("background-image","url(graphics/bg3.png)");
  });

  $("#green").click(function(){
  $("body").css("background-image","url(graphics/bg4.png)");
  });

  $("ul.topnav").mouseleave(function(){
  $("#headerdisplay img").stop(true, true).show();
  $("#headerdisplay").css("background-image",hdimg);
  $("#headerdisplay img").stop(true, true).fadeOut(400);
  });

  $("#loz").hover(function(){
  infoprev = $("#infobar").html();
  $("#headerdisplay img").attr("src", "graphics/headerloz.png");
  $("#headerdisplay img").stop(true, true).fadeIn(400, function(){$("#headerdisplay").css("background-image","url(graphics/headerloz.png)");});
  $("#infobar").html("The Legend of Zelda");
  }, function(){
  $("#headerdisplay img").stop(true, true).fadeOut(400);
  $("#infobar").html(infoprev);
  });

  $("#aol").hover(function(){
  infoprev = $("#infobar").html();
  $("#headerdisplay img").attr("src", "graphics/headeraol.png");
  $("#headerdisplay img").stop(true, true).fadeIn(400, function(){$("#headerdisplay").css("background-image","url(graphics/headeraol.png)");});
  $("#infobar").html("Zelda II: The Adventure of Link");
  }, function(){
  $("#headerdisplay img").stop(true, true).fadeOut(400);
  $("#infobar").html(infoprev);
  });

  $("#alttp").hover(function(){
  infoprev = $("#infobar").html();
  $("#headerdisplay img").attr("src", "graphics/headeralttp.png");
  $("#headerdisplay img").stop(true, true).fadeIn(400, function(){$("#headerdisplay").css("background-image","url(graphics/headeralttp.png)");});
  $("#infobar").html("The Legend of Zelda: A Link to the Past");
  }, function(){
  $("#headerdisplay img").stop(true, true).fadeOut(400);
  $("#infobar").html(infoprev);
  });

  $("#oot").hover(function(){
  infoprev = $("#infobar").html();
  $("#headerdisplay img").attr("src", "graphics/headeroot.png");
  $("#headerdisplay img").stop(true, true).fadeIn(400, function(){$("#headerdisplay").css("background-image","url(graphics/headeroot.png)");});
  $("#infobar").html("The Legend of Zelda: Ocarina of Time");
  }, function(){
  $("#headerdisplay img").stop(true, true).fadeOut(400);
  $("#infobar").html(infoprev);
  });

  $("#mm").hover(function(){
  infoprev = $("#infobar").html();
  $("#headerdisplay img").attr("src", "graphics/headermm.png");
  $("#headerdisplay img").stop(true, true).fadeIn(400, function(){$("#headerdisplay").css("background-image","url(graphics/headermm.png)");});
  $("#infobar").html("The Legend of Zelda: Majora's Mask");
  }, function(){
  $("#headerdisplay img").stop(true, true).fadeOut(400);
  $("#infobar").html(infoprev);
  });

  $("#tww").hover(function(){
  infoprev = $("#infobar").html();
  $("#headerdisplay img").attr("src", "graphics/headertww.png");
  $("#headerdisplay img").stop(true, true).fadeIn(400, function(){$("#headerdisplay").css("background-image","url(graphics/headertww.png)");});
  $("#infobar").html("The Legend of Zelda: The Wind Waker");
  }, function(){
  $("#headerdisplay img").stop(true, true).fadeOut(400);
  $("#infobar").html(infoprev);
  });

  $("#tp").hover(function(){
  infoprev = $("#infobar").html();
  $("#headerdisplay img").attr("src", "graphics/headertp.png");
  $("#headerdisplay img").stop(true, true).fadeIn(400, function(){$("#headerdisplay").css("background-image","url(graphics/headertp.png)");});
  $("#infobar").html("The Legend of Zelda: Twilight Princess");
  }, function(){
  $("#headerdisplay img").stop(true, true).fadeOut(400);
  $("#infobar").html(infoprev);
  });

  $("#ss").hover(function(){
  infoprev = $("#infobar").html();
  $("#headerdisplay img").attr("src", "graphics/headerss.png");
  $("#headerdisplay img").stop(true, true).fadeIn(400, function(){$("#headerdisplay").css("background-image","url(graphics/headerss.png)");});
  $("#infobar").html("The Legend of Zelda: Skyward Sword");
  }, function(){
  $("#headerdisplay img").stop(true, true).fadeOut(400);
  $("#infobar").html(infoprev);
  });

});
