﻿$(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;
	

	$('a#menu-top').click(function() { 
	
		currentPage = 'top';
	
		$('div#content').scrollTo( { top:0, left:0}, 800 );
		
		return false;
		
	});

	$('a#menu-about').click(function() {
	
		currentPage = 'about'; 
	
		$('div#content').scrollTo( { top:225, left:0}, 800 );
		
		return false;
		
	});
	
	$('a#menu-services').click(function() {
	
		currentPage = 'services'; 
	
		$('div#content').scrollTo( { top:1140, left:0}, 800 );
		
		return false;
		
	});
	
	$('a#menu-portfolio').click(function() {
	
		currentPage = 'portfolio';
	
		$('div#content').scrollTo( { top:2075, left:0}, 800 );
		
		return false;
		
	});
	
	$('a#menu-contact').click(function() {
	
		currentPage = 'contact';
	
		$('div#content').scrollTo( { top:2875, left:0}, 800 );
		
		return false;
		
	});

});
