$(function(){
	$(".draggable").draggable({ revert: false }).disableSelection();
	$("div.draggable").click(function(){
		$("div").removeClass('active');
		$(this).addClass('active');
	});
	
	$( "#idealap-logo" ).animate({
		"bottom": "70%", "opacity": 1
	}, 10000 );
	
	$( "#idealap-logo" ).click(function(){
		$("#idealap-logo").clearQueue().stop(true,false).effect('explode', 3000).addClass('start-position');
	});

	$("#not-for-profit").click(function(){
		$("#idealap-logo").show().stop(true,false).animate({"top": "+=100"}, 3000 );
	});

	$("#megcsinaljuk").click(function(){
		$("#idealap-logo").show().stop(true,false).animate({"left": "+=100"}, 3000 );
	});

	$("#most-tortenik").click(function(){
		$("#idealap-logo").show().stop(true,false).animate({"top": "-=100"}, 3000 );
	});

	$("#cpm-szemlelet").click(function(){
		$("#idealap-logo").show().stop(true,false).animate({"left": "-=100"}, 3000 );
	});
});

function checkKey(e){
	switch (e.keyCode) {
		case 40:
			$("#idealap-logo").show().stop(true,false).animate({"top": "+=500"}, 3000 );
			break;
		case 38:
			$("#idealap-logo").show().stop(true,false).animate({"top": "-=500"}, 3000 );
			break;
		case 37:
			$("#idealap-logo").show().stop(true,false).animate({"left": "-=500"}, 3000 );
			break;
		case 39:
			$("#idealap-logo").show().stop(true,false).animate({"left": "+=500"}, 3000 );
			break;
		case 13:
			$("#idealap-logo").clearQueue().stop(true,false).effect('explode', 3000);
			break;
	}      
}

if ($.browser.mozilla) {
    $(document).keypress (checkKey);
} else {
    $(document).keydown (checkKey);
}

