$(document).ready
    (
    function()
        {
        // Call this when the DOM is ready:
        
   
	// This is tracking for google analytics and requires that prior urchin.js from google.com has been loaded.
	_uacct = "UA-1618576-1";
	urchinTracker();

        // set the background color of everything to white.
        $(document.body).css( "background", "white" );
        
        // Rewrite div header so that it wraps nav items. 
        navitems = $("#header").html();
        $.post("header.php", {  }, 
		function(data)
		{
			$("#header").html(data);
			$("#navitems").html( navitems );
		}
   	);
   	
   	// load footer into div bottom
   	$("#bottom").load("footer.php");
   	
   	// Caller puts page specific stuff at top, and we append common stuff.
   	$.post("sidebar.php", { },
		function(data)
		{
			$("#sidebar").append(data);
			
			// Rewrite fanmail content to randomly include about five of them and leave out the rest.
			// they are each in seperate paragraphs.
			
			
			var ncites = $("#fanmail").children().length;
			// alert("ncites is " + ncites );
			while( ncites > 5 )
			{
				var idx=Math.floor(Math.random()*ncites);
				// alert("idx is " + idx );
				$("#fanmail").children().eq( idx ).remove().empty();
				// alert("removed");
				
				ncites = $("#fanmail").children().length;
				// alert("ncites is " + ncites );
			}
			
		
		}
   	);
   	
   	
   	
        
        
        }
    );