// Functions LEFT RIGHT UP DOWN
$.fn.keyLeft = function () {
	if ($('.mhome').hasClass('sel') == true){
		return false;
	} else {
		$('#menu .left img').pnMove();
	}
};

$.fn.keyRight = function () {
	if ($('.mcontact').hasClass('sel') == true){
		return false;
	} else {
		$('#menu .right img').pnMove();
	}
};

$.fn.keyUp = function () {
	if ($('.mportfolio').hasClass('sel') == true){
		$('#portfolio .next').click();
	} else if ($('.mabout').hasClass('sel') == true){
		$('#about #me').threeframes();
	} else if ($('.mcontact').hasClass('sel') == true){
		$('#mail').mailForm();
	}
};

$.fn.keyDown = function () {
	if ($('.mportfolio').hasClass('sel') == true){
		$('#portfolio .previous').click();
	} else if ($('.mabout').hasClass('sel') == true){
		$('#about #me').threeframes();
	} else if ($('.mcontact').hasClass('sel') == true){
		$('#mail').mailForm();
	}
};

// Keydown
$(document).keydown(function(e){
	if (e.keyCode == 37) {
		$('body').keyLeft();
	} else if (e.keyCode == 39) {
		$('body').keyRight();
	} else if (e.keyCode == 38) {
		$('body').keyUp();
	} else if (e.keyCode == 40) {
		$('body').keyDown();
	}
});


// Swipe
function swipe(event, direction) {
	if (direction == 'right'){
		$('body').keyLeft();
	} else if (direction == 'left'){
		$('body').keyRight();
	} else if (direction == 'up'){
		$('body').keyUp();
	} else if (direction == 'down'){
		$('body').keyDown();
	}
}
			
