$(function()
{
	$('#road').css("display","none").show(2000);
	$('#logo').css("display","none").fadeIn(2000);
	
	$('.navItem').corner("keep 10px cc:#ffffff tr tl br bl");
	
	$('.page').css("display","none");
	$('#email').css("display","none");
	
	changePage("page1content");
	
	$('#theNav li').click(function()
	{
		
		var thePageName = $(this).attr('id') + "content";
		changePage(thePageName);	
	
	});
	
	
	$('#emailClick').toggle(function()
	{
		$('#email').fadeIn();
	}, function()
	{
		$('#email').fadeOut();
	});
	
	
	
	
	//Newsletter
	$('#sendemailBtn').click(function()
	{
	
	
	
	
	
	
	
	
	
		//make theEmail the stuff in the textbox
		
		var theEmail = $('#emailtext').val();

		$('#email span').html('<img id="ajaxL" src="images/ajax-loader.gif"/>');
		$(this).fadeOut('fast');
		
		$.ajax({
		  type: "GET",
		  url: "sendMail.php?email=" + theEmail,
		  success: function(result)
		  {
		 	$('#ajaxL').fadeOut('slow', function()
		 	{
		 		$('#email p').fadeOut('slow');
		 		$('#email h2').html(result + " - click to close");
		 		$('#email').css('background','#A7E49D');
		 		$('#email').css('border-color','#3C94A9');
		 		$('#emailClick').fadeOut('slow', function()
		 		{
		 			$('#emailClick').fadeIn('slow').html("Thanks for Signing up!")
		 		});
		 		$('#email').click(function()
		 		{
		 			$(this).fadeOut('slow');
		 		
		 		});
		 		
		 	});
		  
		  	
		  }
		});

	
	});
	
	
	
});

function changePage(thePage)
{
	$('#contentContainer').fadeOut("slow", function()
	{
		var htmlOfContent = $('#'+thePage).html();
		
		$('#contentContainer').html(htmlOfContent).slideDown("slow");		
	
	});
}