﻿$(document).ready(function(){

	function validate(formData, jqForm, options) { 
	    // jqForm is a jQuery object which wraps the form DOM element 
	    // 
	    // To validate, we can access the DOM elements directly and return true 
	    // only if the values of both the username and password fields evaluate 
	    // to true 
	 
	    var form = jqForm[0]; 
	    if (!form.name.value || !form.email.value) { 
		   alert('Please fill out your name and email'); 
		   return false; 
	    } 
	    //alert('Both fields contain values.'); 
	}
	
	// prepare Options Object 
	
	var options = { 
		beforeSubmit: validate,
		success:    function() { 
			alert('Thanks for your comment!'); 
		} 
	}; 
				
	$('#contact-form').ajaxForm(options);
	
	
	

	$('div#work a').fancybox({
	
		'overlayOpacity':	0.8,
		'overlayColor':	'#000'
	
	});

	// sets the currentPage var
	
	var currentPage;
	

//Increasing 'top' moves section UP the screen

	$('a#menu-about').click(function() {
	
		currentPage = 'start'; 
		$('div#content').scrollTo( 0, 800 );
	
//		$('div#content').scrollTo( { top:0, left:0}, 800 );
		
		return false;
		
	});
	
	$('a#menu-web').click(function() {
	
		currentPage = 'web'; 
		$('div#content').scrollTo( 930, 800 );
		
//		$('div#content').scrollTo( { top:930, left:0}, 800 );
		
		return false;
		
	});
	
	$('a#menu-photography').click(function() {
	
		currentPage = 'photography';
		$('div#content').scrollTo( 1890, 800 );
	
//		$('div#content').scrollTo( { top:1890, left:0}, 800 );
		
		return false;
		
	});
	
	$('a#menu-design').click(function() {
	
		currentPage = 'design';
		$('div#content').scrollTo(2800, 800 );
	
//		$('div#content').scrollTo( { top:2800, left:0}, 800 );
		
		return false;
		
	});

});
