$(document).ready(function() {
	var timeoutHandlers = new Array();

	if($('html').hasClass('no-touch')) { 
		$('.keyboard').delay(1500).fadeIn(500);
		$('.keyboard').delay(5500).fadeOut(500);
	} else {
		$('.swipe').delay(1500).fadeIn(500);
		$('.swipe').delay(5500).fadeOut(500);
	}

	// Logo mouseenter bind
	$('#logo, .hidden-contact').mouseenter(function() {
		clearTimeout(timeoutHandlers['logoHover']);
		$('.hidden-contact').stop(true, false).animate({
			top: 0
		}, 450, 'swing');
		
		$('#left #bio p, #left #bio a, #right #contact p').stop(true, false).animate({
			top: 0
		}, 600, 'swing');
	});
	
	// Logo, Contact/Bio mouseleave bind
	$('#logo, .hidden-contact').mouseleave(function() {
		timeoutHandlers['logoHover'] = setTimeout(function() {
			$('#left #bio p, #left #bio a, #right #contact p').animate({
				top: 210
			}, 400, 'swing');
			
			setTimeout(function() {
				$('.hidden-contact').animate({
					top: 210
				}, 300, 'swing');
			}, 100);
		}, 100);
	});
	
	// Video, Picture, Facebook, Twitter mouseenter bind
	$('.goto').mouseenter(function() {
		var $that = $(this);
		var idValue = $that.attr('id');

		$('.hidden-content', $that).stop(true, false).animate({
			top: 0
		}, 400, 'swing');
		
		$('.hidden-content p, h4, .facebook-hidden > div', $that).stop(true, false).animate({
			top: 0
		}, 600, 'swing');
	});
	
	// Video, Picture, Facebook, Twitter mouseleave bind
	$('.goto').mouseleave(function() {
		var $that = $(this);
		var idValue = $that.attr('id');

		$('p, h4, .facebook-hidden > div', $that).animate({
			top: 137
		}, 200, 'swing');
		
		setTimeout(function() {
			$('.hidden-content', $that).animate({
				top: 137
			}, 400, 'swing');
		}, 100);
	});
	
	// Blog mouseenter bind
	$('#blog').mouseenter(function() {
		var $that = $(this);

		$('.hidden-content', $that).stop(true, false).animate({
			top: 0
		}, 400, 'swing');
		
		$('.hidden-content p', $that).stop(true, false).animate({
			top: 0
		}, 600, 'swing');
	});
	
	// Blog mouseleave bind
	$('#blog').mouseleave(function() {
		var $that = $(this);

		$('p', $that).animate({
			top: 285
		}, 300, 'swing');
		
		setTimeout(function() {
			$('.hidden-content', $that).animate({
				top: 285
			}, 500, 'swing');
		}, 100);
	});
	
	$('#follow').click(function(ev) {
		ev.preventDefault();
		window.open($(this).attr('href'),'window name','width=600,height=450,scrollbars=no,menubar=no,resizable=no') 
	});
});
