$(function() {

	$.localScroll({
		easing: 'easeInOutSine',
		onAfter:function() {}
	}); 
	
	$("nav a").click(function() {
		$("nav .active span").animate({
			left: '-230px'
			}, 1000, function() {
			// Animation complete.
		});
		$("nav a").removeClass("active");
		$(this).children("span").animate({
			left: '0px'
			}, 1000, function() {
			// Animation complete.
		});
		$(this).addClass("active");
		return true;
	});

	var docHeight = $(window).height();
//	$("#leftCol").height(docHeight);
	$("section").css("padding-bottom", docHeight);
	
	// initialize validator and add a custom form submission logic
	$("#contactForm").validator().submit(function(e) {

		var form = $(this);
		
		if (!e.isDefaultPrevented()) {

			var name = $("input#name").val();
			var email = $("input#email").val();
			var message = $('textarea#message').val() ;

			var string = 'name=' + name + '&email=' + email +  '&message=' + message ;
		//	alert(string) ; return false ;                                      

			$.ajax({
				type: "POST",
				url: "sendform.php",
				data: string,
				success: function(){
					$("#contact")
					.html("<h2>Your message has been sent</h2>")
					.append("<p>I will be in touch soon.</p>")
				//    .hide() ;
				}//success ends                                                       
			});

			// prevent default form submission logic
			e.preventDefault();
		}
	});
	

	$("#name").focus(function() {
		if($(this).val() == "Your Name") $(this).val("");
	});
	$("#name").blur(function() {
		if($(this).val() == "") $(this).val("Your Name");
	});
	$("#email").focus(function() {
		if($(this).val() == "Your Email") $(this).val("");
	});
	$("#email").blur(function() {
		if($(this).val() == "") $(this).val("Your Email");
	});
	$("#message").focus(function() {
		if($(this).val() == "Your Message") $(this).val("");
	});
	$("#message").blur(function() {
		if($(this).val() == "") $(this).val("Your Message");
	});

});