// JavaScript Document

	function openit(sURL, iWidth, iHeight){		
		if (!iWidth) {
			iWidth = 800;
			iHeight = 650;
		}
		newwindow=window.open(sURL,"newwin","scrollbars=yes,toolbar=no,menubar=no,resizable=yes,status=no,width=" + iWidth + ",height=" + iHeight + ",location=no");
		newwindow.focus();
		return false;
	}
	
	function savewidth() {
		// works in FireFox
		width = parent.frames[0].innerWidth;
		if (!width) {
			// works in IE
			width = document.body.clientWidth;
		}
		//alert('Width = ' + width);
		document.cookie = 'treewidth=' + width;
	}

	<!-- Borrowed (if you will) from the excellently designed http://www.commenspace.org -->
	
	function getrnum() {
		return Math.floor(Math.random() * 24);
	}
	
	function getImageCaption(rnum) {
		var imageCaption = new Array(24);
		imageCaption[0] = 'Glacier in Olympic National Park';
		imageCaption[1] = 'Cerrado fire in Brazil';
		imageCaption[2] = 'Hiking Cloudy Pass in Stehekin, North Cascades, WA';
		imageCaption[3] = 'Dead foxtail pine at 3000 m elevation in the eastern Sierra Nevada';
		imageCaption[4] = 'Upper Thunder Creek drainage, North Cascades, WA (1999 Ecoplots field work hike along Thunder Creek from Diablo Lake to Stehekin)';
		imageCaption[5] = 'Easy Pass in Upper Thunder Creek drainage, between Diablo Lake and Stehekin, North Cascades, WA';
		imageCaption[6] = 'Easy Pass in Upper Thunder Creek drainage, between Diablo Lake and Stehekin, North Cascades, WA';
		imageCaption[7] = 'Stehekin';
		imageCaption[8] = 'Looking east from Glacier Point, Yosemite National Park, at a past wildfire';
		imageCaption[9] = 'Snow-fed lake at treeline in the North Cascade Range, WA';
		imageCaption[10] = '';
		imageCaption[11] = 'High-elevation meadow in the southern Sierra Nevada';
		imageCaption[12] = '';
		imageCaption[13] = '';
		imageCaption[14] = 'Stehekin';
		imageCaption[15] = 'Stehekin';
		imageCaption[16] = 'Western flank of Ruby Mt., Upper Thunder Creek drainage, North Cascades, WA';
		imageCaption[17] = 'Western flank of Ruby Mt., Upper Thunder Creek drainage, North Cascades, WA';
		imageCaption[18] = 'Western flank of Ruby Mt., Upper Thunder Creek drainage, North Cascades, WA';
		imageCaption[19] = 'Western flank of Ruby Mt., Upper Thunder Creek drainage, North Cascades, WA';
		imageCaption[20] = '';
		imageCaption[21] = 'Five years after a high-severity fire in the East Cascade Range, WA';
		imageCaption[22] = 'Mt. Stewart and Ingalls Lake from South Ingalls Peak';
		imageCaption[23] = 'High-elevation forests in the North Cascade Range, WA';
		return imageCaption[rnum];
	}
	
	function getImageCredit(rnum) {
		var imageCredit = new Array(24);
		imageCredit[0] = '';
		imageCredit[1] = 'Roger Ottmar';
		imageCredit[2] = 'Amy Hessl';
		imageCredit[3] = 'Don McKenzie';
		imageCredit[4] = 'Erica Cline';
		imageCredit[5] = 'Erica Cline';
		imageCredit[6] = 'Erica Cline';
		imageCredit[7] = 'Amy Hessl';
		imageCredit[8] = 'Don McKenzie';
		imageCredit[9] = 'Don McKenzie';
		imageCredit[10] = 'Roger Ottmar';
		imageCredit[11] = 'Don McKenzie';
		imageCredit[12] = 'Roger Ottmar';
		imageCredit[13] = '';
		imageCredit[14] = 'Amy Hessl';
		imageCredit[15] = 'Amy Hessl';
		imageCredit[16] = 'Erica Cline';
		imageCredit[17] = 'Erica Cline';
		imageCredit[18] = 'Erica Cline';
		imageCredit[19] = 'Erica Cline';
		imageCredit[20] = 'Roger Ottmar';
		imageCredit[21] = 'Don McKenzie';
		imageCredit[22] = 'Don McKenzie';
		imageCredit[23] = 'Don McKenzie';		
		return imageCredit[rnum];
	}
	
	function getHomeImage(rnum) {
		var homeImages = new Array(24);
		homeImages[0] = 'images/slide_show/BGlacier2.jpg';
		homeImages[1] = 'images/slide_show/Brazil_cerrado_fire2b.jpg';
		homeImages[2] = 'images/slide_show/cloudypass.jpg';
		homeImages[3] = 'images/slide_show/deadwood1.jpg';
		homeImages[4] = 'images/slide_show/Easypass1.jpg';
		homeImages[5] = 'images/slide_show/Easypass3.jpg';
		homeImages[6] = 'images/slide_show/EZpass8.jpg';
		homeImages[7] = 'images/slide_show/goodeview.jpg';
		homeImages[8] = 'images/slide_show/GP_fire.jpg';
		homeImages[9] = 'images/slide_show/teanaway-ingalls2.jpg';
		homeImages[10] = 'images/slide_show/logcons4.jpg';
		homeImages[11] = 'images/slide_show/meadow.jpg';
		homeImages[12] = 'images/slide_show/Pringle.jpg';
		homeImages[13] = 'images/slide_show/ScoutLake2.jpg';
		homeImages[14] = 'images/slide_show/steh_agnes.jpg';
		homeImages[15] = 'images/slide_show/stehekin.jpg';
		homeImages[16] = 'images/slide_show/TC5.jpg';
		homeImages[17] = 'images/slide_show/TC6.jpg';
		homeImages[18] = 'images/slide_show/TC13.jpg';
		homeImages[19] = 'images/slide_show/TC15.jpg';
		homeImages[20] = 'images/slide_show/Wildfir2pc.jpg';
		homeImages[21] = 'images/slide_show/icicle-fire1.jpg';
		homeImages[22] = 'images/slide_show/stewart-from-ingalls.jpg';
		homeImages[23] = 'images/slide_show/teanaway-ingalls1.jpg';		
		return homeImages[rnum];
	}

	function clearForm(oForm) {
		// From: http://www.javascript-coder.com/javascript-form/javascript-reset-form.htm    
		var elements = oForm.elements; 
		oForm.reset();
		
		for(i=0; i<elements.length; i++) {			  
			field_type = elements[i].type.toLowerCase();
			
			switch(field_type) {
			
				case "text": 
				case "password": 
				case "textarea":
					case "hidden":	
					
					elements[i].value = ""; 
					break;
				
				case "radio":
				case "checkbox":
					if (elements[i].checked) {
						elements[i].checked = false; 
					}
					break;
		
				case "select-one":
				case "select-multi":
							elements[i].selectedIndex = -1;
					break;
		
				default: 
					break;		
			} // switch
		}  // for
	} // function clearForm
