APPLICATION = {
  init: function(){
    $('#contact-form').submit( APPLICATION.Contact.submit );
    $("#more-link").click( APPLICATION.toggleMore );
    $("#what-we-do h3 a").click( APPLICATION.showTab );
  },
  toggleMore: function(){
		$(".logos-hide").toggle();
		$(this).toggleClass('open');
		$(this).parent().toggleClass('open');
		if ($(this).hasClass('open')) { $(this).children('a').text('Fewer'); }
		else { $(this).children('a').text('More'); }    
  },
  showTab: function(){
    // Only runs when there are tabs!
  	var div_id = $(this).attr('id') + "-do";
  	$(this).addClass('active');
  	$(this).parent('h3').siblings('h3').children('a.active').removeClass('active');
  	$(".do.active").hide().removeClass('active');
  	$("#" + div_id).show().addClass('active');
  	try{_gaq.push(['_trackEvent', 'Tabs', 'Show', $(this).attr('id')]);}catch(e){}
  },
	Contact: {
		submit: function(event){
		  event.preventDefault();
			var dataString = 'email='+ $('input#form-email').val() + '&message=' + $('textarea#form-message').val();  
			$.ajax({  
			  type: "POST",  
			  url: "/contact.php",  
			  data: dataString,  
			  success: function() {
			    $('#contact-form').html("<div id='message'></div>");  
			    $('#message').html("<h2>Thanks for your Feedback!</h2>")  
			    .append("<p>We will be in touch soon.</p>")
			    .hide()  
			    .fadeIn(1500);
			  }  
			});  
			return false;
		}
	}
}

