function GetXmlHttpObject(){var D=null;try{D=new XMLHttpRequest();}catch(C){try{D=new ActiveXObject("Msxml2.XMLHTTP");}catch(B){try{D=new ActiveXObject("Microsoft.XMLHTTP");}catch(A){return null;}}}return D;}var xmlHttp=GetXmlHttpObject();function stateChanged(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){window.status="";eval(xmlHttp.responseText);}}function nextVELocations(H,G,F,C,A,B,E){window.status="Fetching locations...";if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}var D="get_locations.php?minx="+H+"&maxx="+F+"&miny="+G+"&maxy="+C+"&record_start="+A+"&record_limit="+B+"&site_state_abbr="+E+"&type=VE";xmlHttp.open("GET",D,true);xmlHttp.onreadystatechange=stateChanged;xmlHttp.send(null);}function nextLocationsDropDown(A,B,E,D){window.status="Populating dropdown...";if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}var C="get_location_dropdown.php?site_state_abbr="+E+"&record_start="+A+"&record_limit="+B+"&loccnt="+D;xmlHttp.open("GET",C,true);xmlHttp.onreadystatechange=stateChanged;xmlHttp.send(null);}function stateChanged(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){window.status="";eval(xmlHttp.responseText);}}function nextLocationGroup(A,B){try{window.status="Fetching locations...";var C="get_locations.php?record_start="+A+"&record_limit="+B;var D=OpenLayers.loadURL(C,null,null,requestSuccess,requestFailure);}catch(E){}}function nextLocations(B,A,J,I,E,G,C){try{window.status="Fetching locations...";var F="get_locations.php?minx="+B+"&maxx="+J+"&miny="+A+"&maxy="+I+"&record_start="+E+"&record_limit="+G+"&site_state_abbr="+C;var D=OpenLayers.loadURL(F,null,null,requestSuccess,requestFailure);}catch(H){}}function nextUSGSLocations(C,A,J,I,F,G,D){try{window.status="Fetching locations...";var B="get_usgs_locations.php?minx="+C+"&maxx="+J+"&miny="+A+"&maxy="+I+"&record_start="+F+"&record_limit="+G+"&site_state_abbr="+D;var E=OpenLayers.loadURL(B,null,null,requestSuccess,requestFailure);}catch(H){}}function nextTrips(B,A,J,I,E,F,C){try{window.status="Fetching trips...";var H="get_trip_locations.php?minx="+B+"&maxx="+J+"&miny="+A+"&maxy="+I+"&rs="+E+"&rl="+F+"&site_state_abbr="+C;if(loaded_trip_id!=null&&loaded_trip_id!=""){H+="&ex="+loaded_trip_id;}var D=OpenLayers.loadURL(H,null,null,requestSuccess,requestFailure);}catch(G){}}function nextOtherLocations(C,B,J,I,F,G,D){try{window.status="Fetching amenities...";var A="get_other_locations.php?minx="+C+"&maxx="+J+"&miny="+B+"&maxy="+I+"&record_start="+F+"&record_limit="+G+"&site_state_abbr="+D;var E=OpenLayers.loadURL(A,null,null,requestSuccess,requestFailure);}catch(H){}}function nextPano(B,A,J,I,F,G,C){try{window.status="Fetching panoramio photos...";var H="get_panoramios.php?from="+F+"&to="+G+"&minx="+B+"&miny="+A+"&maxx="+J+"&maxy="+I;var D=OpenLayers.loadURL(H,null,null,requestSuccess,requestFailure);}catch(E){}}function closeUserInfo(){if(document.getElementById("noshowinfo")){if(document.getElementById("noshowinfo").checked){window.status="Closing user box...";var A="close_user_info.php?noshowinfo=true";var B=OpenLayers.loadURL(A,null,null,requestSuccess,requestFailure);}else{document.getElementById("user_info_div").style.display="none";}}}function loadTrip(D){try{window.status="Loading trip on map...";var A="load_trip.php?trip_id="+D;var B=OpenLayers.loadURL(A,null,null,requestSuccess,requestFailure);}catch(C){}}function requestSuccess(request){var response=request.transport.responseText||"";window.status="";if(response!=""){eval(response);}}function requestFailure(A){A.transport.abort();window.status="Problem while fetching data...";}function getUserStats(D,B,A){window.status="Getting user stats...";if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}if(document.getElementById("statsdiv")){document.getElementById("statsdiv").innerHTML="Loading stats...";}var C="/get_user_stats.php?userid="+B+"&username="+D+"&exclude="+A;xmlHttp.open("GET",C,true);xmlHttp.onreadystatechange=populateStatsDiv;xmlHttp.send(null);}function populateStatsDiv(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){window.status="";if(document.getElementById("statsdiv")){document.getElementById("statsdiv").innerHTML=xmlHttp.responseText;}}}function watchTrip(C,A){var D=confirm("While watching a trip, we will send you an email notification anytime someone reviews or comments on this trip. Are you sure you want to watch this trip?");if(D==true){var F=new Date();var E=F.getTime();window.status="Subscribing to trip...";if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}if(document.getElementById("watchdiv")){document.getElementById("watchdiv").innerHTML="Processing...";}var B="watch.php?type=trip&userid="+A+"&tripid="+C+"&timestamp="+E;xmlHttp.open("GET",B,true);xmlHttp.onreadystatechange=updateWatchDiv;xmlHttp.send(null);}else{return ;}}function watchLocation(C,A){var D=confirm("While watching a location, we will send you an email notification anytime someone reviews or comments on this location. Are you sure you want to watch this location?");if(D==true){var F=new Date();var E=F.getTime();window.status="Subscribing to location...";if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}if(document.getElementById("watchdiv")){document.getElementById("watchdiv").innerHTML="Processing...";}var B="watch.php?type=location&userid="+A+"&locid="+C+"&timestamp="+E;xmlHttp.open("GET",B,true);xmlHttp.onreadystatechange=updateWatchDiv;xmlHttp.send(null);}else{return ;}}function watchSpecies(C,A){var D=confirm("While watching a species, we will send you an email notification anytime someone comments on or writes a recipe for this species. Are you sure you want to watch this species?");if(D==true){var F=new Date();var E=F.getTime();window.status="Subscribing to species...";if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}if(document.getElementById("watchdiv")){document.getElementById("watchdiv").innerHTML="Processing...";}var B="watch.php?type=species&userid="+A+"&fish_id="+C+"&timestamp="+E;xmlHttp.open("GET",B,true);xmlHttp.onreadystatechange=updateWatchDiv;xmlHttp.send(null);}else{return ;}}function stopWatchTrip(C,A){var D=confirm("Are you sure you want to stop watching this trip? You will no longer receive email notifications when someone reviews or comments on this trip.");if(D==true){var F=new Date();var E=F.getTime();window.status="Unsubscribing to trip...";if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}if(document.getElementById("watchdiv")){document.getElementById("watchdiv").innerHTML="Processing...";}var B="watch.php?type=trip&userid="+A+"&tripid="+C+"&stop=true&timestamp="+E;xmlHttp.open("GET",B,true);xmlHttp.onreadystatechange=updateWatchDiv;xmlHttp.send(null);}else{return ;}}function stopWatchLocation(C,A){var D=confirm("Are you sure you want to stop watching this location? You will no longer receive email notifications when someone reviews or comments on this location.");if(D==true){var F=new Date();var E=F.getTime();window.status="Unsubscribing to location...";if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}if(document.getElementById("watchdiv")){document.getElementById("watchdiv").innerHTML="Processing...";}var B="watch.php?type=location&userid="+A+"&locid="+C+"&stop=true&timestamp="+E;xmlHttp.open("GET",B,true);xmlHttp.onreadystatechange=updateWatchDiv;xmlHttp.send(null);}else{return ;}}function stopWatchSpecies(C,A){var D=confirm("Are you sure you want to stop watching this species? You will no longer receive email notifications when someone comments on or writes a recipe for this species.");if(D==true){var F=new Date();var E=F.getTime();window.status="Unsubscribing to species...";if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}if(document.getElementById("watchdiv")){document.getElementById("watchdiv").innerHTML="Processing...";}var B="watch.php?type=species&userid="+A+"&fish_id="+C+"&stop=true&timestamp="+E;xmlHttp.open("GET",B,true);xmlHttp.onreadystatechange=updateWatchDiv;xmlHttp.send(null);}else{return ;}}var dividtodelete;function permStopWatchTrip(C,A,G){var D=confirm("Are you sure you want to stop watching this trip? You will no longer receive email notifications when someone reviews or comments on this trip.");if(D==true){var F=new Date();var E=F.getTime();window.status="Unsubscribing to trip...";if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}if(document.getElementById(G)){document.getElementById(G).innerHTML="Processing...";dividtodelete=G;}var B="watch.php?type=trip&userid="+A+"&tripid="+C+"&stop=true&timestamp="+E;xmlHttp.open("GET",B,true);xmlHttp.onreadystatechange=deleteWatchDiv;xmlHttp.send(null);}else{return ;}}function permStopWatchLocation(C,A,G){var D=confirm("Are you sure you want to stop watching this location? You will no longer receive email notifications when someone reviews or comments on this location.");if(D==true){var F=new Date();var E=F.getTime();window.status="Unsubscribing to location...";if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}if(document.getElementById(G)){dividtodelete=G;document.getElementById(G).innerHTML="Processing...";}var B="watch.php?type=location&userid="+A+"&locid="+C+"&stop=true&timestamp="+E;xmlHttp.open("GET",B,true);xmlHttp.onreadystatechange=deleteWatchDiv;xmlHttp.send(null);}else{return ;}}function permStopWatchSpecies(C,A,G){var D=confirm("Are you sure you want to stop watching this species? You will no longer receive email notifications when someone comments on or writes a recipe for this species.");if(D==true){var F=new Date();var E=F.getTime();window.status="Unsubscribing to species...";if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}if(document.getElementById(G)){dividtodelete=G;document.getElementById(G).innerHTML="Processing...";}var B="watch.php?type=species&userid="+A+"&fish_id="+C+"&stop=true&timestamp="+E;xmlHttp.open("GET",B,true);xmlHttp.onreadystatechange=deleteWatchDiv;xmlHttp.send(null);}else{return ;}}function permStopWatchTopic(C,A,G){var D=confirm("Are you sure you want to stop watching this topic? You will no longer receive email notifications when someone replies to this message board topic.");if(D==true){var F=new Date();var E=F.getTime();window.status="Unsubscribing to topic...";if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}if(document.getElementById(G)){dividtodelete=G;document.getElementById(G).innerHTML="Processing...";}var B="watch.php?type=topic&userid="+A+"&topicid="+C+"&stop=true&timestamp="+E;xmlHttp.open("GET",B,true);xmlHttp.onreadystatechange=deleteWatchDiv;xmlHttp.send(null);}else{return ;}}function removeAllWatch(C,A,G){var D=confirm("Are you sure you want to stop watching all "+C+"s?");if(D==true){var F=new Date();var E=F.getTime();window.status="Unsubscribing to all "+C+"s...";if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}if(document.getElementById(G)){dividtodelete=G;document.getElementById(G).innerHTML="Processing...";}var B="watch.php?type="+C+"&userid="+A+"&delete_all=true&stop=true&timestamp="+E;xmlHttp.open("GET",B,true);xmlHttp.onreadystatechange=deleteWatchDiv;xmlHttp.send(null);}else{return ;}}function updateWatchDiv(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){window.status="";if(document.getElementById("watchdiv")){document.getElementById("watchdiv").innerHTML=xmlHttp.responseText;}}}function deleteWatchDiv(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){window.status="";if(document.getElementById(dividtodelete)){document.getElementById(dividtodelete).innerHTML="Successfully removed.";}}}var dividtoupdate;function ratePhoto(B,C,F){var E=new Date();var D=E.getTime();window.status="Rating photo...";if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}if(document.getElementById(F)){dividtoupdate=F;document.getElementById(F).innerHTML="Processing...";}var A="rate_photo.php?photo_id="+B+"&rating="+C+"&timestamp="+D;xmlHttp.open("GET",A,true);xmlHttp.onreadystatechange=updateRatePhotoDiv;xmlHttp.send(null);}function updateRatePhotoDiv(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){window.status="";if(document.getElementById(dividtoupdate)){document.getElementById(dividtoupdate).innerHTML=xmlHttp.responseText;}}}var commentidtoupdate;function addPhotoComment(C,A,G){var F=document.getElementById(A).value;if(F==null||F==""||F==" "){alert("Please enter a comment before continuing.");return ;}F=escape(F);var E=new Date();var D=E.getTime();window.status="Adding comment...";if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}if(document.getElementById(G)){commentidtoupdate=G;document.getElementById(G).innerHTML="Processing...";}var B="comment_photo.php?photo_id="+C+"&comment="+F+"&timestamp="+D;xmlHttp.open("GET",B,true);xmlHttp.onreadystatechange=updateCommentPhotoDiv;xmlHttp.send(null);document.getElementById("comment_photo_div_"+C).innerHTML='<font style="color:#ff0000;">Comment processed.</font>';}function updateCommentPhotoDiv(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){window.status="";if(document.getElementById(commentidtoupdate)){window.location.reload(true);}}}var quicksearchdiv;var quicksearchinput;var activeListNode=-1;var suggestList=null;var quickSearchDelay=500;var lastQuickSearch=null;function ajaxSearch(J,E,G,D,F){var H=J.keyCode;switch(H){case 37:break;case 38:if(suggestList!=null&&suggestList.hasChildNodes()){if(activeListNode-1<0){activeListNode=suggestList.childNodes.length-1;}else{activeListNode--;}for(var C=0;C<suggestList.childNodes.length;C++){if(activeListNode==C){selectedListNode=suggestList.childNodes[C];selectedListNode.style.backgroundColor="#457290";selectedListNode.childNodes[0].style.color="#FFFFFF";document.getElementById(F).value=selectedListNode.id.replace("qsearch_","");}else{suggestList.childNodes[C].style.backgroundColor="#DDDDDD";suggestList.childNodes[C].childNodes[0].style.color="#000000";}}}break;case 39:break;case 40:if(suggestList!=null&&suggestList.hasChildNodes()){if(suggestList.childNodes.length-1>activeListNode){activeListNode++;}else{activeListNode=0;}for(var C=0;C<suggestList.childNodes.length;C++){if(activeListNode==C){selectedListNode=suggestList.childNodes[C];selectedListNode.style.backgroundColor="#457290";selectedListNode.childNodes[0].style.color="#FFFFFF";document.getElementById(F).value=selectedListNode.id.replace("qsearch_","");}else{suggestList.childNodes[C].style.backgroundColor="#DDDDDD";suggestList.childNodes[C].childNodes[0].style.color="#000000";}}}break;default:var B=new Date();var I=B.getTime();if(xmlHttp==null){return ;}if(document.getElementById(D)){quicksearchdiv=D;}if(document.getElementById(F)){quicksearchinput=F;}if(G!=null&&G!=""){if(lastQuickSearch==null||(I-lastQuickSearch)>quickSearchDelay){var A="quick_search.php?type="+E+"&value="+G+"&timestamp="+I;xmlHttp.open("GET",A,true);xmlHttp.onreadystatechange=updateQuickSearchDiv;xmlHttp.send(null);lastQuickSearch=I;}}else{hideQuickSearch();}prevSearchValue=G;break;}}function updateQuickSearchDiv(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){if(document.getElementById(quicksearchdiv)&&xmlHttp.responseText!=""){showQuickSearch();document.getElementById(quicksearchdiv).innerHTML=xmlHttp.responseText;suggestList=document.getElementById(quicksearchdiv).firstChild;}else{hideQuickSearch();}}}function qSearch(A){if(document.getElementById(quicksearchinput)){document.getElementById(quicksearchinput).value=A;hideQuickSearch();}}function hideQuickSearch(){document.getElementById(quicksearchdiv).style.display="none";document.getElementById(quicksearchdiv).innerHTML="";suggestList=null;activeListNode=-1;}function showQuickSearch(){document.getElementById(quicksearchdiv).style.display="block";}function getAdvancedSearch(B){var D=new Date();var C=D.getTime();if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}var A="";if(B=="trips"){A="find_trips_advanced.php?timestamp="+C;}else{if(B=="locations"){A="find_locations_advanced.php?timestamp="+C;}}xmlHttp.open("GET",A,true);xmlHttp.onreadystatechange=updateAdvancedSearchDiv;xmlHttp.send(null);}function updateAdvancedSearchDiv(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){if(document.getElementById("advanced_search")&&xmlHttp.responseText!=""){document.getElementById("advanced_search").innerHTML=xmlHttp.responseText;}else{document.getElementById("advanced_search").innerHTML="There was a problem grabbing the advanced options.";}}}function getUSGSGraph(E,D,F,C,A){var H=new Date();var G=H.getTime();if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}var B="get_usgs_graph.php?chart_type="+E+"&siteid="+D+"&sitetitle="+F+"&chart_width="+C+"&chart_height="+A+"&timestamp="+G;xmlHttp.open("GET",B,true);xmlHttp.onreadystatechange=updateUSGSGraphDiv;xmlHttp.send(null);}function updateUSGSGraphDiv(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){if(document.getElementById("usgsGraphDiv")&&xmlHttp.responseText!=""){document.getElementById("usgsGraphDiv").innerHTML=xmlHttp.responseText;}else{document.getElementById("usgsGraphDiv").innerHTML="";}}}var userLoggedIn=false;function setUSGSDefault(B){if(userLoggedIn){var D=new Date();var C=D.getTime();if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}var A="set_usgs_default.php?siteid="+B+"&timestamp="+C;xmlHttp.open("GET",A,true);xmlHttp.onreadystatechange=setUSGSDefaultResult;xmlHttp.send(null);}else{alert("You must be logged in to set your default USGS Water Station.");}}function setUSGSDefaultResult(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){if(document.getElementById("usgsDefault")&&xmlHttp.responseText!=""){document.getElementById("usgsDefault").innerHTML=xmlHttp.responseText;}else{document.getElementById("usgsDefault").innerHTML="Error setting default USGS Water Station.";}}}var theFlagDiv;function flagItem(B,G,C,F){if(F!=null&&F!=""){theFlagDiv=document.getElementById(F);}else{theFlagDiv=document.getElementById("flagDiv");}var E=new Date();var D=E.getTime();if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}var A="flag_item.php?item_type="+B+"&item_id="+G+"&reason="+C+"&timestamp="+D;xmlHttp.open("GET",A,true);xmlHttp.onreadystatechange=updateFlagDiv;xmlHttp.send(null);}function updateFlagDiv(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){if(theFlagDiv&&xmlHttp.responseText!=""){theFlagDiv.innerHTML=xmlHttp.responseText;}else{theFlagDiv.innerHTML="Error flagging the current item.";}}}var getContentDiv;function ajaxGetContent(E,B){getContentDiv=document.getElementById(E);getContentDiv.style.display="block";var D=new Date();var C=D.getTime();if(xmlHttp==null){alert("Browser does not support HTTP Request. We recommend using Mozilla Firefox 2.0 or Internet Explorer 6+ browsers.");return ;}var A="ajax_get_content.php?type="+B+"&timestamp="+C;xmlHttp.open("GET",A,true);xmlHttp.onreadystatechange=updateAjaxContentDiv;xmlHttp.send(null);}function updateAjaxContentDiv(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){if(getContentDiv&&xmlHttp.responseText!=""){getContentDiv.innerHTML=xmlHttp.responseText;}else{getContentDiv.innerHTML="Error fetching content.";}}}