// JavaScript Document

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original:  jsCode.com -->
<!-- Web Site:  http://jscode.com -->
<!--
// ==============================================
// Copyright 2003 by jsCode.com
// Source: jsCode.com
// Author: etLux
// Free for all; but please leave in the header.
// ==============================================

// Modified to support JQuery framework and support background image of div

		var BGOutput = "";

	$(document).ready(function(){ 
		// Set up the image files to be used.
		var theImages = new Array(); // do not change this
		// To add more image files, continue with the
		// pattern below, adding to the array. Rememeber
		// to increment the theImages[x] index!

	/* Old images
		theImages[0] = 'images/titlebarometer.jpg';
		theImages[1] = 'images/titlebentsfort.jpg';
		theImages[2] = 'images/titlebuggy.jpg';
		theImages[3] = 'images/titlecircle.jpg';
		theImages[4] = 'images/titlecorinthbattery.jpg';
		theImages[5] = 'images/titlecorinthbattery1.jpg';
		theImages[6] = 'images/titlecorinthfog.jpg';
		theImages[7] = 'images/titlefremontcamp.jpg';
		theImages[8] = 'images/titlehills.jpg';
		theImages[9] = 'images/titleobservation.jpg';
		theImages[10] = 'images/titleoregontrail.jpg';
		theImages[11] = 'images/titleredwall.jpg';
		theImages[12] = 'images/titleredwallcamp.jpg';
		theImages[13] = 'images/titleredwalltents.jpg';
		theImages[14] = 'images/titleryanshillcamp.jpg';
		theImages[15] = 'images/titlewagon.jpg';
		theImages[16] = 'images/titlewagon1.jpg';
		theImages[17] = 'images/titlewagon2.jpg';
		theImages[18] = 'images/titlewagon3.jpg';
		theImages[19] = 'images/titlewagonbuggy.jpg';
		theImages[20] = 'images/titlezenith.jpg';
		theImages[21] = 'images/titleSextantTest.jpg';
	*/
		theImages[0] = '/images/titleacoma.980.jpg';
		theImages[1] = '/images/titlebarometer.980.jpg';
		theImages[2] = '/images/titlebentsfort.980.jpg';
		theImages[3] = '/images/titlebuggy.980.jpg';
		theImages[4] = '/images/titlecircle.980.jpg';
		theImages[5] = '/images/titlecorinthbattery.980.jpg';
		theImages[6] = '/images/titlecorinthbattery1.980.jpg';
		theImages[7] = '/images/titlecorinthfog.980.jpg';
		theImages[8] = '/images/titlecorinthmap.980.jpg';
		theImages[9] = '/images/titlefremontcamp.980.jpg';
		theImages[10] = '/images/titlehills.980.jpg';
		theImages[11] = '/images/titleobservation.980.jpg';
		theImages[12] = '/images/titleoregontrail.980.jpg';
		theImages[13] = '/images/titlepaloalto.980.jpg';
		theImages[14] = '/images/titlepyramidlake.980.jpg';
		theImages[15] = '/images/titleredwall.980.jpg';
		theImages[16] = '/images/titleredwallcamp.980.jpg';
		theImages[17] = '/images/titleredwalltents.980.jpg';
		theImages[18] = '/images/titleryanshillcamp.980.jpg';
		theImages[19] = '/images/titlesaber.980.jpg';
		theImages[20] = '/images/titlestation.980.jpg';
		theImages[21] = '/images/titletopogs.980.jpg';
		theImages[22] = '/images/titlewagon.980.jpg';
		theImages[23] = '/images/titlewagon1.980.jpg';
		theImages[24] = '/images/titlewagon2.980.jpg';
		theImages[25] = '/images/titlewagon3.980.jpg';
		theImages[26] = '/images/titlewagonbuggy.980.jpg';
		theImages[27] = '/images/titlezenith.980.jpg';
		theImages[28] = '/images/titlemexbndry.980.jpg';
		
		var j = 0;
		var p = theImages.length;

		var preBuffer = new Array();
		for (i = 0; i < p; i++){
			preBuffer[i] = new Image();
			preBuffer[i].src = theImages[i];
		}
		
		var ImageBuffer = new Array();
		ImageBuffer[0] = new Image();
		ImageBuffer[0].src = 'images/US Corp of Topo Engineers Logo.gif';
		ImageBuffer[1] = new Image();
		ImageBuffer[1].src = 'images/brown_w.gif';

 		var backgroundObjectID = "#HeaderArea";					 
		var whichImage = Math.round(Math.random()*(p-1));

		$(backgroundObjectID).css("background-image","url("+preBuffer[whichImage].src+")"); //change 21 to whichImage
		
     	$("#LogoArea:hidden").fadeIn(8000); 

	})

// JavaScript Document
// Float Menu
// Originally from Jeff Dion
//	http://net.tutsplus.com/html-css-techniques/creating-a-floating-html-menu-using-jquery-and-css/
//
// Modified by WJ Castor
// 	added effect to have floating menu at top of page when its initial 
//	position does not start it at that position.

	var FloatMenuID = "#MainNavigationArea";  
	var menuYloc = null;
	var DeltaDivID = "#HeaderArea";
	var deltaPosition = null;

	$(document).ready(function(){  
		menuYloc = parseInt($(FloatMenuID).css("top").substring(0,$(FloatMenuID).css("top").indexOf("px")));
		deltaPosition = parseInt($(DeltaDivID).css("height").substring(0,$(DeltaDivID).css("height").indexOf("px")));
		
		$(window).scroll(function () {
			var offset
			if( $(document).scrollTop() > deltaPosition ){  		
				offset = menuYloc+$(document).scrollTop()-deltaPosition+"px"; 
				$(FloatMenuID).animate({top:offset},{duration:0,queue:false}); 
			} else {
				$(FloatMenuID).animate({top:menuYloc},{duration:0,queue:false}); 
			}
		});  
	});
	
	// the following extends jQuery to be able to access the URL get parameters
	$.extend({
  		getUrlVars: function(){
    		var vars = [], hash;
    		var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
			
    		for(var i = 0; i < hashes.length; i++)
    		{
      			hash = hashes[i].split('=');
      			vars.push(hash[0]);
      			vars[hash[0]] = hash[1];
    		}
    		return vars;
  		},
  		getUrlVar: function(name){
    		return $.getUrlVars()[name];
  		}
	});

//-->