jQuery(document).ready(function($){
	$.fn.konami = function(callback, code) {
		if(code == undefined) code = "38,38,40,40,37,39,37,39,66,65";
		
		return this.each(function() {
			var kkeys = [];
			$(this).keydown(function(e){
				kkeys.push( e.keyCode );
				if ( kkeys.toString().indexOf( code ) >= 0 ){
					$(this).unbind('keydown', arguments.callee);
					callback(e);
				}
			}, true);
		});
	}
	
	$.fn.quanranteDeux = function(callback, code) {
		if(code == undefined) code = "222,100,98,222";
		if(code == undefined) code = "222,52,50,222";
		
		return this.each(function() {
			var kkeys = [];
			$(this).keydown(function(e){
				kkeys.push( e.keyCode );
				if ( kkeys.toString().indexOf( code ) >= 0 ){
					$(this).unbind('keydown', arguments.callee);
					callback(e);
				}
			}, true);
		});
	}

$('div#flickr ul li').css('opacity', '0.9');
$('div#flickr ul li').hover(
function () {
$(this).fadeTo(250,1);
},
function () {
$(this).fadeTo(250, 0.8);
}
);
$('#menu ul li .current').css('opacity', '1');
$('#menu ul li:not(.current) a').hover(
function () {
$(this).fadeTo(250,1);
},
function () {
$(this).fadeTo(250, 0.45);
}
);

$mainNav2 = $("#menu ul");

$mainNav2.append("<li id='magic-line-two'></li>");

var $magicLineTwo = $("#magic-line-two");

$magicLineTwo
    .width($("#blog").width())
    .height($mainNav2.height())
    .css("left", $(".current").position().left +14)
    .data("origLeft", $("#blog a").position().left +14)
    .data("origWidth", $magicLineTwo.width())
    .data("origColor", $(".current a").attr("rel"));
            
$("#menu ul li").hover(function() {
    $el = $(this);
    leftPos = $el.position().left;
    newWidth = $el.width();
    $magicLineTwo.stop().animate({
        left: leftPos + 14,
        width: newWidth,
    })
}, function() {
    $magicLineTwo.stop().animate({
        left: "719px",
        width: $magicLineTwo.data("origWidth"),
    });    
});

$('#menu ul li a.passive').css('opacity', '0.45');	

	$(document).ready(function(){
		$(window).konami(function(){ alert('Vous venez d\'activer le code Konami');
		
		window.location="http://blog.frenchlabs.net/geek-detecte-konami-code-active/";
	});
		$(window).quanranteDeux(function(){
			 alert('Vous venez de trouver LA réponse à la vie, à l\'univers et tout le reste !')
			window.location="http://blog.frenchlabs.net/42-la-reponse-a-la-vie-a-lunivers-et-tout-le-reste/";
			});
	});	

});