
$(document).ready(function() {
	$("#form1").validate({
		rules: {
			yourName: {
				required: true,
				minlength: 2
			},
			yourEmail: {
				required: true,
				email: true
			},
			yourMessage: {
				required: true,
				minlength: 6
			}
		},
		messages: {
			yourName: {
				required: "<br />Please enter your name",
				minlength: "<br />Your name can't be that short!"
			},
			yourMessage: {
				required: "<br />To get an answer, you need to ask a question!",
				minlength: "<br />Something tells me that's not a proper question..."
			},
			yourEmail: "<br />Please enter a valid email address"
		}
	});
	

	//Activate FancyBox
	$("a#beatlesLink").fancybox({
		'zoomSpeedIn': 0,
		'zoomSpeedOut': 0,
		'frameWidth': 580,
		'frameHeight': 420
	});
	
	$("a#wdysLink").fancybox({
		'zoomSpeedIn': 0,
		'zoomSpeedOut': 0,
		'frameWidth': 590,
		'frameHeight': 430
	});
	
	$("a#libertyLink, a#getsetLink").fancybox({
		'zoomSpeedIn': 0,
		'zoomSpeedOut': 0,
		'frameWidth': 830,
		'frameHeight': 460
	});
	
	$("a#unkleLink").fancybox({
		'zoomSpeedIn': 0,
		'zoomSpeedOut': 0,
		'frameWidth': 630,
		'frameHeight': 320
	});
	
	$("a#rvLink").fancybox({
		'zoomSpeedIn': 0,
		'zoomSpeedOut': 0,
		'frameWidth': 670,
		'frameHeight': 500
	});
});


jQuery(function( $ ){
	/**
	 * Most jQuery.localScroll's settings, actually belong to jQuery.ScrollTo, check it's demo for an example of each option.
	 * @see http://flesler.demos.com/jquery/scrollTo/
	 * You can use EVERY single setting of jQuery.ScrollTo, in the settings hash you send to jQuery.LocalScroll.
	 */
	
	/**
	 * Restart the scroll position to ( 0, 0 ) (Firefox doesn't reset it)
	 * could use $(target).scrollTo( 0, {axis:'xy'));
	 * but this needs to be quick(synchronous), to reset before $.localScroll.hash() begins
	 */
	$('#mainPageHolder').attr({scrollTop:0,scrollLeft:0});
	$('#subNav').attr({scrollTop:0,scrollLeft:0});
	
	// Scroll initially if there's a hash (#something) in the url 
	$.localScroll.hash({
		target: '#mainPageHolder', //could be a selector or a jQuery object too.
		axis:'xy',//the default is 'y'
		queue:true,
		duration:1000
	});
	
	var $last = $([]);//save the last link
	
	/**
	 * NOTE: I use $.localScroll instead of $('#navigation').localScroll() so I
	 * also affect the >> and << links. I want every link in the page to scroll.
	 */
	$('#mainPageHolder').localScroll({
		target: '#mainPageHolder', //could be a selector or a jQuery object too.
		axis:'xy', //the default is 'y'
		queue:true,
		duration:1000,
		hash:false,
		onBefore:function( e, anchor, $target ){//'this' is the clicked link
			$last.removeClass('scrolling');
			$last = $(this).addClass('scrolling');
			if( this.blur )
				this.blur();//remove the awful outline
		},
		onAfter:function( anchor ){
			$last.removeClass('scrolling');
		}
	});
	
	$('#mainMenu').localScroll({
		target: '#mainPageHolder', //could be a selector or a jQuery object too.
		axis:'xy', //the default is 'y'
		queue:true,
		duration:1000,
		hash:false,
		onBefore:function( e, anchor, $target ){//'this' is the clicked link
			$last.removeClass('scrolling');
			$last = $(this).addClass('scrolling');
			if( this.blur )
				this.blur();//remove the awful outline
		},
		onAfter:function( anchor ){
			$last.removeClass('scrolling');
		}
	});
	
	$('.portfolio').localScroll({
		target: '#mainPageHolder', //could be a selector or a jQuery object too.
		axis:'xy', //the default is 'y'
		queue:true,
		duration:1000,
		hash:false,
		onBefore:function( e, anchor, $target ){//'this' is the clicked link
			$last.removeClass('scrolling');
			$last = $(this).addClass('scrolling');
			if( this.blur )
				this.blur();//remove the awful outline
		},
		onAfter:function( anchor ){
			$last.removeClass('scrolling');
		}
	});

	
	$('.thePortfolio').localScroll({
		target: '#mainPageHolder', //could be a selector or a jQuery object too.
		axis:'xy', //the default is 'y'
		queue:true,
		duration:1000,
		hash:false,
		onBefore:function( e, anchor, $target ){//'this' is the clicked link
			$last.removeClass('scrolling');
			$last = $(this).addClass('scrolling');
			if( this.blur )
				this.blur();//remove the awful outline
		},
		onAfter:function( anchor ){
			$last.removeClass('scrolling');
		}
	});
	
	$('.anarrow').localScroll({
		target: '#subNav', //could be a selector or a jQuery object too.
		axis:'x', //the default is 'y'
		queue:true,
		duration:1000,
		hash:false
	});
});