	/** Teh magic, what's of it **/

$(document).ready(function() {

	//Top nav showy-hide
	$('#searchLink').toggle(function() {
		$('.hiddenInfo').slideUp(300);
		$('#hiddenSearch').slideDown(300);
	}, function() {
		$('.hiddenInfo').slideUp(300);
	});
	$('#aboutLink').toggle(function() {
		$('.hiddenInfo').slideUp(300);
		$('#hiddenBio').slideDown(300);
	}, function() {
		$('.hiddenInfo').slideUp(300);
	});
	
	//Labels
	jQuery.fn.labelOver = function(overClass) {
		return this.each(function(){
			var label = jQuery(this);
			var f = label.attr('for');
			if (f) {
				var input = jQuery('#' + f);
				
				this.hide = function() {
				  label.css({ textIndent: -10000 })
				}
				
				this.show = function() {
				  if (input.val() == '') label.css({ textIndent: 0 })
				}
	
				// handlers
				input.focus(this.hide);
				input.blur(this.show);
			  label.addClass(overClass).click(function(){ input.focus() });
				
				if (input.val() != '') this.hide(); 
			}
		})
	}
	$('label').labelOver('over-apply');
	
	//Add intro class to first paragraph for styling
	$('article p:first').addClass('intro');
	
	//Scroll to top
	$('.scrollTop').click(function () {
    	$('html, body').animate({ scrollTop: '0px' }, 1500);
        return false;
    });

//End
});
