var site_root = 'http://www.nps.gov/webrangers/';//	Browser d-tectvar w3c = (document.getElementById) ? true : false;var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;//	Init variables - set to true on page to have them executevar is_flash = false;var is_flashnav = false;var is_index = false;var pw_key;var pw_form;if (w3c) {	document.write('<style type="text/css">#flashContent { visibility: hidden; height: 450px; } </style>');}//	Init functionfunction init() {	/* *************************************************** */	/* ****************** Flash Control ****************** */	if (hasRightVersion) {		if (is_flashnav && is_flash) {			insertFlash(flashnav_swf,130,415,"flashNavigator"); // Insert flashnav_swf			setTimeout("runActivity()",1000); // Insert activity after 1000 milliseconds (1000 milliseconds = 1 second)					} else	if (is_flashnav) {			insertFlash(flashnav_swf,130,415,"flashNavigator");					} else	if (is_flash) {			runActivity();		}	} else {		if (document.getElementById('flashContent')) {			document.getElementById('flashContent').style.visibility = 'visible';			document.getElementById('flashContent').style.height = 'auto';		}	}	/* **************** End Flash Control **************** */	/* *************************************************** */		if (location.href.indexOf('levels.html') != -1) {		setCookie('passedIntro','true');	}		if (is_index && getCookie('passedIntro') == 'true') {		insertSkipIntroButton();	}		if (document.getElementById('moreInfoRight')) {		addFeedbackListItem();		var email_friend_link = document.getElementById('moreInfoRight').getElementsByTagName('A')[0];		if (email_friend_link.lastChild.nodeValue = 'Email this activity to your friends') {			var email_li = email_friend_link.parentNode;			//document.getElementById('moreInfoRight').removeChild(email_li);			var activity_name = document.getElementsByTagName('H2')[0].firstChild.nodeValue;			//var html_2_php = email_friend_link.href.replace('.html','.php');			//email_friend_link.href = html_2_php+'?activity_url='+location.href+'&activity_name='+activity_name;			activity_name = activity_name.replace(/'/g,'');			email_friend_link.href = 'http://data2.itc.nps.gov/rangers/emailfriend.cfm'+'?activity_url='+location.href+'&activity_name='+activity_name;		}	}		if (document.getElementById('moreInfoLeft')) {		setRelatedLinks();			}		setLinks();}//	If browser is good, run onload functionif (w3c) { window.onload=init; }//	Print codefunction doPrint() {	if (window.print) {		window.print();	} else {		alert('To print this page, click on the File menu and choose Print \nor press Cntrl + P on your keyboard.');	}}//	Check password on welcome.htmlfunction loginCheck() {	var login_field = document.getElementById('login');	var pee_dub = 'park';	if (login_field.value.toLowerCase() == pee_dub) {		return true;	} else {		alert('Sorry, that password is incorrect!');		login_field.value = '';		login_field.focus();		return false;	}}//	Check form on emailfriend.cfmfunction checkSpecialChars(string_obj) {	var special_chars = new Array('#','&','"','\'',';');		var special_chars_list = "";	for (var cc=0; cc<special_chars.length; cc++) {		if (cc == (special_chars.length-1)) {			special_chars_list += special_chars[cc];		} else {			special_chars_list += special_chars[cc]+', ';		}	}		for (var aa=0; aa<string_obj.length; aa++) {		for (var bb=0; bb<special_chars.length; bb++) {			if (string_obj[aa].value.indexOf(special_chars[bb]) != -1) {				alert('Please remove special characters ('+special_chars_list+') from all entries.');				return false;			}		}	}	return true;	}function removeSpecialChars() {	var input_fields = document.getElementsByTagName('INPUT');	var textarea_fields = document.getElementsByTagName('TEXTAREA');		if (checkSpecialChars(input_fields) && checkSpecialChars(textarea_fields)) {		return true;	} else {		return false;	}}function insertSkipIntroButton() {		var infoBar_div = document.getElementById('infoBar');	var infoBar_firstChild = infoBar_div.firstChild;	//var infoBar_parent = infoBar_div.parentNode;		//var new_infoBar = document.createElement('DIV');	//new_infoBar.id = 'infoBar';		var return_p = document.createElement('P');	var return_text = document.createTextNode('Welcome back to WebRangers! You can review the introduction section again or go straight to the Levels page by clicking the button below.');		return_p.appendChild(return_text);	infoBar_div.insertBefore(return_p, infoBar_firstChild);		var preed_elem = document.createElement('P');	preed_elem.className = 'proceed';		var skip_link = document.createElement('A');	skip_link.href = 'levels.html';	preed_elem.appendChild(skip_link);		var link_text = document.createTextNode('Skip Intro Pages');	skip_link.appendChild(link_text);		//	var skip_img = document.createElement('IMG');	//	skip_img.src = 'images/skip_intro.gif';	//	skip_img.alt = 'Skip Intro Pages';	//	skip_link.appendChild(skip_img);		//infoBar_parent.replaceChild(new_infoBar,infoBar_div);		//infoBar_div.appendChild(preed_elem);		infoBar_div.insertBefore(preed_elem, infoBar_firstChild);}function setCookie(cookie_name,cookie_value) {		//format expiry date	cookie_date = new Date();	cookie_date.setTime(cookie_date.getTime() + ( 365 *24*60*60*1000));	document.cookie = cookie_name + '=' + cookie_value		+ '; expires=' + cookie_date.toGMTString() 		+ '; path=/';}function getCookie(cookie_name) {	this_cookie = null;			if (document.cookie && document.cookie.indexOf(cookie_name) != -1) {		this_cookie = document.cookie.split(cookie_name+'=');		this_cookie = this_cookie[1].split(';');	}	// alert(font_cookie);		return this_cookie;}function setLinks() {	var all_links = document.getElementsByTagName('A');	var default_params = 'toolbar=yes,status=yes,scrollbars=yes,resizable=yes,width=780,height=550';		for (var bb=0; bb<all_links.length; bb++) {				if (all_links[bb].target.toLowerCase() == 'webrangerslink') {			all_links[bb].onclick = function() {				if (this.firstChild.nodeValue.toLowerCase() == 'how to use this site') {					popupWindow(this.href, this.target, 'status=yes,scrollbars=yes,resizable=yes,width=675,height=400');					return false;				} else {					popupWindow(this.href, this.target, default_params);					return false;				}			}		}		if (all_links[bb].target.toLowerCase() == 'externallink') {			all_links[bb].onclick = function() {				if (confirm('You are about visit a page outside of the WebRangers website. Are you sure you want to continue?')) {					popupWindow(this.href, this.target, default_params);				}				return false;			}					}	}}//	Create JavaScript pop-ups for related links at the bottom of pagesfunction setRelatedLinks() {	var related_links_list = document.getElementById('moreInfoLeft');	var related_links = related_links_list.getElementsByTagName('A');	var window_params = 'location=yes,menubar=no,toolbar=yes,status=yes,scrollbars=yes,resizable=yes,width=740,height=450';		for (var aa=0; aa<related_links.length; aa++) {		related_links[aa].onclick = function() {			popupWindow(this.href, this.target, window_params);		}	}}//	Popup window codefunction popupWindow(url, target, features) {	var page_position = (parseInt(navigator.appVersion) > 3) ? 'left=0,top=0,screenX=0,screenY=0,' : "";	var popup_features = 'menubar=yes,status=yes,toolbar=yes,scrollbars=yes,resizable=yes,width=785,height=480';	if (isUndefined(features)) {		features = popup_features;	}	if (isUndefined(target)) {		target = '_blank';	}	var the_window = window.open(url, target, page_position+features);	the_window.focus();	return the_window;}function linkPopup(src, features) {	return popupWindow(src.getAttribute('href'),src.getAttribute('target') || '_blank',features);}//	Utility function [currently used in popupWindow()]function isUndefined(v) { 	//	Returns true if [v] is not defined, false otherwise	//	IE 5.0 does not support the undefined keyword, so we cannot 	//	do a direct comparison such as v===undefined.	var undef;	return v===undef;}//	End Popup window code//	FLASH PLAYER CHECK//	Checks for Flash 4,5,6,7 plug-in. This works with Netscape, Mozilla, IE Win and IE5 Mac.//	Variable [hasRightVersion] will be set to true or falsevar hasFlash2 = false;var hasFlash3 = false;var hasFlash4 = false;var hasFlash5 = false;var hasFlash6 = false;var hasFlash7 = false;var requiredVersion = 6;var maxVersion = 7;var actualVersion = 0;var hasRightVersion = false;	if (navigator.plugins) {	if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]	&& navigator.mimeTypes["application/x-shockwave-flash"] 	&& navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {				var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";		var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;		var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));				hasFlash4 = flashVersion == 4;		hasFlash5 = flashVersion == 5;		hasFlash6 = flashVersion == 6; 		hasFlash7 = flashVersion >= 7; 	}}//	Write VBScript on IE Windowsif (isIE && isWin){	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');  	document.write('on error resume next \n');  	document.write('hasFlash4 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');	document.write('hasFlash5 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');	document.write('hasFlash6 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');	document.write('hasFlash7 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');	  	document.write('</SCR' + 'IPT\> \n');}for (var i=2; i <= maxVersion; i++) {  	if (eval("hasFlash" + i) == true) {		actualVersion = i;	}}if (actualVersion >= requiredVersion) {	hasRightVersion = true;}//	End Flash Player check//	var site_bg = '#fdfaf3';//	This function returns the <object> and <embed> tags in variable [oeTags]function makeFlashTags(the_swf,the_height,the_width) {	if (hasRightVersion) {		var flashTag;		if (isIE && isWin) {			flashTag = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'			+ 'width="'+the_width+'" height="'+the_height+'"'			+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'			+ '<param name="movie" value="'+the_swf+'" />'			+ '<param name="play" value="true" />'			+ '<param name="quality" value="high" />'			+ '<param name="menu" value="false" />'			//	+ '<param name="loop" value="false" />'			//	+ '<param name="bgcolor" value="'+site_bg+'" />'			+ '</object>';		} else {			flashTag = '<embed src="'+the_swf+'"'			+ 'width="'+the_width+'" height="'+the_height+'"'			+ 'play="true"'			+ 'quality="high"'			+ 'menu="false"'			+ 'type="application/x-shockwave-flash"'			+ 'pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'			//	+ 'loop="false"'			+ '</embed>';					}		return flashTag;	}}//	This function swaps innerHTML of [the_container] with makeOETags()function insertFlash(the_swf,the_height,the_width,the_container) {	if (hasRightVersion) {		document.getElementById(the_container).style.height = the_height+'px';		document.getElementById(the_container).style.visibility = 'hidden';		document.getElementById(the_container).innerHTML = makeFlashTags(the_swf,the_height,the_width);		document.getElementById(the_container).style.visibility = 'visible';	}}//	Needed to create a "parameter-less" function to use setTimeout() in the init() functionfunction runActivity() {	insertFlash(the_swf,the_height,the_width,the_container);}function addFeedbackListItem() {	//Create Elements	var the_li = document.createElement('LI');	var the_a = document.createElement('A');	var the_img = document.createElement('IMG');	var the_text = document.createTextNode('What do you think of this activity?');		var activity_name = document.getElementsByTagName('H2')[0].firstChild.nodeValue;		//Set Element Attributres	ml_strg = 'mai'	+ 'lto'	+ ':nps_webra'	+ 'ngers'	+ '@'	+ 'np'	+ 's.go'	+ 'v';	the_a.href = ml_strg+'?subject=Feedback About ' + activity_name;	the_img.src = site_root + 'images/email_question.gif';	the_img.className = 'picLeftNoMargin';		//Append 'em	the_li.appendChild(the_a);	the_a.appendChild(the_img);	the_a.appendChild(the_text);		document.getElementById('moreInfoRight').appendChild(the_li);}var form1_1 = new Array('can','run','ship','sand','deck');var form1_2 = new Array('ask','Line','wind','hold','leaf');var form1_3 = new Array('salt','key','pot','fur','spark');var form2_1 = new Array('honor','habitat','hunt','trust','preserve');var form2_2 = new Array('Hoist','case','study','cover'); //,'view'var form2_3 = new Array('survive','Path','place','change','travel');var form3_1 = new Array('wonder','manage','leader','choice','rights');var form3_2 = new Array('protect','word','books','layer'); //,'pride'var form3_3 = new Array('volt','glare','school','story'); // 'walls'var form1_0 = new Array('salmon','eagle','bear');var form2_0 = new Array('fox','rabbit','moose');var form3_0 = new Array('horse','buffalo','owl');//Quickfill!! Click on the '.....'!!function fillFields(level_number,tour_number) {	var pw_form = document.getElementById('pwForm');	var pw_inputs = pw_form.getElementsByTagName('INPUT');		var check_these = eval('form'+level_number+'_'+tour_number);			for (var aa=0; aa<check_these.length; aa++) {		pw_inputs[aa].value = check_these[aa];	}}function passportForm(level_number,tour_number) {		var pw_form = document.getElementById('pwForm');	var pw_inputs = pw_form.getElementsByTagName('INPUT');		var check_these = eval('form'+level_number+'_'+tour_number);	var all_correct = 0;			for (var aa=0; aa<check_these.length; aa++) {		for (var bb=0; bb<pw_inputs.length; bb++) {		//alert(pw_inputs[bb].value.toLowerCase()+' == '+check_these[aa]);			if (pw_inputs[bb].value.toLowerCase() == check_these[aa].toLowerCase()) {				all_correct++;			}		}					}		if (all_correct == check_these.length) {		return true;	} else {		var error_message = 'Sorry, one or more of your Secret Words is incorrect. Please review and try again.  \n\n'		+ 'Common errors are: \n'				+ '- Misspelling \n'		+ '- Missing Words \n'		+ '- Duplicated Words \n'		+ '- Entering Secret Words from other tours \n';		alert(error_message);		return false;	}	}// The next two functions (attempt to) position the sponsors' logos at the lower left of the page// They aren't being used right nowfunction getWindowHeight() {	var windowHeight=0;		if (typeof(window.innerHeight) == 'number') {		windowHeight = window.innerHeight;			} else if (document.documentElement && document.documentElement.clientHeight) {		windowHeight = document.documentElement.clientHeight;			} else if (document.body && document.body.clientHeight) {		windowHeight=document.body.clientHeight;	}	return windowHeight;}function setFooter() {			//var windowHeight = getWindowHeight();	alert(getWindowHeight());	var footerElement = document.getElementById('sponsorsLogos');	var footerHeight = footerElement.offsetHeight;		footerElement.style.position = 'absolute';	footerElement.style.top = (getWindowHeight() - footerHeight) + 'px';}//  Added by Vijay for older HTML Name the Parkfunction MM_swapImgRestore() { //v3.0  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}function MM_preloadImages() { //v3.0  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}}function MM_findObj(n, d) { //v4.01  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);  if(!x && d.getElementById) x=d.getElementById(n); return x;}function MM_swapImage() { //v3.0  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}