$(document).ready(function(){
	 
   $('.sn-box').hover(
   	  function () {
		if(!$(this).hasClass('no-blue')) $(this).addClass('blue-box');
		$(this).children('.dropdown').fadeIn();
	  }, 
	  function () {
		$(this).removeClass('blue-box');
		$(this).children('.dropdown').fadeOut();
	  }
   );
   
   $('#consulting-box').click(
	function () {
		$('.container-box').hide(
			function (){
				$('#contact-form').show(0, function(){
					$('#thank-you').hide(0, function(){
						$('.contact-box').slideDown();
					});
				});

			}
		);
	}
   );
   
   $('#cancel-button').click( function () { hide_contact_form(); } );

   /* modeled after http://flowplayer.org/tools/demos/validator/server-side.html */
	$('#contact-form').validator().submit(
		function(e) {
			var form = $(this);
			
			if (!e.isDefaultPrevented()){
				$.ajax({
					url: "id-contact.php", 
					data: form.serialize(),
					success: function(){
						$('#contact-form').hide(function(){
							$('#thank-you').slideDown();
						});
					}
				});
				e.preventDefault();
			}
		}
	);
	
	$('#thank-you').click( function(){ hide_contact_form(); } );
}); 
 
function hide_contact_form(){
	$('.sn-box').children('.dropdown').hide();
	$('.contact-box').slideUp(
		function (){
			$('.container-box').slideDown();
		}
	);	
}

/*GA*/
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-3767298-3']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

