$('.about').click(function() {
	var li = $(this).parent();
	$('#nav li').not(li).removeClass('active');
	$('#testimonials-info').hide();
	$('#about-info').toggle();
	if( li.is('.active') ) li.removeClass('active'); else li.addClass('active');
	return false;
});

$('.testimonials').click(function() {
	var li = $(this).parent();
	$('#nav li').not(li).removeClass('active');
	$('#about-info').hide();
	$('#testimonials-info').toggle();
	if( li.is('.active') ) li.removeClass('active'); else li.addClass('active');
	return false;
});

$(document).ready(function() {
	$.getJSON('http://twitter.com/status/user_timeline/quambu.json?count=3&callback=?', function(data){
			$('#header-info p.tweet-1').html('&rarr; ' + data[0].text);
			$('#header-info p.tweet-2').html('&rarr; ' + data[1].text);
			$('#header-info p.tweet-3').html('&rarr; ' + data[2].text);
	});
	
	$('.project a[href*=.jpg]').fancybox({
		'zoomOpacity'			: true,
		'overlayShow'			: true,
		'zoomSpeedIn'			: 600,
		'zoomSpeedOut'			: 500,
	});
})
.click(function() {
	$('#about-info, #testimonials-info').hide();
	$('#nav li').removeClass('active');
});

$('#about-info, #testimonials-info').click(function(e) {
	e.stopPropagation();
});

$('.contact-button').click(function() {
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if( ($('input#name').val() == "" ) || (reg.test($('input#email').val()) == false) || ($('textarea#message').val() == "") ) { $('p.error').show(); return false; }
	var dataString = 'name='+ $('input#name').val() + '&email=' + $('input#email').val() + '&website=' + $('input#website').val() + '&message=' + $('textarea#message').val();
	$.ajax({
    	type: "POST",
      	url: "assets/mailme.php",
	    data: dataString,
    	success: function() {
        $('p.error').html("Thank you!").css('color', 'green').show();
      }
     });
    return false;
});