$(document).ready(function () {
   	
   	$("*").localScroll({
  	target:'#content',
  	hash: true
	});
	
	/*
	$('#contactForm').FormValidate({
		phpFile: "/send.php",
		ajax: true,
		validCheck: false
	});
	*/
	$('.notice').hide();
	/*
	$('#submitBtn').bind('click', function(){
		$('#contactForm').submit();
	});
	*/
	
	$('#contactForm').submit(function(){
		$.post('/send.php', $("#contactForm").serialize(), function(data) {
			$('.notice').text(data);
			$('.notice').fadeIn();
			
			// clear data to prevent double posting
			$('.input').each(function() {
				$(this).val('');
			});
			
		});
		
		return false;
	});
		
	
	
	$('#submitBtn').click(function(){
		
		var $isValid = true;
		$('.is_required').each(function(index) {
		    //alert($(this).val());
			if($(this).val() == ''){
				$isValid = false;
			}
			
		});
		
		if($isValid){
			$('#contactForm').submit();
		}else{
			$('.notice').html('Please fill in all fields <br/>marked with a *');
			$('.notice').fadeIn();
		}
		
	});
	
	
	
});