
var debugOn=false;function debug(aMsg){}
var server = "http://wnm.mapping-online.com";var service="WI_mapper";var url=server+"/servlet/com.esri.esrimap.Esrimap?ServiceName="+service+"&Form=False&ClientVersion=4.0";var top=220;var left=10;var width=540;var height=440;var border=23;var mapDivId='imagestack_1';var idLeft=0;var idTop=0;var isNav=(window.navigator.appName.toLowerCase().indexOf("netscape")>=0);var isIE=(window.navigator.appName.toLowerCase().indexOf("microsoft")>=0);var isWorking=false;var minx,miny,maxx,maxy;var zoomDir='zoomin';var zooming=false;var working=true;var sCode;var color;var theAXL;var donewithCoords;var EndangeredAXL;var showRange=false;var rangeMap='';var speciesArrayIndex=0;var speciesArray=new Array();var ETspeciesArrayIndex=0;var ETspeciesArray=new Array();var colorArrayIndex=0;var activeColors=new Array();var colorArray=new Array();colorArray[0]="245,0,255";colorArray[1]="255,247,22";colorArray[2]="232,11,19";colorArray[3]="3,12,232";colorArray[4]="1,255,244";colorArray[5]="148,140,255";colorArray[6]="155,92,204";colorArray[7]="96,23,153";colorArray[8]="255,245,205";colorArray[9]="204,155,92";colorArray[10]="251,176,197";colorArray[11]="255,191,0";colorArray[12]="255,229,30";colorArray[13]="0,128,128";colorArray[14]="128,0,128";colorArray[15]="128,128,128";colorArray[16]="0,128,0";colorArray[17]="128,0,0";colorArray[18]="128,128,0";colorArray[19]="192,192,192";String.prototype.startsWith=function(s){return this.indexOf(s)==0;}
var Prototype={Version:'1.4.0',ScriptFragment:'(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',emptyFunction:function(){},K:function(x){return x}}
var Class={create:function(){return function(){this.initialize.apply(this,arguments);}}}
var Abstract=new Object();Object.extend=function(destination,source){for(property in source){destination[property]=source[property];}
return destination;}
Object.inspect=function(object){try{if(object==undefined)return'undefined';if(object==null)return'null';return object.inspect?object.inspect():object.toString();}catch(e){if(e instanceof RangeError)return'...';throw e;}}
Function.prototype.bind=function(){var __method=this,args=$A(arguments),object=args.shift();return function(){try{return __method.apply(object,args.concat($A(arguments)));}catch(e){return false;}}}
Function.prototype.bindAsEventListener=function(object){var __method=this;return function(event){return __method.call(object,event||window.event);}}
Object.extend(Number.prototype,{toColorPart:function(){var digits=this.toString(16);if(this<16)return'0'+digits;return digits;},succ:function(){return this+1;},times:function(iterator){$R(0,this,true).each(iterator);return this;}});var Try={these:function(){var returnValue;for(var i=0;i<arguments.length;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}
return returnValue;}}
var PeriodicalExecuter=Class.create();PeriodicalExecuter.prototype={initialize:function(callback,frequency){this.callback=callback;this.frequency=frequency;this.currentlyExecuting=false;this.registerCallback();},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.callback();}finally{this.currentlyExecuting=false;}}}}
function $(){var elements=new Array();for(var i=0;i<arguments.length;i++){var element=arguments[i];if(typeof element=='string')
element=document.getElementById(element);if(arguments.length==1)
return element;elements.push(element);}
return elements;}
Object.extend(String.prototype,{stripTags:function(){return this.replace(/<\/?[^>]+>/gi,'');},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,'img'),'');},extractScripts:function(){var matchAll=new RegExp(Prototype.ScriptFragment,'img');var matchOne=new RegExp(Prototype.ScriptFragment,'im');return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||['',''])[1];});},evalScripts:function(){return this.extractScripts().map(eval);},escapeHTML:function(){var div=document.createElement('div');var text=document.createTextNode(this);div.appendChild(text);return div.innerHTML;},unescapeHTML:function(){var div=document.createElement('div');div.innerHTML=this.stripTags();return div.childNodes[0]?div.childNodes[0].nodeValue:'';},toQueryParams:function(){var pairs=this.match(/^\??(.*)$/)[1].split('&');return pairs.inject({},function(params,pairString){var pair=pairString.split('=');params[pair[0]]=pair[1];return params;});},toArray:function(){return this.split('');},camelize:function(){var oStringList=this.split('-');if(oStringList.length==1)return oStringList[0];var camelizedString=this.indexOf('-')==0?oStringList[0].charAt(0).toUpperCase()+oStringList[0].substring(1):oStringList[0];for(var i=1,len=oStringList.length;i<len;i++){var s=oStringList[i];camelizedString+=s.charAt(0).toUpperCase()+s.substring(1);}
return camelizedString;},inspect:function(){return"'"+this.replace('\\','\\\\').replace("'",'\\\'')+"'";}});String.prototype.parseQuery=String.prototype.toQueryParams;var $break=new Object();var $continue=new Object();var Enumerable={each:function(iterator){var index=0;try{this._each(function(value){try{iterator(value,index++);}catch(e){if(e!=$continue)throw e;}});}catch(e){if(e!=$break)throw e;}},all:function(iterator){var result=true;this.each(function(value,index){result=result&&!!(iterator||Prototype.K)(value,index);if(!result)throw $break;});return result;},any:function(iterator){var result=true;this.each(function(value,index){if(result=!!(iterator||Prototype.K)(value,index))
throw $break;});return result;},collect:function(iterator){var results=[];this.each(function(value,index){results.push(iterator(value,index));});return results;},detect:function(iterator){var result;this.each(function(value,index){if(iterator(value,index)){result=value;throw $break;}});return result;},findAll:function(iterator){var results=[];this.each(function(value,index){if(iterator(value,index))
results.push(value);});return results;},grep:function(pattern,iterator){var results=[];this.each(function(value,index){var stringValue=value.toString();if(stringValue.match(pattern))
results.push((iterator||Prototype.K)(value,index));})
return results;},include:function(object){var found=false;this.each(function(value){if(value==object){found=true;throw $break;}});return found;},inject:function(memo,iterator){this.each(function(value,index){memo=iterator(memo,value,index);});return memo;},invoke:function(method){var args=$A(arguments).slice(1);return this.collect(function(value){return value[method].apply(value,args);});},max:function(iterator){var result;this.each(function(value,index){value=(iterator||Prototype.K)(value,index);if(value>=(result||value))
result=value;});return result;},min:function(iterator){var result;this.each(function(value,index){value=(iterator||Prototype.K)(value,index);if(value<=(result||value))
result=value;});return result;},partition:function(iterator){var trues=[],falses=[];this.each(function(value,index){((iterator||Prototype.K)(value,index)?trues:falses).push(value);});return[trues,falses];},pluck:function(property){var results=[];this.each(function(value,index){results.push(value[property]);});return results;},reject:function(iterator){var results=[];this.each(function(value,index){if(!iterator(value,index))
results.push(value);});return results;},sortBy:function(iterator){return this.collect(function(value,index){return{value:value,criteria:iterator(value,index)};}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0;}).pluck('value');},toArray:function(){return this.collect(Prototype.K);},zip:function(){var iterator=Prototype.K,args=$A(arguments);if(typeof args.last()=='function')
iterator=args.pop();var collections=[this].concat(args).map($A);return this.map(function(value,index){iterator(value=collections.pluck(index));return value;});},inspect:function(){return'#<Enumerable:'+this.toArray().inspect()+'>';}}
Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray});var $A=Array.from=function(iterable){if(!iterable)return[];if(iterable.toArray){return iterable.toArray();}else{var results=[];for(var i=0;i<iterable.length;i++)
results.push(iterable[i]);return results;}}
Object.extend(Array.prototype,Enumerable);Array.prototype._reverse=Array.prototype.reverse;Object.extend(Array.prototype,{_each:function(iterator){for(var i=0;i<this.length;i++)
iterator(this[i]);},clear:function(){this.length=0;return this;},first:function(){return this[0];},last:function(){return this[this.length-1];},compact:function(){return this.select(function(value){return value!=undefined||value!=null;});},flatten:function(){return this.inject([],function(array,value){return array.concat(value.constructor==Array?value.flatten():[value]);});},without:function(){var values=$A(arguments);return this.select(function(value){return!values.include(value);});},indexOf:function(object){for(var i=0;i<this.length;i++)
if(this[i]==object)return i;return-1;},reverse:function(inline){return(inline!==false?this:this.toArray())._reverse();},shift:function(){var result=this[0];for(var i=0;i<this.length-1;i++)
this[i]=this[i+1];this.length--;return result;},inspect:function(){return'['+this.map(Object.inspect).join(', ')+']';}});var Hash={_each:function(iterator){for(key in this){var value=this[key];if(typeof value=='function')continue;var pair=[key,value];pair.key=key;pair.value=value;iterator(pair);}},keys:function(){return this.pluck('key');},values:function(){return this.pluck('value');},merge:function(hash){return $H(hash).inject($H(this),function(mergedHash,pair){mergedHash[pair.key]=pair.value;return mergedHash;});},toQueryString:function(){return this.map(function(pair){return pair.map(encodeURIComponent).join('=');}).join('&');},inspect:function(){return'#<Hash:{'+this.map(function(pair){return pair.map(Object.inspect).join(': ');}).join(', ')+'}>';}}
function $H(object){var hash=Object.extend({},object||{});Object.extend(hash,Enumerable);Object.extend(hash,Hash);return hash;}
ObjectRange=Class.create();Object.extend(ObjectRange.prototype,Enumerable);Object.extend(ObjectRange.prototype,{initialize:function(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive;},_each:function(iterator){var value=this.start;do{iterator(value);value=value.succ();}while(this.include(value));},include:function(value){if(value<this.start)
return false;if(this.exclusive)
return value<this.end;return value<=this.end;}});var $R=function(start,end,exclusive){return new ObjectRange(start,end,exclusive);}
var Ajax={getTransport:function(){return Try.these(function(){return new ActiveXObject('Msxml2.XMLHTTP')},function(){return new ActiveXObject('Microsoft.XMLHTTP')},function(){return new XMLHttpRequest()})||false;},activeRequestCount:0}
Ajax.Responders={responders:[],_each:function(iterator){this.responders._each(iterator);},register:function(responderToAdd){if(!this.include(responderToAdd))
this.responders.push(responderToAdd);},unregister:function(responderToRemove){this.responders=this.responders.without(responderToRemove);},dispatch:function(callback,request,transport,json){this.each(function(responder){if(responder[callback]&&typeof responder[callback]=='function'){try{responder[callback].apply(responder,[request,transport,json]);}catch(e){}}});}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++;},onComplete:function(){Ajax.activeRequestCount--;}});Ajax.Base=function(){};Ajax.Base.prototype={setOptions:function(options){this.options={method:'post',asynchronous:true,parameters:''}
Object.extend(this.options,options||{});},responseIsSuccess:function(){return this.transport.status==undefined||this.transport.status==0||(this.transport.status>=200&&this.transport.status<300);},responseIsFailure:function(){return!this.responseIsSuccess();}}
Ajax.Request=Class.create();Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Request.prototype=Object.extend(new Ajax.Base(),{initialize:function(url,options){this.transport=Ajax.getTransport();this.setOptions(options);this.request(url);},request:function(url){var parameters=this.options.parameters||'';if(parameters.length>0)parameters+='&_=';try{this.url=url;if(this.options.method=='get'&&parameters.length>0)
this.url+=(this.url.match(/\?/)?'&':'?')+parameters;Ajax.Responders.dispatch('onCreate',this,this.transport);this.transport.open(this.options.method,this.url,this.options.asynchronous);if(this.options.asynchronous){this.transport.onreadystatechange=this.onStateChange.bind(this);setTimeout((function(){this.respondToReadyState(1)}).bind(this),10);}
this.setRequestHeaders();var body=this.options.postBody?this.options.postBody:parameters;this.transport.send(this.options.method=='post'?body:null);}catch(e){this.dispatchException(e);}},setRequestHeaders:function(){var requestHeaders=['X-Requested-With','XMLHttpRequest','X-Prototype-Version',Prototype.Version];if(this.options.method=='post'){requestHeaders.push('Content-type','application/x-www-form-urlencoded');if(this.transport.overrideMimeType)
requestHeaders.push('Connection','close');}
if(this.options.requestHeaders)
requestHeaders.push.apply(requestHeaders,this.options.requestHeaders);for(var i=0;i<requestHeaders.length;i+=2)
this.transport.setRequestHeader(requestHeaders[i],requestHeaders[i+1]);},onStateChange:function(){var readyState=this.transport.readyState;if(readyState!=1)
this.respondToReadyState(this.transport.readyState);},header:function(name){try{return this.transport.getResponseHeader(name);}catch(e){}},evalJSON:function(){try{return eval(this.header('X-JSON'));}catch(e){}},evalResponse:function(){try{return eval(this.transport.responseText);}catch(e){this.dispatchException(e);}},respondToReadyState:function(readyState){var event=Ajax.Request.Events[readyState];var transport=this.transport,json=this.evalJSON();if(event=='Complete'){try{(this.options['on'+this.transport.status]||this.options['on'+(this.responseIsSuccess()?'Success':'Failure')]||Prototype.emptyFunction)(transport,json);}catch(e){this.dispatchException(e);}
if((this.header('Content-type')||'').match(/^text\/javascript/i))
this.evalResponse();}
try{(this.options['on'+event]||Prototype.emptyFunction)(transport,json);Ajax.Responders.dispatch('on'+event,this,transport,json);}catch(e){this.dispatchException(e);}
if(event=='Complete')
this.transport.onreadystatechange=Prototype.emptyFunction;},dispatchException:function(exception){(this.options.onException||Prototype.emptyFunction)(this,exception);Ajax.Responders.dispatch('onException',this,exception);}});Ajax.Updater=Class.create();Object.extend(Object.extend(Ajax.Updater.prototype,Ajax.Request.prototype),{initialize:function(container,url,options){this.containers={success:container.success?$(container.success):$(container),failure:container.failure?$(container.failure):(container.success?null:$(container))}
this.transport=Ajax.getTransport();this.setOptions(options);var onComplete=this.options.onComplete||Prototype.emptyFunction;this.options.onComplete=(function(transport,object){this.updateContent();onComplete(transport,object);}).bind(this);this.request(url);},updateContent:function(){var receiver=this.responseIsSuccess()?this.containers.success:this.containers.failure;var response=this.transport.responseText;if(!this.options.evalScripts)
response=response.stripScripts();if(receiver){if(this.options.insertion){new this.options.insertion(receiver,response);}else{Element.update(receiver,response);}}
if(this.responseIsSuccess()){if(this.onComplete)
setTimeout(this.onComplete.bind(this),10);}}});Ajax.PeriodicalUpdater=Class.create();Ajax.PeriodicalUpdater.prototype=Object.extend(new Ajax.Base(),{initialize:function(container,url,options){this.setOptions(options);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=container;this.url=url;this.start();},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent();},stop:function(){this.updater.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments);},updateComplete:function(request){if(this.options.decay){this.decay=(request.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=request.responseText;}
this.timer=setTimeout(this.onTimerEvent.bind(this),this.decay*this.frequency*1000);},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options);}});document.getElementsByClassName=function(className,parentElement){var children=($(parentElement)||document.body).getElementsByTagName('*');return $A(children).inject([],function(elements,child){if(child.className.match(new RegExp("(^|\\s)"+className+"(\\s|$)")))
elements.push(child);return elements;});}
if(!window.Element){var Element=new Object();}
Object.extend(Element,{visible:function(element){return $(element).style.display!='none';},toggle:function(){for(var i=0;i<arguments.length;i++){var element=$(arguments[i]);Element[Element.visible(element)?'hide':'show'](element);}},hide:function(){for(var i=0;i<arguments.length;i++){var element=$(arguments[i]);element.style.display='none';}},show:function(){for(var i=0;i<arguments.length;i++){var element=$(arguments[i]);element.style.display='';}},remove:function(element){element=$(element);element.parentNode.removeChild(element);},update:function(element,html){$(element).innerHTML=html.stripScripts();setTimeout(function(){html.evalScripts()},10);},getHeight:function(element){element=$(element);return element.offsetHeight;},classNames:function(element){return new Element.ClassNames(element);},hasClassName:function(element,className){if(!(element=$(element)))return;return Element.classNames(element).include(className);},addClassName:function(element,className){if(!(element=$(element)))return;return Element.classNames(element).add(className);},removeClassName:function(element,className){if(!(element=$(element)))return;return Element.classNames(element).remove(className);},cleanWhitespace:function(element){element=$(element);for(var i=0;i<element.childNodes.length;i++){var node=element.childNodes[i];if(node.nodeType==3&&!/\S/.test(node.nodeValue))
Element.remove(node);}},empty:function(element){return $(element).innerHTML.match(/^\s*$/);},scrollTo:function(element){element=$(element);var x=element.x?element.x:element.offsetLeft,y=element.y?element.y:element.offsetTop;window.scrollTo(x,y);},getStyle:function(element,style){element=$(element);var value=element.style[style.camelize()];if(!value){if(document.defaultView&&document.defaultView.getComputedStyle){var css=document.defaultView.getComputedStyle(element,null);value=css?css.getPropertyValue(style):null;}else if(element.currentStyle){value=element.currentStyle[style.camelize()];}}
if(window.opera&&['left','top','right','bottom'].include(style))
if(Element.getStyle(element,'position')=='static')value='auto';return value=='auto'?null:value;},setStyle:function(element,style){element=$(element);for(name in style)
element.style[name.camelize()]=style[name];},getDimensions:function(element){element=$(element);if(Element.getStyle(element,'display')!='none')
return{width:element.offsetWidth,height:element.offsetHeight};var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;els.visibility='hidden';els.position='absolute';els.display='';var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display='none';els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight};},makePositioned:function(element){element=$(element);var pos=Element.getStyle(element,'position');if(pos=='static'||!pos){element._madePositioned=true;element.style.position='relative';if(window.opera){element.style.top=0;element.style.left=0;}}},undoPositioned:function(element){element=$(element);if(element._madePositioned){element._madePositioned=undefined;element.style.position=element.style.top=element.style.left=element.style.bottom=element.style.right='';}},makeClipping:function(element){element=$(element);if(element._overflow)return;element._overflow=element.style.overflow;if((Element.getStyle(element,'overflow')||'visible')!='hidden')
element.style.overflow='hidden';},undoClipping:function(element){element=$(element);if(element._overflow)return;element.style.overflow=element._overflow;element._overflow=undefined;}});var Toggle=new Object();Toggle.display=Element.toggle;Abstract.Insertion=function(adjacency){this.adjacency=adjacency;}
Abstract.Insertion.prototype={initialize:function(element,content){this.element=$(element);this.content=content.stripScripts();if(this.adjacency&&this.element.insertAdjacentHTML){try{this.element.insertAdjacentHTML(this.adjacency,this.content);}catch(e){if(this.element.tagName.toLowerCase()=='tbody'){this.insertContent(this.contentFromAnonymousTable());}else{throw e;}}}else{this.range=this.element.ownerDocument.createRange();if(this.initializeRange)this.initializeRange();this.insertContent([this.range.createContextualFragment(this.content)]);}
setTimeout(function(){content.evalScripts()},10);},contentFromAnonymousTable:function(){var div=document.createElement('div');div.innerHTML='<table><tbody>'+this.content+'</tbody></table>';return $A(div.childNodes[0].childNodes[0].childNodes);}}
var Insertion=new Object();Insertion.Before=Class.create();Insertion.Before.prototype=Object.extend(new Abstract.Insertion('beforeBegin'),{initializeRange:function(){this.range.setStartBefore(this.element);},insertContent:function(fragments){fragments.each((function(fragment){this.element.parentNode.insertBefore(fragment,this.element);}).bind(this));}});Insertion.Top=Class.create();Insertion.Top.prototype=Object.extend(new Abstract.Insertion('afterBegin'),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(true);},insertContent:function(fragments){fragments.reverse(false).each((function(fragment){this.element.insertBefore(fragment,this.element.firstChild);}).bind(this));}});Insertion.Bottom=Class.create();Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion('beforeEnd'),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(this.element);},insertContent:function(fragments){fragments.each((function(fragment){this.element.appendChild(fragment);}).bind(this));}});Insertion.After=Class.create();Insertion.After.prototype=Object.extend(new Abstract.Insertion('afterEnd'),{initializeRange:function(){this.range.setStartAfter(this.element);},insertContent:function(fragments){fragments.each((function(fragment){this.element.parentNode.insertBefore(fragment,this.element.nextSibling);}).bind(this));}});Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(element){this.element=$(element);},_each:function(iterator){this.element.className.split(/\s+/).select(function(name){return name.length>0;})._each(iterator);},set:function(className){this.element.className=className;},add:function(classNameToAdd){if(this.include(classNameToAdd))return;this.set(this.toArray().concat(classNameToAdd).join(' '));},remove:function(classNameToRemove){if(!this.include(classNameToRemove))return;this.set(this.select(function(className){return className!=classNameToRemove;}).join(' '));},toString:function(){return this.toArray().join(' ');}}
Object.extend(Element.ClassNames.prototype,Enumerable);var Field={clear:function(){for(var i=0;i<arguments.length;i++)
$(arguments[i]).value='';},focus:function(element){$(element).focus();},present:function(){for(var i=0;i<arguments.length;i++)
if($(arguments[i]).value=='')return false;return true;},select:function(element){$(element).select();},activate:function(element){element=$(element);element.focus();if(element.select)
element.select();}}
var Form={serialize:function(form){var elements=Form.getElements($(form));var queryComponents=new Array();for(var i=0;i<elements.length;i++){var queryComponent=Form.Element.serialize(elements[i]);if(queryComponent)
queryComponents.push(queryComponent);}
return queryComponents.join('&');},getElements:function(form){form=$(form);var elements=new Array();for(tagName in Form.Element.Serializers){var tagElements=form.getElementsByTagName(tagName);for(var j=0;j<tagElements.length;j++)
elements.push(tagElements[j]);}
return elements;},getInputs:function(form,typeName,name){form=$(form);var inputs=form.getElementsByTagName('input');if(!typeName&&!name)
return inputs;var matchingInputs=new Array();for(var i=0;i<inputs.length;i++){var input=inputs[i];if((typeName&&input.type!=typeName)||(name&&input.name!=name))
continue;matchingInputs.push(input);}
return matchingInputs;},disable:function(form){var elements=Form.getElements(form);for(var i=0;i<elements.length;i++){var element=elements[i];element.blur();element.disabled='true';}},enable:function(form){var elements=Form.getElements(form);for(var i=0;i<elements.length;i++){var element=elements[i];element.disabled='';}},findFirstElement:function(form){return Form.getElements(form).find(function(element){return element.type!='hidden'&&!element.disabled&&['input','select','textarea'].include(element.tagName.toLowerCase());});},focusFirstElement:function(form){Field.activate(Form.findFirstElement(form));},reset:function(form){$(form).reset();}}
Form.Element={serialize:function(element){element=$(element);var method=element.tagName.toLowerCase();var parameter=Form.Element.Serializers[method](element);if(parameter){var key=encodeURIComponent(parameter[0]);if(key.length==0)return;if(parameter[1].constructor!=Array)
parameter[1]=[parameter[1]];return parameter[1].map(function(value){return key+'='+encodeURIComponent(value);}).join('&');}},getValue:function(element){element=$(element);var method=element.tagName.toLowerCase();var parameter=Form.Element.Serializers[method](element);if(parameter)
return parameter[1];}}
Form.Element.Serializers={input:function(element){switch(element.type.toLowerCase()){case'submit':case'hidden':case'password':case'text':return Form.Element.Serializers.textarea(element);case'checkbox':case'radio':return Form.Element.Serializers.inputSelector(element);}
return false;},inputSelector:function(element){if(element.checked)
return[element.name,element.value];},textarea:function(element){return[element.name,element.value];},select:function(element){return Form.Element.Serializers[element.type=='select-one'?'selectOne':'selectMany'](element);},selectOne:function(element){var value='',opt,index=element.selectedIndex;if(index>=0){opt=element.options[index];value=opt.value;if(!value&&!('value'in opt))
value=opt.text;}
return[element.name,value];},selectMany:function(element){var value=new Array();for(var i=0;i<element.length;i++){var opt=element.options[i];if(opt.selected){var optValue=opt.value;if(!optValue&&!('value'in opt))
optValue=opt.text;value.push(optValue);}}
return[element.name,value];}}
var $F=Form.Element.getValue;Abstract.TimedObserver=function(){}
Abstract.TimedObserver.prototype={initialize:function(element,frequency,callback){this.frequency=frequency;this.element=$(element);this.callback=callback;this.lastValue=this.getValue();this.registerCallback();},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},onTimerEvent:function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=value;}}}
Form.Element.Observer=Class.create();Form.Element.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.Element.getValue(this.element);}});Form.Observer=Class.create();Form.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.serialize(this.element);}});Abstract.EventObserver=function(){}
Abstract.EventObserver.prototype={initialize:function(element,callback){this.element=$(element);this.callback=callback;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=='form')
this.registerFormCallbacks();else
this.registerCallback(this.element);},onElementEvent:function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=value;}},registerFormCallbacks:function(){var elements=Form.getElements(this.element);for(var i=0;i<elements.length;i++)
this.registerCallback(elements[i]);},registerCallback:function(element){if(element.type){switch(element.type.toLowerCase()){case'checkbox':case'radio':Event.observe(element,'click',this.onElementEvent.bind(this));break;case'password':case'text':case'textarea':case'select-one':case'select-multiple':Event.observe(element,'change',this.onElementEvent.bind(this));break;}}}}
Form.Element.EventObserver=Class.create();Form.Element.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.Element.getValue(this.element);}});Form.EventObserver=Class.create();Form.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.serialize(this.element);}});if(!window.Event){var Event=new Object();}
Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(event){return event.target||event.srcElement;},isLeftClick:function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)));},pointerX:function(event){return event.pageX||(event.clientX+
(document.documentElement.scrollLeft||document.body.scrollLeft));},pointerY:function(event){return event.pageY||(event.clientY+
(document.documentElement.scrollTop||document.body.scrollTop));},stop:function(event){if(event.preventDefault){event.preventDefault();event.stopPropagation();}else{event.returnValue=false;event.cancelBubble=true;}},findElement:function(event,tagName){var element=Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase())))
element=element.parentNode;return element;},observers:false,_observeAndCache:function(element,name,observer,useCapture){if(!this.observers)this.observers=[];if(element.addEventListener){this.observers.push([element,name,observer,useCapture]);element.addEventListener(name,observer,useCapture);}else if(element.attachEvent){this.observers.push([element,name,observer,useCapture]);element.attachEvent('on'+name,observer);}},unloadCache:function(){if(!Event.observers)return;for(var i=0;i<Event.observers.length;i++){Event.stopObserving.apply(this,Event.observers[i]);Event.observers[i][0]=null;}
Event.observers=false;},observe:function(element,name,observer,useCapture){var element=$(element);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent))
name='keydown';this._observeAndCache(element,name,observer,useCapture);},stopObserving:function(element,name,observer,useCapture){var element=$(element);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.detachEvent))
name='keydown';if(element.removeEventListener){element.removeEventListener(name,observer,useCapture);}else if(element.detachEvent){element.detachEvent('on'+name,observer);}}});Event.observe(window,'unload',Event.unloadCache,false);var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;},realOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.scrollTop||0;valueL+=element.scrollLeft||0;element=element.parentNode;}while(element);return[valueL,valueT];},cumulativeOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;}while(element);return[valueL,valueT];},positionedOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;if(element){p=Element.getStyle(element,'position');if(p=='relative'||p=='absolute')break;}}while(element);return[valueL,valueT];},offsetParent:function(element){if(element.offsetParent)return element.offsetParent;if(element==document.body)return element;while((element=element.parentNode)&&element!=document.body)
if(Element.getStyle(element,'position')!='static')
return element;return document.body;},within:function(element,x,y){if(this.includeScrollOffsets)
return this.withinIncludingScrolloffsets(element,x,y);this.xcomp=x;this.ycomp=y;this.offset=this.cumulativeOffset(element);return(y>=this.offset[1]&&y<this.offset[1]+element.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+element.offsetWidth);},withinIncludingScrolloffsets:function(element,x,y){var offsetcache=this.realOffset(element);this.xcomp=x+offsetcache[0]-this.deltaX;this.ycomp=y+offsetcache[1]-this.deltaY;this.offset=this.cumulativeOffset(element);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+element.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+element.offsetWidth);},overlap:function(mode,element){if(!mode)return 0;if(mode=='vertical')
return((this.offset[1]+element.offsetHeight)-this.ycomp)/element.offsetHeight;if(mode=='horizontal')
return((this.offset[0]+element.offsetWidth)-this.xcomp)/element.offsetWidth;},clone:function(source,target){source=$(source);target=$(target);target.style.position='absolute';var offsets=this.cumulativeOffset(source);target.style.top=offsets[1]+'px';target.style.left=offsets[0]+'px';target.style.width=source.offsetWidth+'px';target.style.height=source.offsetHeight+'px';},page:function(forElement){var valueT=0,valueL=0;var element=forElement;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)
if(Element.getStyle(element,'position')=='absolute')break;}while(element=element.offsetParent);element=forElement;do{valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;}while(element=element.parentNode);return[valueL,valueT];},clone:function(source,target){var options=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{})
source=$(source);var p=Position.page(source);target=$(target);var delta=[0,0];var parent=null;if(Element.getStyle(target,'position')=='absolute'){parent=Position.offsetParent(target);delta=Position.page(parent);}
if(parent==document.body){delta[0]-=document.body.offsetLeft;delta[1]-=document.body.offsetTop;}
if(options.setLeft)target.style.left=(p[0]-delta[0]+options.offsetLeft)+'px';if(options.setTop)target.style.top=(p[1]-delta[1]+options.offsetTop)+'px';if(options.setWidth)target.style.width=source.offsetWidth+'px';if(options.setHeight)target.style.height=source.offsetHeight+'px';},absolutize:function(element){element=$(element);if(element.style.position=='absolute')return;Position.prepare();var offsets=Position.positionedOffset(element);var top=offsets[1];var left=offsets[0];var width=element.clientWidth;var height=element.clientHeight;element._originalLeft=left-parseFloat(element.style.left||0);element._originalTop=top-parseFloat(element.style.top||0);element._originalWidth=element.style.width;element._originalHeight=element.style.height;element.style.position='absolute';element.style.top=top+'px';;element.style.left=left+'px';;element.style.width=width+'px';;element.style.height=height+'px';;},relativize:function(element){element=$(element);if(element.style.position=='relative')return;Position.prepare();element.style.position='relative';var top=parseFloat(element.style.top||0)-(element._originalTop||0);var left=parseFloat(element.style.left||0)-(element._originalLeft||0);element.style.top=top+'px';element.style.left=left+'px';element.style.height=element._originalHeight;element.style.width=element._originalWidth;}}
if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){Position.cumulativeOffset=function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)
if(Element.getStyle(element,'position')=='absolute')break;element=element.offsetParent;}while(element);return[valueL,valueT];}}
var theX,theY;var x1,y1,x2,y2;var zleft,zright,ztop,zbottom;var mtop,mleft,mwidth,mheight,mbroder;var mapDivId;var activeTool;var dragging=false;var panning=false;var waitingForResponse=false;mwidth=480;mheight=390;var fullminx,fullmaxx,fullminy,fullmaxy;function createZoomBoxDivs(){createLayer("zoomboxTop",mleft,mtop,mwidth,mheight,false,"");createLayer("zoomboxBottom",mleft,mtop,mwidth,mheight,false,"");createLayer("zoomboxLeft",mleft,mtop,mwidth,mheight,false,"");createLayer("zoomboxRight",mleft,mtop,mwidth,mheight,false,"");setLayerBackgroundColor("zoomboxTop","blue");setLayerBackgroundColor("zoomboxBottom","blue");setLayerBackgroundColor("zoomboxLeft","blue");setLayerBackgroundColor("zoomboxRight","blue");}
function createLayer(name,inleft,intop,width,height,visible,content){document.writeln('<div id="'+name+'" style="position:absolute; overflow:hidden; left:'+inleft+'px; top:'+intop+'px; width:'+width+'px; height:'+height+'px;'+'; z-index:1; visibility:'+(visible?'visible;':'hidden;')+'">');document.writeln(content);document.writeln('</div>');}
function getLayer(name){var theObj=document.getElementById(name);if(theObj!=null){return theObj.style}else{return(null);}}
function isVisible(name){var layer=getLayer(name);if(isNav&&layer.visibility=="show")
return(true);if(isIE&&layer.visibility=="visible")
return(true);return(false);}
function getXY(e){if(isNav){theX=e.pageX;theY=e.pageY;}else{try{theX=e.clientX+document.body.scrollLeft;theY=e.clientY+document.body.scrollTop;}catch(e){theX=event.clientX+document.body.scrollLeft;theY=event.clientY+document.body.scrollTop;}}
return false;}
function getMapXY(e){if(!e)var e=window.event;if(e.offsetX||e.offsetY){theX=e.offsetX;theY=e.offsetY;}else if(e.layerX||e.layerY){theX=e.layerX;theY=e.layerY;}
return false;}
function setLayerBackgroundColor(name,color){var layer=getLayer(name);layer.backgroundColor=color;}
function hideLayer(name){var layer=getLayer(name);layer.visibility="hidden";}
function showLayer(name){var layer=getLayer(name);layer.visibility="visible";}
var isMoving=false;var idx,idy;var idLayer;function startMove(e,divId){$('toc').style.zIndex=2;$('IdResult').style.zIndex=2;idLayer=$(divId);idLayer.style.zIndex=3;isMoving=true;getXY(e);idx=theX-idLayer.offsetLeft;idy=theY-idLayer.offsetTop;document.onmousemove=updateMove;document.onmouseup=stopMove;}
function updateMove(e){if(!isMoving||(idLayer==null))return;getXY(e);idLayer.style.left=(theX-idx)+'px';idLayer.style.top=(theY-idy)+'px';}
function stopMove(){if(!isMoving||(idLayer==null))return;idLeft=idLayer.offsetLeft;idTop=idLayer.offsetTop;isMoving=false;idLayer=null;}
function setStatusWorking(msg){$('statusWindow').innerHTML='<div style="margin: 5px"><img src="images/map/hourglass.gif"> '+msg+'</div>';}
function setStatusError(msg){var errSrc='<img src="images/map/alert.gif"> '+msg
+' <br><div style="text-align: center"> <a href="javascript: hideStatus()"> Close </a></div>';$('statusWindow').innerHTML=errSrc;}
function showStatus(){$('statusWindow').style.display="block";}
function hideStatus(){$('statusWindow').style.display="none";}
var currentZoom="zoom10";function zoombarClick(id,x,y){var zoomlevel=currentZoom.substring(4,currentZoom.length);if(id=="zoommax"&&zoomlevel<10){zoomlevel++;id="zoom"+zoomlevel;$(currentZoom).src="images/map/"+currentZoom+".gif";$(id).src="images/map/"+id+"D.gif";currentZoom=id;}else if(id=="zoommin"&&zoomlevel>1){zoomlevel--;id="zoom"+zoomlevel;$(currentZoom).src="images/map/"+currentZoom+".gif";$(id).src="images/map/"+id+"D.gif";currentZoom=id;}else if(id!="zoommin"&&id!="zoommax"){$(currentZoom).src="images/map/"+currentZoom+".gif";$(id).src="images/map/"+id+"D.gif";currentZoom=id;zoomlevel=currentZoom.substring(4,currentZoom.length);}
myZoom(zoomlevel,x,y);}
function myZoom(level,x,y){var value=-1;level=1*level;switch(level){case 1:value=.0002;break;case 2:value=.0006;break;case 3:value=.0018;break;case 4:value=.0034;break;case 5:value=.0074;break;case 6:value=.0315;break;case 7:value=.0596;break;case 8:value=.124;break;case 9:value=.4096;break;case 10:value=1;break;default:break;}
var dx=(fullmaxx-fullminx);var dy=(fullmaxy-fullminy);var cx;var cy;if(x==undefined&&y==undefined){cx=(maxx+minx)/2.0;cy=(maxy+miny)/2.0;}else{cx=1*x;cy=1*y;}
var dx1=0.5*value*dx;var dy1=0.5*value*dy;minx=cx-dx1;miny=cy-dy1;maxx=cx+dx1;maxy=cy+dy1;var env='<ENVELOPE minx="'+minx+'" miny="'+miny+'" maxx="'+maxx+'" maxy="'+maxy+'" />';getMap(env);}
function zoombarOver(id){}
function zoombarOut(id){}
function ButtonOut(id,tool,flatimage,downimage){var imgsrc=flatimage;if(activeTool==tool){imgsrc=downimage;}
var imgObj=$(id);if(imgObj!=null)
imgObj.src=imgsrc;}
function highlightTool(tool){if((tool!=null)&&(tool!="")){$('idTool').src="images/tools/identify.gif";$('zoomInTool').src="images/tools/zoomin.gif";$('zoomOutTool').src="images/tools/zoomout.gif";$('measureTool').src="images/tools/measure.gif";$('panTool').src="images/tools/pan.gif";try{$('layersTool').src="images/tools/layers.gif";}catch(e){}
switch(tool){case"identify":showIdWindow();$('idTool').src="images/tools/identifyD.gif";break;case"zoomin":$('zoomInTool').src="images/tools/zoominD.gif";break;case"zoomout":$('zoomOutTool').src="images/tools/zoomoutD.gif";break;case"layers":$('toc').style.visibility="visible";break;case"pan":$('panTool').src="images/tools/panD.gif";break;case"measure":$('measureTool').src="images/tools/measureD.gif";showMeasureWindow();break;case"insertpoly":$('insertpolyTool').src="images/tools/insertpolyD.gif";break;default:}}}
function setActiveTool(tool){activeTool=tool;hideMeasureWindow();var layer=$(mapDivId);layer.onmousedown=null;layer.onmouseover=null;layer.onclick=null;Event.stopObserving(mapDivId,'click',handleWiselyMeasure);Event.stopObserving(mapDivId,'dblclick',handleWiselyMeasure);Event.stopObserving(mapDivId,'mousemove',showMeasurement);if(activeTool=="identify"){layer.onmousedown=pointClick;layer.style.cursor="crosshair";}else if(activeTool=="zoomin"){layer.onmousedown=zoomInClick;layer.onclick=null;layer.style.cursor="crosshair";}else if(activeTool=="zoomout"){layer.onmousedown=zoomOutClick;layer.onclick=null;layer.style.cursor="crosshair";}else if(activeTool=="insert"){layer.onmousedown=insertClick;layer.onclick=null;layer.style.cursor="crosshair";}else if(activeTool=="measure"){layer.onmousedown=null;layer.onmouseover=null;layer.onclick=null;Event.observe(mapDivId,'click',handleWiselyMeasure);Event.observe(mapDivId,'dblclick',handleWiselyMeasure);Event.observe(mapDivId,'mousemove',showMeasurement);layer.style.cursor="crosshair";}else if(activeTool=="pan"){layer.onmousedown=startMapDragging;layer.onclick=null;layer.style.cursor="move";}else{activeTool="default";layer.onmousedown=null;layer.onmouseover=null;layer.onclick=null;layer.style.cursor="default";}}
function zoomInClick(e){getMapXY(e);var xy=convertPixelToMap(theX,theY);zoombarClick('zoommin',xy[0],xy[1]);}
function zoomOutClick(e){getMapXY(e);var xy=convertPixelToMap(theX,theY);zoombarClick('zoommax',xy[0],xy[1]);}
function startMapDragging(e){if(!panning){panning=true;getXY(e);x1=theX;y1=theY;x2=x1+1;y2=y1+1;var layer=document.getElementById(mapDivId);document.onmousemove=updateMapDragging;document.onmouseup=stopMapDragging;}
return false;}
function updateMapDragging(e){if(panning){getXY(e);x2=theX;y2=theY;if(x2<mleft)x2=mleft;if(x2>mleft+mwidth)x2=mleft+mwidth;if(y2<mtop)y2=mtop;if(y2>mtop+mheight)y2=mtop+mheight;var dx=x2-x1;var dy=y2-y1;var cLeft=-dx;var cTop=-dy;var cRight=mwidth;var cBottom=mheight;if(dx>0){cLeft=0;cRight=mwidth-dx;}
if(dy>0){cTop=0;cBottom=mheight-dy;}
$('imagestack_0').style.left=dx+"px";$('imagestack_0').style.top=dy+"px";$('imagestack_1').style.left=dx+"px";$('imagestack_1').style.top=dy+"px";$('imagestack_2').style.left=dx+"px";$('imagestack_2').style.top=dy+"px";}
return false;}
function stopMapDragging(e){if(panning){panning=false;getXY(e);document.onmousemove=null;document.onmouseup=null;var ixOffset=x1-x2;var iyOffset=y2-y1;$('mapimage_0').onload=resetAfterPan;pan(ixOffset,iyOffset);return false;}}
function resetAfterPan(){$('imagestack_0').style.left='0px';$('imagestack_0').style.top='0px';$('imagestack_1').style.left='0px';$('imagestack_1').style.top='0px';$('imagestack_2').style.left='0px';$('imagestack_2').style.top='0px';$('mapimage_0').onload=null;}
var tLayerName=new Array();var tLayerID=new Array();var tLayerVisible=new Array();var ActiveLayerIndex=0;var ActiveLayer;var layerCount;var LayerName=new Array();var LayerImage=new Array();var LayerID=new Array();var LayerVisible=new Array();function getLayers(theReply){var theReplyUC=theReply.toUpperCase();var startpos=0;var endpos=0;var pos=-1;var lpos=1;var epos=1;var zpos=1;var zpos2=1;var tempString="";var visString="";var typeString="";var fieldString="";var testString="";var testString2="";var minString="";var maxString="";var dQuote='"';layerCount=0;tLayerName.length=1;tLayerVisible.length=1;tLayerID.length=1;lpos=theReplyUC.indexOf("<LAYERINFO",zpos);while(lpos>-1){if(lpos!=-1){zpos=theReplyUC.indexOf("</LAYERINFO",lpos);if(zpos!=-1){pos=theReplyUC.indexOf("NAME=",lpos);if(pos!=-1){startpos=pos+6;endpos=theReply.indexOf(dQuote,startpos);tempString=theReply.substring(startpos,endpos);tempString=tempString.replace(/&apos;/g,"'");tLayerName[layerCount]=tempString;startpos=theReplyUC.indexOf("VISIBLE=",lpos);if(startpos!=-1){startpos=startpos+9;endpos=startpos+4;visString=theReply.substring(startpos,endpos);}
startpos=theReplyUC.indexOf("ID=",lpos);if((startpos!=-1)&&(startpos<zpos)){startpos=startpos+4;endpos=theReply.indexOf(dQuote,startpos);tempString=theReply.substring(startpos,endpos);tempString=tempString.replace(/&apos;/g,"'");tLayerID[layerCount]=tempString;}else{tLayerID[layerCount]=tLayerName[layerCount];}
if(visString=="true"){tLayerVisible[layerCount]=1}else{tLayerVisible[layerCount]=0};layerCount+=1;endpos=zpos;lpos=theReplyUC.indexOf("<LAYERINFO",zpos);}else{lpos=-1;}}}}
tLayerName.reverse();tLayerVisible.reverse();tLayerID.reverse();var count=0;for(var i=0;i<tLayerName.length;i++){if(tLayerID[i].indexOf("WNMDATA")==-1){LayerName[count]=tLayerName[i].replace('WNM.SDELOAD.','');LayerVisible[count]=tLayerVisible[i];LayerID[count]=tLayerID[i];count++;}}
layerCount=count;ActiveLayer='WNMDATA';displayToc();return false;}
function getServiceInfo(){var axl='<?xml version="1.0" encoding="UTF-8"?><ARCXML version="1.1">\n<REQUEST>\n<GET_SERVICE_INFO renderer="false" extensions="false" fields="false" />\n</REQUEST>\n</ARCXML>\n';var myAjax=new Ajax.Request(url,{method:'post',postBody:axl,onComplete:parseLayers});}
function parseLayers(response){if(debugOn)debug("parseLayers\n\n"+response.responseText);if(response.readyState==4){if(response.status==200){getLayers(response.responseText);getMap("");}else alert("Error retreiving data");}}
function getMapWithCurrentExtent(){var env='<ENVELOPE minx="'+minx+'" miny="'+miny+'" maxx="'+maxx+'" maxy="'+maxy+'" />';getMapRequestPt1(env);}
function getMap(envelope){setStatusWorking("Loading Map");showStatus();if(speciesArrayIndex>0){getMapRequestPt1(envelope);}else{var axl=getMapRequest(envelope);if(debugOn)debug("getMap\n\n"+axl);var myAjax=new Ajax.Request(url,{method:'post',postBody:axl,onComplete:printResponse});}}
function getMapFromAXL(axl){setStatusWorking("Loading Map");showStatus();if(debugOn)debug("getMapFromAXL\n\n"+axl);var myAjax=new Ajax.Request(url,{method:'post',postBody:axl,onComplete:printResponse});}
function getMapRequestPt1(envelope){var axl='<?xml version="1.0" encoding="UTF-8"?>';axl+='<ARCXML version="1.1">';axl+=' <REQUEST>';axl+='    <GET_IMAGE>';axl+='    <PROPERTIES>';axl+=envelope;axl+='<IMAGESIZE height="'+mheight+'" width="'+mwidth+'" />';axl+='<LAYERLIST >\n';for(var i=0;i<layerCount;i++){if(LayerVisible[i]==1){axl+='<LAYERDEF id="'+LayerID[i]+'" visible="true" />\n';}else{axl+='<LAYERDEF id="'+LayerID[i]+'" visible="false" />\n';}}
axl+='</LAYERLIST>\n';axl+=' </PROPERTIES>';theAXL=axl;getMapRequestPt2();}
function getMapRequestPt2(){var axl='';if(rangeMap!=''){axl+=getRangeMap(rangeMap);}
var hasET=false;var species;for(var i=0;i<speciesArrayIndex;i++){try{species=speciesArray[i].split("|")[0];if(species.charAt(0)=='T'||species.charAt(0)=='E'){hasET=true;}
axl+=addSpecies(species,speciesArray[i].split("|")[1]);}catch(e){debug(e);}}
theAXL+=axl;if(!hasET){getMapRequestPt3()}}
function getMapRequestPt3(){var axl='<LAYER type="acetate" name="scalebar" visible="true" id="acetate">\n';axl+='    <OBJECT units="pixel">\n';axl+='      <SCALEBAR fontcolor="0,0,0" coords="10 10" barcolor="255,255,255" fontsize="12" screenlength="100" barwidth="3" precision ="1" mapunits="degrees" antialiasing="true" mode="cartesian" />\n';axl+='    </OBJECT>\n';axl+='  </LAYER>\n';axl+='    </GET_IMAGE> </REQUEST></ARCXML>';theAXL+=axl;getMapFromAXL(theAXL);}
function getMapRequest(envelope){var axl='<?xml version="1.0" encoding="UTF-8"?>';axl+='<ARCXML version="1.1">';axl+=' <REQUEST>';axl+='    <GET_IMAGE>';axl+='    <PROPERTIES>';axl+=envelope;axl+='<IMAGESIZE height="'+mheight+'" width="'+mwidth+'" />';axl+='<LAYERLIST >\n';for(var i=0;i<layerCount;i++){if(LayerVisible[i]==1){axl+='<LAYERDEF id="'+LayerID[i]+'" visible="true" />\n';}else{axl+='<LAYERDEF id="'+LayerID[i]+'" visible="false" />\n';}}
axl+='</LAYERLIST>\n';axl+=' </PROPERTIES>';axl+='<LAYER type="acetate" name="scalebar" visible="true" id="acetate">\n';axl+='    <OBJECT units="pixel">\n';axl+='      <SCALEBAR fontcolor="0,0,0" coords="10 10" barcolor="255,255,255" fontsize="12" screenlength="100" barwidth="3" precision ="1" mapunits="degrees" antialiasing="true" mode="cartesian" />\n';axl+='    </OBJECT>\n';axl+='  </LAYER>\n';axl+='    </GET_IMAGE> </REQUEST></ARCXML>';return axl;}
function printResponse(response){if(debugOn)debug("printResponse\n\n"+response.responseText);if(response.readyState==4){if(response.status==200){try{$('site').style.display="none";}catch(e){}
isWorking=false;var xmlDoc=Try.these(function(){return new DOMParser().parseFromString(response.responseText,'text/xml');},function(){var xmldom=new ActiveXObject('Microsoft.XMLDOM');xmldom.loadXML(response.responseText);return xmldom;});var theURL=xmlDoc.getElementsByTagName("OUTPUT").item(0).getAttribute("url");$('mapimage_0').src=theURL;var env=xmlDoc.getElementsByTagName("ENVELOPE").item(0);minx=parseFloat(env.getAttribute("minx"));miny=parseFloat(env.getAttribute("miny"));maxx=parseFloat(env.getAttribute("maxx"));maxy=parseFloat(env.getAttribute("maxy"));if(fullminx==undefined){fullminx=minx;fullmaxx=maxx;fullminy=miny;fullmaxy=maxy;}
hideStatus();if($('lat').value>=0&&$('lat').value!=""){try{var mxmy=convertMapToPixel($('lon').value,$('lat').value);$('site').style.top=(mxmy[1]-11)+'px';$('site').style.left=(mxmy[0]-11)+'px';$('site').style.display="block";}catch(e){}}}else{setStatusError("Error: ");showStatus();}}}
function panDirection(dir){shift(dir);var env='<ENVELOPE minx="'+minx+'" miny="'+miny+'" maxx="'+maxx+'" maxy="'+maxy+'" />';getMap(env);}
function pan(ix,iy){var dx=(maxx-minx)/mwidth;var mx=dx*ix;var my=dx*iy;minx+=mx;maxx+=mx;miny+=my;maxy+=my;var env='<ENVELOPE minx="'+minx+'" miny="'+miny+'" maxx="'+maxx+'" maxy="'+maxy+'" />';getMap(env);}
function shift(dir){var dx=maxx-minx;var dy=maxy-miny;switch(dir){case"north":miny+=0.3*dy;maxy+=0.3*dy;break;case"south":miny-=0.3*dy;maxy-=0.3*dy;break;case"east":minx+=0.3*dx;maxx+=0.3*dx;break;case"west":minx-=0.3*dx;maxx-=0.3*dx;break;case"ne":miny+=0.3*dy;maxy+=0.3*dy;minx+=0.3*dx;maxx+=0.3*dx;break;case"nw":miny+=0.3*dy;maxy+=0.3*dy;minx-=0.3*dx;maxx-=0.3*dx;break;case"se":miny-=0.3*dy;maxy-=0.3*dy;minx+=0.3*dx;maxx+=0.3*dx;break;case"sw":miny-=0.3*dy;maxy-=0.3*dy;minx-=0.3*dx;maxx-=0.3*dx;break;}}
function getRangeMap(species){var axl='<LAYER type="featureclass" name="RangeMap" visible="true" id="rangemap" >';axl+='<DATASET name="'+species+'" type="polygon" workspace="shp_ws-10" />';axl+='<SIMPLERENDERER>';axl+='  <SIMPLEPOLYGONSYMBOL filltransparency="0.3" filltype="solid" fillcolor="102, 205, 124"  boundarycolor ="102, 205, 124" boundarytransparency="0.3" />';axl+='</SIMPLERENDERER>';axl+='</LAYER>';return axl;}
function addSpecies(species,theColor){var sCode;var axl;if(species.charAt(0)=='T'||species.charAt(0)=='E'){sCode=species.substring(1,species.length);sCode=sCode.replace(/" "/g,"");color=theColor;var pars='id='+sCode;var url='getxy.do';var myAjax=new Ajax.Request(url,{asynchronous:'false',method:'get',parameters:pars,onComplete:addAcetate});}else if(species.startsWith("all_")){sCode=species.replace("all_","");if(sCode=='prj_frog'){axl='\n<LAYER type="featureclass" name="WNM.SDELOAD.WNMDATA_FROG" visible="true" id="species_'+sCode+'">';axl+='<DATASET name="WNM.SDELOAD.WNMDATA_FROG" type="point" workspace="sde_ws-0" />';axl+='<SIMPLERENDERER>';axl+='  <SIMPLEMARKERSYMBOL color="'+theColor+'" width="8"  overlap="false" outline="0,0,0" antialiasing="true"/>';axl+='</SIMPLERENDERER>';axl+='<QUERY where="taxon  = &apos;'+sCode+'&apos; "/> ';axl+='</LAYER>\n';}else if(sCode=='prj_worm'){axl='\n<LAYER type="featureclass" name="WNM.SDELOAD.WNMDATA_WORM" visible="true" id="species_'+sCode+'">';axl+='<DATASET name="WNM.SDELOAD.WNMDATA_WORM" type="point" workspace="sde_ws-0" />';axl+='<SIMPLERENDERER>';axl+='  <SIMPLEMARKERSYMBOL color="'+theColor+'" width="8"  overlap="false" outline="0,0,0" antialiasing="true"/>';axl+='</SIMPLERENDERER>';axl+='<QUERY where="taxon  = &apos;'+sCode+'&apos; "/> ';axl+='</LAYER>\n';}else{axl='\n<LAYER type="featureclass" name="WNM.SDELOAD.WNMDATA" visible="true" id="species_'+sCode+'">';axl+='<DATASET name="WNM.SDELOAD.WNMDATA" type="point" workspace="sde_ws-0" />';axl+='<SIMPLERENDERER>';axl+='  <SIMPLEMARKERSYMBOL color="'+theColor+'" width="8"  overlap="false" outline="0,0,0" antialiasing="true"/>';axl+='</SIMPLERENDERER>';axl+='<QUERY where="taxon  = &apos;'+sCode+'&apos; and tecode = &apos;&apos;"/> ';axl+='</LAYER>\n';}
theAXL+=axl;}else{sCode=species;axl='\n<LAYER type="featureclass" name="WNM.SDELOAD.WNMDATA" visible="true" id="species_'+sCode+'">';axl+='<DATASET name="WNM.SDELOAD.WNMDATA" type="point" workspace="sde_ws-0" />';axl+='<SIMPLERENDERER>';axl+='  <SIMPLEMARKERSYMBOL color="'+theColor+'" width="8"  overlap="false" outline="0,0,0" antialiasing="true"/>';axl+='</SIMPLERENDERER>';axl+='<QUERY where="SPECIES  =  '+sCode+'"/> '
axl+='</LAYER>\n';theAXL+=axl;}}
function addAcetate(response){debug(color);var coords=response.responseText;var axl='<LAYER type="acetate" name="species_'+sCode+'" id="species_'+sCode+'">';axl+='<OBJECT units=\"database\">';axl+='  <SIMPLEMARKERSYMBOL color="'+color+'" width="8"  overlap="false" type="square" outline="0,0,0" antialiasing="true" />';axl+='<MULTIPOINT>';axl+=coords;axl+='</MULTIPOINT>';axl+='</OBJECT>';axl+='</LAYER>\n';theAXL+=axl;getMapRequestPt3();}
function speciesSelect(selected,speciesid){debug("IN SPi="+speciesArrayIndex+" :CLRi="+colorArrayIndex+" :SP="+speciesid);if(selected){speciesArray[speciesArrayIndex]=speciesid+'|'+colorArray[colorArrayIndex];activeColors[speciesArrayIndex]=1;try{$(speciesid).style.backgroundColor='rgb('+colorArray[colorArrayIndex]+')';}catch(e){}
colorArrayIndex++;speciesArrayIndex++;}else{var swapArray=new Array(speciesArrayIndex-1);for(var i=0;i<=speciesArrayIndex;i++){try{if(speciesArray[i].split("|")[0]!=speciesid){swapArray[i]=speciesArray[i];activeColors[i]=1;}else{activeColors[i]=0;}}catch(e){}}
speciesArrayIndex--;colorArrayIndex--;try{$(speciesid).style.backgroundColor='rgb(255,255,255)';}catch(e){}
speciesArray=swapArray;}
debug("OUT SPi="+speciesArrayIndex+" :CLRi="+colorArrayIndex+" :SP="+speciesid);}
function speciesReset(){for(var i=speciesArrayIndex+1;i>=0;i--){try{debug("RESET i="+i+" :SP="+speciesArray[i].split("|")[0]);$(speciesArray[i].split("|")[0]).style.backgroundColor='rgb(244,247,235)';}catch(e){}}
speciesArrayIndex=0;colorArrayIndex=0;$('layersForm').reset();}
function showLayerGroup(species){$('mammals').style.display='none';$('birds').style.display='none';$('reptiles').style.display='none';$('amphibians').style.display='none';$('baseLayers').style.display='none';$('range').style.display='none';try{$('prjFrog').style.display='none';}catch(e){}
try{$('insects').style.display='none';}catch(e){}
try{$('plants').style.display='none';}catch(e){}
$(species).style.display='block';}
function setBaseLayers(){var tocContent="";for(var i=0;i<layerCount;i++){tocContent+='<input type="checkbox" value="" onclick="setVisibility('+i+');"';if(LayerVisible[i]==1)tocContent+=' CHECKED ';if(LayerID[i].startsWith("WNMDATA"))tocContent+=' disabled="true" ';tocContent+='/>\n';tocContent+=LayerName[i]+'<br>\n';}
tocContent+='<span style="font-size: 9pt;color: red;">Note: Base layers have a fixed scale threshold, and may not be visible at the current extent.</span>';$('baseLayers').innerHTML=tocContent;return false;}
function displayToc(){tocContent="<table class='idTitleBarClass'>";tocContent+="<tr >";tocContent+="<td width='80%' onmousedown='startMove(event, \"toc\")'><font class='idTitleClass'>Layers</font></td>";tocContent+="<td  width='10%'> <img onmousedown='hideLayer(\"toc\");' src='images/map/close.gif' class='closeButton' ></td>";tocContent+="</tr>";tocContent+="</table>";tocContent+="<table width='80%' border=\"0\" cellspacing=\"3\" cellpadding=\"0\">\n";for(var i=0;i<layerCount;i++){tocContent+=" <tr valign=\"middle\">\n";tocContent+="     <td colspan=\"1\" NOWRAP>\n";tocContent+="    <input type=\"checkbox\" value=\"\" onclick=\"setVisibility("+i+");getMapWithCurrentExtent();\"";if(LayerVisible[i]==1)tocContent+=" CHECKED ";if(LayerID[i].startsWith("WNMDATA"))tocContent+=' disabled="true" ';tocContent+="/></td>\n";tocContent+="<td>"+LayerName[i]+"</td></tr>\n";}
tocContent+="</table>\n";tocContent+='<span style="font-size: 9pt;color: red;">Note: Base layers have a fixed scale threshold, and may not be visible at the current extent.</span>';updateContent('toc',tocContent);return false;}
function setVisibility(lyrIndex){if(LayerVisible[lyrIndex]==1)LayerVisible[lyrIndex]=0;else LayerVisible[lyrIndex]=1;}
function setActiveLayer(lyrIndex){ActiveLayerIndex=lyrIndex;ActiveLayer=LayerID[lyrIndex];}
function convertMapToPixel(mx,my){var dx=(maxx-minx)/mwidth;var px=(mx-minx)/dx;var py=-1*(((my-miny)/dx)-mheight);var newpoint=new Array();newpoint[0]=px;newpoint[1]=py;return newpoint;}
function remove(layer,exitpage){if(layer==-1){layer=confirm("You are about to delete all of the test user's data. Do you want to continue?");}
if(layer==true){var pars='layer='+layer+'&exit='+exitpage;var url='deleteTemp.do';var myAjax=new Ajax.Request(url,{method:'get',parameters:pars,onComplete:getMapWithCurrentExtent});}}
function userSelect(selected,speciesid){}
var pixelTolerance=16;var idMinX,idMinY,idMaxX,idMaxY;var idCount=0;var selectedId=1;function showIdWindow(){}
function hideIdWindow(){$('measureWindow').style.display="none";}
function setActive(value){ActiveLayer=value;}
function pointClick(e){getMapXY(e);var x1=theX;var y1=theY;identify(x1,y1);return false;}
function identify(x1,y1){if(debugOn)debug("identify( "+x1+" , "+y1+" )");var idMins=convertPixelToMap(x1-(pixelTolerance/2),y1+(pixelTolerance/2));var idMaxs=convertPixelToMap(x1+(pixelTolerance/2),y1-(pixelTolerance/2));idMinX=idMins[0];idMinY=idMins[1];idMaxX=idMaxs[0];idMaxY=idMaxs[1];selectedId=1;sendIdRequest(true);}
function convertPixelToMap(px,py){var dx=(maxx-minx)/mwidth;var mx=minx+(dx*px);var my=miny+(dx*(mheight-py));var newpoint=new Array();newpoint[0]=mx;newpoint[1]=my;return newpoint;}
function sendIdRequest(countOnly,beginRecord){var axl=getIdRequest(countOnly,beginRecord);if(debugOn)debug("sendIdRequest\n\n"+axl);var queryUrl=url+"&CustomService=Query";var func;if(countOnly){func=parseResultForCount;}else{func=parseResult;setStatusWorking("Identifying Features");showStatus();}
var myAjax=new Ajax.Request(queryUrl,{method:'post',postBody:axl,onComplete:func});}
function getIdRequest(countOnly,beginRecord){debug(ActiveLayer);var axl='<?xml version="1.0" encoding="UTF-8"?>';axl+='<ARCXML version="1.1">\n<REQUEST>\n<GET_FEATURES geometry="false" outputmode="xml" checkesc ="true" ';if(countOnly)axl+='envelope="false" skipfeatures="true">\n';else axl+='envelope="true" skipfeatures="false" beginrecord="'+beginRecord+'" featurelimit="1">\n';axl+='<LAYER id="'+ActiveLayer+'" />';if(ActiveLayer.startsWith("WNMDATA")){axl+='<SPATIALQUERY ';if(speciesArray.length>0){axl+='where="1=0 ';for(var i=0;i<speciesArrayIndex;i++){species=speciesArray[i].split("|")[0];if(species.charAt(0)=='T'||species.charAt(0)=='E')species='';if(species.startsWith("all_")){species=species.replace("all_","");if(species=='prj_frog'){axl+=' or (taxon = &apos;'+species+'&apos; )';}else if(species=='prj_worm'){axl+=' or (taxon = &apos;'+species+'&apos; )';}else{axl+=' or (taxon = &apos;'+species+'&apos; and tecode = &apos;&apos;)';}}else if(species.startsWith("prj_frog")){species=species.replace("prj_frog","");axl+=' or SPECIES = &apos;'+species+'&apos;';}else{axl+=' or SPECIES = &apos;'+species+'&apos;';}}}
if(ActiveLayer=="WNMDATA_FROG"){axl+='" subfields="PLOTNO OBSDT OBSTM LAT LONG_ COUNTY HABITAT AMERICAN_BULL_FROG BLANCHARDS_CRICKET_FROG CHORUS_FROG MINK_FROG NORTHERN_GREEN_FROG NORTHER_LEOPARD_FROG PICKEREL_FROG WOOD_FROG NORTHERN_SPRING_PEEPER EASTERN_AMERICAN_TOAD COPES_GRAY_TREEFROG EASTERN_GRAY_TREEFROG TEMPERATURE SKYCOND WATERTEMP WIND"';}else if(ActiveLayer=="WNMDATA_WORM"){axl+='" ';}else{axl+='" subfields="SPECIESNAME OBSDT OBSTM LAT LONG_ COUNTY HABITAT NOTES"';}
axl+='>';}else{axl+='<SPATIALQUERY>';}
axl+='<SPATIALFILTER relation="area_intersection" >';axl+='<ENVELOPE maxy="'+idMaxY+'" maxx="'+idMaxX+'" miny="'+idMinY+'" minx="'+idMinX+'" />';axl+='</SPATIALFILTER>';axl+='</SPATIALQUERY>';axl+='</GET_FEATURES>';axl+='</REQUEST>';axl+='</ARCXML>';return axl;}
function parseResultForCount(response){if(debugOn)debug(response);if(response.readyState==4){if(response.status==200){var result=response.responseText;idCount=getCount(result);if(idCount!=0)sendIdRequest(false,1);else{alert("No features found");}}else alert("Error retreiving data");}}
function parseResult(response){if(response.readyState==4){if(response.status==200){var result=response.responseText;processResult(result);}else alert("Error retreiving data");}}
function getCount(theReply){if(debugOn)debug(theReply);var xmlDoc=Try.these(function(){return new DOMParser().parseFromString(theReply,'text/xml');},function(){var xmldom=new ActiveXObject('Microsoft.XMLDOM');xmldom.loadXML(theReply);return xmldom;});var theCount=xmlDoc.getElementsByTagName("FEATURECOUNT").item(0).getAttribute("count");return theCount;}
function processResult(theReply){debug(theReply);try{var selectedData="";var endpos=1;var pos=theReply.indexOf("<FIELDS ",endpos);if(pos!=-1){var startpos=pos+8;endpos=theReply.indexOf('" />',startpos);selectedData=theReply.substring(startpos,endpos);}
if(selectedData!=""){var fValue1=getFieldValues(selectedData);var fName1=getFieldNames(selectedData);displayIdResult(fName1,fValue1);}
hideStatus();}catch(e){}}
function getFieldNames(recordString){var theStuff=new String(recordString);var theList=theStuff.split('" ');var fName1=new Array();for(var f=0;f<theList.length;f++){var v=theList[f].split('="');var t=v[0];try{t=t.substring(t.lastIndexOf(".")+1,t.length);}catch(e){alert(e);}
fName1[f]=t;}
return fName1;}
function getFieldValues(recordString){var theStuff=new String(recordString);var theList=theStuff.split('" ');var fValue1=new Array();for(var f=0;f<theList.length;f++){var v=theList[f].split('="');if((v[1]=="")||(v[1]==null))v[1]="&nbsp;";fValue1[f]=v[1];}
return fValue1;}
function displayIdResult(fName1,fValue1){var date=new Date();var idContent="<table class='idTitleBarClass'>";idContent+="<tr >";idContent+="<td width='95%' onmousedown='startMove(event, \"IdResult\")'><font class='idTitleClass'>Identify Results</font></td>";idContent+="<td align='right' width='5%'> <img onmousedown='hideLayer(\"IdResult\");' src='images/map/close.gif'  class='closeButton' ></td>";idContent+="</tr>";idContent+="</table>";idContent+="<table width='100%' cellspacing='5' cellpadding='5'>";idContent+="<tr>";idContent+="<td class='idNonTitleClass'>Species Observation Information<br> Total Observations : "+idCount;idContent+="</td>";idContent+="</tr>";idContent+="<tr> <td>";idContent+="<table border='1' cellpadding='0' cellspacing='2' width='100%'>";idContent+="<tr valign='top'>";idContent+="<td width='20%'>";idContent+="<table border='0' width='100%'>";idContent+="<tr class='headerRow'>";idContent+="<td>Record Num</td>";idContent+="</tr>";idContent+="</table>";idContent+="<div style='overflow:auto;height:255px;border-width:1px;'>";idContent+="<table width='100%' cellpadding='0' cellspacing='0'>";for(var i=1;i<=idCount;i++){idContent+=" <tr>";idContent+="<td align='middle'>";if(i==selectedId)idContent+="<span class='selectedIdClass'> "+i+"</span>";else{idContent+="<a href='#' onclick='setSelectedId("+i+");sendIdRequest(false,"+i+" );return false;' style='color:black;font-size:12px;font-family:Arial, Verdana, Helvetica, sans-serif;'>";idContent+="<font class='unselectedIdClass'>"+i+"</font></a>";}
idContent+="</td></tr>";}
idContent+="</table>";idContent+="</div>";idContent+="</td>";idContent+="<td>";idContent+="<div style='overflow:auto;height:240px;border-width:1px;'>";idContent+="<table width='100%' cellpadding='0' cellspacing='0'>";idContent+="<tr>";idContent+="<td>";idContent+="<table cellspadding='0' cellspacing='2' width='100%'>";idContent+="<tr>";idContent+="<td class='headerRow'><b>Field</b></td><td class='headerRow'><b>Value</b></td>";idContent+="</tr>";for(var ii=0;ii<fValue1.length;ii++){var evenOdd;if((ii%2)==0)evenOdd="evenRow";else evenOdd="oddRow";idContent+="<tr valign='top'>";if(fName1[ii]=="OBSDT"){date.setTime(fValue1[ii]);idContent+="<td class='"+evenOdd+"'><b>"+fName1[ii]+"</b></td><td class='"+evenOdd+"'>"+date.toLocaleString()+"</td>";}else{idContent+="<td class='"+evenOdd+"'><b>"+fName1[ii]+"</b></td><td class='"+evenOdd+"'>"+fValue1[ii]+"</td>";}
idContent+="</tr>";}
idContent+="</table>";idContent+="</td>";idContent+="</tr>";idContent+="</table>";idContent+="</div>";idContent+="</td>";idContent+="</tr>";idContent+="</table>";idContent+="</td>";idContent+="</tr>";idContent+="</table>";updateContent('IdResult',idContent);showLayer('IdResult');}
function setSelectedId(indx){selectedId=indx;}
function updateContent(name,content){var theObj=document.getElementById(name);if(theObj!=null){theObj.innerHTML=content;}
return false;}
var anchorX;var anchorY;var remoteX;var remoteY;var measurePoints=0;var totalDist=0;var segmentDist=0;function showMeasureWindow(){var content='<div><div style="float: left">Total : <span id="totalDist">Click Map to Start</span><br>Segment: <span id="segmentDist"></span></div><div style="float: right"><a href="javascript: setActiveTool();ButtonOut(\'measureTool\', \'measure\', \'images/tools/measure.gif\', \'images/tools/measureD.gif\');" style="text-decoration: none;color: #667F4F;">close</a></div></div><br></div>';content+='';$('measureWindow').innerHTML=content;$('measureWindow').style.display="block";}
function hideMeasureWindow(){try{$('measureWindow').style.display="none";jg0.clear();jg1.clear();for(var i=1;i<=measurePoints;i++){$('measurePoint_'+i).style.display="none";}}catch(e){}
anchorX=null;anchorY=null;measurePoints=0;totalDist=0;segmentDist=0;}
function setMeasureAnchor(myX,myY,finished){if(anchorX>1&&anchorY>1&&remoteX>1&&remoteY>1){jg1.drawLine(anchorX,anchorY,remoteX,remoteY);jg1.paint();}
anchorX=myX;anchorY=myY;measurePoints++;$('measurePoint_'+measurePoints).style.top=anchorY+10+'px';$('measurePoint_'+measurePoints).style.left=anchorX+23+'px';$('measurePoint_'+measurePoints).style.display="block";totalDist+=segmentDist;$('totalDist').innerHTML=totalDist.toFixed(2);$('segmentDist').innerHTML=segmentDist.toFixed(2);if(finished){doDoubleClick();}}
function showMeasurement(e){getMapXY(e);remoteX=theX;remoteY=theY;var remoteXY=convertPixelToMap(remoteX,remoteY);var anchorXY=convertPixelToMap(anchorX,anchorY);if(anchorX>1&&anchorY>1&&remoteX>1&&remoteY>1){segmentDist=3963.0*(Math.acos(Math.sin(remoteXY[1]/57.2958)*Math.sin(anchorXY[1]/57.2958)+Math.cos(remoteXY[1]/57.2958)*Math.cos(anchorXY[1]/57.2958)*Math.cos(anchorXY[0]/57.2958-remoteXY[0]/57.2958)));jg0.clear();jg0.drawLine(anchorX,anchorY,remoteX,remoteY);jg0.paint();$('segmentDist').innerHTML=segmentDist.toFixed(2)+" miles";}else{}}
var dcTime=100;var dcDelay=50;var dcAt=0;var savEvent=null;var savEvtTime=0;var savTO=null;var clickCount=0;var xPoints=new Array();var yPoints=new Array();function hadDoubleClick(){var d=new Date();var now=d.getTime();if((now-dcAt)<dcDelay){return true;}
return false;}
function handleWiselyMeasure(e){getMapXY(e);var myX=theX;var myY=theY;switch(e.type){case"click":if(hadDoubleClick())return false;savEvent=e;d=new Date();savEvtTime=d.getTime();if(myX>1&&myY>1){savTO=setTimeout("setMeasureAnchor("+myX+","+myY+",false)",dcTime);}
break;case"dblclick":if(myX>1&&myY>1){setMeasureAnchor(myX,myY,true);}
break;default:}}
function doDoubleClick(){var d=new Date();dcAt=d.getTime();if(savTO!=null){clearTimeout(savTO);savTO=null;}
setTimeout("setActiveTool()",250);ButtonOut('measureTool','measure','images/tools/measure.gif','images/tools/measureD.gif');}
var jg_ihtm,jg_ie,jg_fast,jg_dom,jg_moz,jg_n4=(document.layers&&typeof document.classes!="undefined");function chkDHTM(x,i)
{x=document.body||null;jg_ie=x&&typeof x.insertAdjacentHTML!="undefined";jg_dom=(x&&!jg_ie&&typeof x.appendChild!="undefined"&&typeof document.createRange!="undefined"&&typeof(i=document.createRange()).setStartBefore!="undefined"&&typeof i.createContextualFragment!="undefined");jg_ihtm=!jg_ie&&!jg_dom&&x&&typeof x.innerHTML!="undefined";jg_fast=jg_ie&&document.all&&!window.opera;jg_moz=jg_dom&&typeof x.style.MozOpacity!="undefined";}
function pntDoc()
{this.wnd.document.write(jg_fast?this.htmRpc():this.htm);this.htm='';}
function pntCnvDom()
{var x=this.wnd.document.createRange();x.setStartBefore(this.cnv);x=x.createContextualFragment(jg_fast?this.htmRpc():this.htm);if(this.cnv)this.cnv.appendChild(x);this.htm='';}
function pntCnvIe()
{if(this.cnv)this.cnv.insertAdjacentHTML("BeforeEnd",jg_fast?this.htmRpc():this.htm);this.htm='';}
function pntCnvIhtm()
{if(this.cnv)this.cnv.innerHTML+=this.htm;this.htm='';}
function pntCnv()
{this.htm='';}
function mkDiv(x,y,w,h)
{this.htm+='<div style="position:absolute;'+'left:'+x+'px;'+'top:'+y+'px;'+'width:'+w+'px;'+'height:'+h+'px;'+'clip:rect(0,'+w+'px,'+h+'px,0);'+'background-color:'+this.color+
(!jg_moz?';overflow:hidden':'')+';"><\/div>';}
function mkDivIe(x,y,w,h)
{this.htm+='%%'+this.color+';'+x+';'+y+';'+w+';'+h+';';}
function mkDivPrt(x,y,w,h)
{this.htm+='<div style="position:absolute;'+'border-left:'+w+'px solid '+this.color+';'+'left:'+x+'px;'+'top:'+y+'px;'+'width:0px;'+'height:'+h+'px;'+'clip:rect(0,'+w+'px,'+h+'px,0);'+'background-color:'+this.color+
(!jg_moz?';overflow:hidden':'')+';"><\/div>';}
function mkLyr(x,y,w,h)
{this.htm+='<layer '+'left="'+x+'" '+'top="'+y+'" '+'width="'+w+'" '+'height="'+h+'" '+'bgcolor="'+this.color+'"><\/layer>\n';}
var regex=/%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;function htmRpc()
{return this.htm.replace(regex,'<div style="overflow:hidden;position:absolute;background-color:'+'$1;left:$2;top:$3;width:$4;height:$5"></div>\n');}
function htmPrtRpc()
{return this.htm.replace(regex,'<div style="overflow:hidden;position:absolute;background-color:'+'$1;left:$2;top:$3;width:$4;height:$5;border-left:$4px solid $1"></div>\n');}
function mkLin(x1,y1,x2,y2)
{if(x1>x2)
{var _x2=x2;var _y2=y2;x2=x1;y2=y1;x1=_x2;y1=_y2;}
var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,yIncr=(y1>y2)?-1:1;if(dx>=dy)
{var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx,ox=x;while((dx--)>0)
{++x;if(p>0)
{this.mkDiv(ox,y,x-ox,1);y+=yIncr;p+=pru;ox=x;}
else p+=pr;}
this.mkDiv(ox,y,x2-ox+1,1);}
else
{var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy,oy=y;if(y2<=y1)
{while((dy--)>0)
{if(p>0)
{this.mkDiv(x++,y,1,oy-y+1);y+=yIncr;p+=pru;oy=y;}
else
{y+=yIncr;p+=pr;}}
this.mkDiv(x2,y2,1,oy-y2+1);}
else
{while((dy--)>0)
{y+=yIncr;if(p>0)
{this.mkDiv(x++,oy,1,y-oy);p+=pru;oy=y;}
else p+=pr;}
this.mkDiv(x2,oy,1,y2-oy+1);}}}
function mkLin2D(x1,y1,x2,y2)
{if(x1>x2)
{var _x2=x2;var _y2=y2;x2=x1;y2=y1;x1=_x2;y1=_y2;}
var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,yIncr=(y1>y2)?-1:1;var s=this.stroke;if(dx>=dy)
{if(dx>0&&s-3>0)
{var _s=(s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy)/dx;_s=(!(s-4)?Math.ceil(_s):Math.round(_s))+1;}
else var _s=s;var ad=Math.ceil(s/2);var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx,ox=x;while((dx--)>0)
{++x;if(p>0)
{this.mkDiv(ox,y,x-ox+ad,_s);y+=yIncr;p+=pru;ox=x;}
else p+=pr;}
this.mkDiv(ox,y,x2-ox+ad+1,_s);}
else
{if(s-3>0)
{var _s=(s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy)/dy;_s=(!(s-4)?Math.ceil(_s):Math.round(_s))+1;}
else var _s=s;var ad=Math.round(s/2);var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy,oy=y;if(y2<=y1)
{++ad;while((dy--)>0)
{if(p>0)
{this.mkDiv(x++,y,_s,oy-y+ad);y+=yIncr;p+=pru;oy=y;}
else
{y+=yIncr;p+=pr;}}
this.mkDiv(x2,y2,_s,oy-y2+ad);}
else
{while((dy--)>0)
{y+=yIncr;if(p>0)
{this.mkDiv(x++,oy,_s,y-oy+ad);p+=pru;oy=y;}
else p+=pr;}
this.mkDiv(x2,oy,_s,y2-oy+ad+1);}}}
function mkLinDott(x1,y1,x2,y2)
{if(x1>x2)
{var _x2=x2;var _y2=y2;x2=x1;y2=y1;x1=_x2;y1=_y2;}
var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,yIncr=(y1>y2)?-1:1,drw=true;if(dx>=dy)
{var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx;while((dx--)>0)
{if(drw)this.mkDiv(x,y,1,1);drw=!drw;if(p>0)
{y+=yIncr;p+=pru;}
else p+=pr;++x;}
if(drw)this.mkDiv(x,y,1,1);}
else
{var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy;while((dy--)>0)
{if(drw)this.mkDiv(x,y,1,1);drw=!drw;y+=yIncr;if(p>0)
{++x;p+=pru;}
else p+=pr;}
if(drw)this.mkDiv(x,y,1,1);}}
function mkOv(left,top,width,height)
{var a=width>>1,b=height>>1,wod=width&1,hod=(height&1)+1,cx=left+a,cy=top+b,x=0,y=b,ox=0,oy=b,aa=(a*a)<<1,bb=(b*b)<<1,st=(aa>>1)*(1-(b<<1))+bb,tt=(bb>>1)-aa*((b<<1)-1),w,h;while(y>0)
{if(st<0)
{st+=bb*((x<<1)+3);tt+=(bb<<1)*(++x);}
else if(tt<0)
{st+=bb*((x<<1)+3)-(aa<<1)*(y-1);tt+=(bb<<1)*(++x)-aa*(((y--)<<1)-3);w=x-ox;h=oy-y;if(w&2&&h&2)
{this.mkOvQds(cx,cy,-x+2,ox+wod,-oy,oy-1+hod,1,1);this.mkOvQds(cx,cy,-x+1,x-1+wod,-y-1,y+hod,1,1);}
else this.mkOvQds(cx,cy,-x+1,ox+wod,-oy,oy-h+hod,w,h);ox=x;oy=y;}
else
{tt-=aa*((y<<1)-3);st-=(aa<<1)*(--y);}}
this.mkDiv(cx-a,cy-oy,a-ox+1,(oy<<1)+hod);this.mkDiv(cx+ox+wod,cy-oy,a-ox+1,(oy<<1)+hod);}
function mkOv2D(left,top,width,height)
{var s=this.stroke;width+=s-1;height+=s-1;var a=width>>1,b=height>>1,wod=width&1,hod=(height&1)+1,cx=left+a,cy=top+b,x=0,y=b,aa=(a*a)<<1,bb=(b*b)<<1,st=(aa>>1)*(1-(b<<1))+bb,tt=(bb>>1)-aa*((b<<1)-1);if(s-4<0&&(!(s-2)||width-51>0&&height-51>0))
{var ox=0,oy=b,w,h,pxl,pxr,pxt,pxb,pxw;while(y>0)
{if(st<0)
{st+=bb*((x<<1)+3);tt+=(bb<<1)*(++x);}
else if(tt<0)
{st+=bb*((x<<1)+3)-(aa<<1)*(y-1);tt+=(bb<<1)*(++x)-aa*(((y--)<<1)-3);w=x-ox;h=oy-y;if(w-1)
{pxw=w+1+(s&1);h=s;}
else if(h-1)
{pxw=s;h+=1+(s&1);}
else pxw=h=s;this.mkOvQds(cx,cy,-x+1,ox-pxw+w+wod,-oy,-h+oy+hod,pxw,h);ox=x;oy=y;}
else
{tt-=aa*((y<<1)-3);st-=(aa<<1)*(--y);}}
this.mkDiv(cx-a,cy-oy,s,(oy<<1)+hod);this.mkDiv(cx+a+wod-s+1,cy-oy,s,(oy<<1)+hod);}
else
{var _a=(width-((s-1)<<1))>>1,_b=(height-((s-1)<<1))>>1,_x=0,_y=_b,_aa=(_a*_a)<<1,_bb=(_b*_b)<<1,_st=(_aa>>1)*(1-(_b<<1))+_bb,_tt=(_bb>>1)-_aa*((_b<<1)-1),pxl=new Array(),pxt=new Array(),_pxb=new Array();pxl[0]=0;pxt[0]=b;_pxb[0]=_b-1;while(y>0)
{if(st<0)
{st+=bb*((x<<1)+3);tt+=(bb<<1)*(++x);pxl[pxl.length]=x;pxt[pxt.length]=y;}
else if(tt<0)
{st+=bb*((x<<1)+3)-(aa<<1)*(y-1);tt+=(bb<<1)*(++x)-aa*(((y--)<<1)-3);pxl[pxl.length]=x;pxt[pxt.length]=y;}
else
{tt-=aa*((y<<1)-3);st-=(aa<<1)*(--y);}
if(_y>0)
{if(_st<0)
{_st+=_bb*((_x<<1)+3);_tt+=(_bb<<1)*(++_x);_pxb[_pxb.length]=_y-1;}
else if(_tt<0)
{_st+=_bb*((_x<<1)+3)-(_aa<<1)*(_y-1);_tt+=(_bb<<1)*(++_x)-_aa*(((_y--)<<1)-3);_pxb[_pxb.length]=_y-1;}
else
{_tt-=_aa*((_y<<1)-3);_st-=(_aa<<1)*(--_y);_pxb[_pxb.length-1]--;}}}
var ox=0,oy=b,_oy=_pxb[0],l=pxl.length,w,h;for(var i=0;i<l;i++)
{if(typeof _pxb[i]!="undefined")
{if(_pxb[i]<_oy||pxt[i]<oy)
{x=pxl[i];this.mkOvQds(cx,cy,-x+1,ox+wod,-oy,_oy+hod,x-ox,oy-_oy);ox=x;oy=pxt[i];_oy=_pxb[i];}}
else
{x=pxl[i];this.mkDiv(cx-x+1,cy-oy,1,(oy<<1)+hod);this.mkDiv(cx+ox+wod,cy-oy,1,(oy<<1)+hod);ox=x;oy=pxt[i];}}
this.mkDiv(cx-a,cy-oy,1,(oy<<1)+hod);this.mkDiv(cx+ox+wod,cy-oy,1,(oy<<1)+hod);}}
function mkOvDott(left,top,width,height)
{var a=width>>1,b=height>>1,wod=width&1,hod=height&1,cx=left+a,cy=top+b,x=0,y=b,aa2=(a*a)<<1,aa4=aa2<<1,bb=(b*b)<<1,st=(aa2>>1)*(1-(b<<1))+bb,tt=(bb>>1)-aa2*((b<<1)-1),drw=true;while(y>0)
{if(st<0)
{st+=bb*((x<<1)+3);tt+=(bb<<1)*(++x);}
else if(tt<0)
{st+=bb*((x<<1)+3)-aa4*(y-1);tt+=(bb<<1)*(++x)-aa2*(((y--)<<1)-3);}
else
{tt-=aa2*((y<<1)-3);st-=aa4*(--y);}
if(drw)this.mkOvQds(cx,cy,-x,x+wod,-y,y+hod,1,1);drw=!drw;}}
function mkRect(x,y,w,h)
{var s=this.stroke;this.mkDiv(x,y,w,s);this.mkDiv(x+w,y,s,h);this.mkDiv(x,y+h,w+s,s);this.mkDiv(x,y+s,s,h-s);}
function mkRectDott(x,y,w,h)
{this.drawLine(x,y,x+w,y);this.drawLine(x+w,y,x+w,y+h);this.drawLine(x,y+h,x+w,y+h);this.drawLine(x,y,x,y+h);}
function jsgFont()
{this.PLAIN='font-weight:normal;';this.BOLD='font-weight:bold;';this.ITALIC='font-style:italic;';this.ITALIC_BOLD=this.ITALIC+this.BOLD;this.BOLD_ITALIC=this.ITALIC_BOLD;}
var Font=new jsgFont();function jsgStroke()
{this.DOTTED=-1;}
var Stroke=new jsgStroke();function jsGraphics(id,wnd)
{this.setColor=new Function('arg','this.color = arg.toLowerCase();');this.setStroke=function(x)
{this.stroke=x;if(!(x+1))
{this.drawLine=mkLinDott;this.mkOv=mkOvDott;this.drawRect=mkRectDott;}
else if(x-1>0)
{this.drawLine=mkLin2D;this.mkOv=mkOv2D;this.drawRect=mkRect;}
else
{this.drawLine=mkLin;this.mkOv=mkOv;this.drawRect=mkRect;}};this.setPrintable=function(arg)
{this.printable=arg;if(jg_fast)
{this.mkDiv=mkDivIe;this.htmRpc=arg?htmPrtRpc:htmRpc;}
else this.mkDiv=jg_n4?mkLyr:arg?mkDivPrt:mkDiv;};this.setFont=function(fam,sz,sty)
{this.ftFam=fam;this.ftSz=sz;this.ftSty=sty||Font.PLAIN;};this.drawPolyline=this.drawPolyLine=function(x,y,s)
{for(var i=0;i<x.length-1;i++)
this.drawLine(x[i],y[i],x[i+1],y[i+1]);};this.fillRect=function(x,y,w,h)
{this.mkDiv(x,y,w,h);};this.drawPolygon=function(x,y)
{this.drawPolyline(x,y);this.drawLine(x[x.length-1],y[x.length-1],x[0],y[0]);};this.drawEllipse=this.drawOval=function(x,y,w,h)
{this.mkOv(x,y,w,h);};this.fillEllipse=this.fillOval=function(left,top,w,h)
{var a=(w-=1)>>1,b=(h-=1)>>1,wod=(w&1)+1,hod=(h&1)+1,cx=left+a,cy=top+b,x=0,y=b,ox=0,oy=b,aa2=(a*a)<<1,aa4=aa2<<1,bb=(b*b)<<1,st=(aa2>>1)*(1-(b<<1))+bb,tt=(bb>>1)-aa2*((b<<1)-1),pxl,dw,dh;if(w+1)while(y>0)
{if(st<0)
{st+=bb*((x<<1)+3);tt+=(bb<<1)*(++x);}
else if(tt<0)
{st+=bb*((x<<1)+3)-aa4*(y-1);pxl=cx-x;dw=(x<<1)+wod;tt+=(bb<<1)*(++x)-aa2*(((y--)<<1)-3);dh=oy-y;this.mkDiv(pxl,cy-oy,dw,dh);this.mkDiv(pxl,cy+y+hod,dw,dh);ox=x;oy=y;}
else
{tt-=aa2*((y<<1)-3);st-=aa4*(--y);}}
this.mkDiv(cx-a,cy-oy,w+1,(oy<<1)+hod);};this.fillPolygon=function(array_x,array_y)
{var i;var y;var miny,maxy;var x1,y1;var x2,y2;var ind1,ind2;var ints;var n=array_x.length;if(!n)return;miny=array_y[0];maxy=array_y[0];for(i=1;i<n;i++)
{if(array_y[i]<miny)
miny=array_y[i];if(array_y[i]>maxy)
maxy=array_y[i];}
for(y=miny;y<=maxy;y++)
{var polyInts=new Array();ints=0;for(i=0;i<n;i++)
{if(!i)
{ind1=n-1;ind2=0;}
else
{ind1=i-1;ind2=i;}
y1=array_y[ind1];y2=array_y[ind2];if(y1<y2)
{x1=array_x[ind1];x2=array_x[ind2];}
else if(y1>y2)
{y2=array_y[ind1];y1=array_y[ind2];x2=array_x[ind1];x1=array_x[ind2];}
else continue;if((y>=y1)&&(y<y2))
polyInts[ints++]=Math.round((y-y1)*(x2-x1)/(y2-y1)+x1);else if((y==maxy)&&(y>y1)&&(y<=y2))
polyInts[ints++]=Math.round((y-y1)*(x2-x1)/(y2-y1)+x1);}
polyInts.sort(integer_compare);for(i=0;i<ints;i+=2)
this.mkDiv(polyInts[i],y,polyInts[i+1]-polyInts[i]+1,1);}};this.drawString=function(txt,x,y)
{this.htm+='<div style="position:absolute;white-space:nowrap;'+'left:'+x+'px;'+'top:'+y+'px;'+'font-family:'+this.ftFam+';'+'font-size:'+this.ftSz+';'+'color:'+this.color+';'+this.ftSty+'">'+
txt+'<\/div>';};this.drawStringRect=function(txt,x,y,width,halign)
{this.htm+='<div style="position:absolute;overflow:hidden;'+'left:'+x+'px;'+'top:'+y+'px;'+'width:'+width+'px;'+'text-align:'+halign+';'+'font-family:'+this.ftFam+';'+'font-size:'+this.ftSz+';'+'color:'+this.color+';'+this.ftSty+'">'+
txt+'<\/div>';};this.drawImage=function(imgSrc,x,y,w,h,a)
{this.htm+='<div style="position:absolute;'+'left:'+x+'px;'+'top:'+y+'px;'+'width:'+w+'px;'+'height:'+h+'px;">'+'<img src="'+imgSrc+'" width="'+w+'" height="'+h+'"'+(a?(' '+a):'')+'>'+'<\/div>';};this.clear=function()
{this.htm="";if(this.cnv)this.cnv.innerHTML=this.defhtm;};this.mkOvQds=function(cx,cy,xl,xr,yt,yb,w,h)
{this.mkDiv(xr+cx,yt+cy,w,h);this.mkDiv(xr+cx,yb+cy,w,h);this.mkDiv(xl+cx,yb+cy,w,h);this.mkDiv(xl+cx,yt+cy,w,h);};this.setStroke(1);this.setFont('verdana,geneva,helvetica,sans-serif',String.fromCharCode(0x31,0x32,0x70,0x78),Font.PLAIN);this.color='#000000';this.htm='';this.wnd=wnd||window;if(!(jg_ie||jg_dom||jg_ihtm))chkDHTM();if(typeof id!='string'||!id)this.paint=pntDoc;else
{this.cnv=document.all?(this.wnd.document.all[id]||null):document.getElementById?(this.wnd.document.getElementById(id)||null):null;this.defhtm=(this.cnv&&this.cnv.innerHTML)?this.cnv.innerHTML:'';this.paint=jg_dom?pntCnvDom:jg_ie?pntCnvIe:jg_ihtm?pntCnvIhtm:pntCnv;}
this.setPrintable(false);}
function integer_compare(x,y)
{return(x<y)?-1:((x>y)*1);}
function insertClick(e){getMapXY(e);$('site').style.top=(theY-11)+'px';$('site').style.left=(theX-11)+'px';$('site').style.display="block";var xy=convertPixelToMap(theX,theY);$('lat').value=xy[1];$('lon').value=xy[0];try{$('name').value="";}catch(e){}}
var dataType='mammal';function setDataType(type){dataType=type;alert(dataType);}
function setDataSubmissionForm(type){
    dataType = type;

    var page = "" + document.location;
    if (dataType=='mammal'){
        if(page.indexOf("submitFrog.do") >=0 || page.indexOf("editfrog.do") >=0
            || page.indexOf("submitWorm.do") >=0 || page.indexOf("editworm.do") >=0 ){
            document.location ="submit2.do?t=mammal";
        }
        try{
            $('birdSelect').style.display = 'none';
            $('birdLabel').style.display = 'none';
            $('herpLabel').style.display = 'none';
            $('herpSelect').style.display = 'none';
            $('mammalSelect').style.display = 'block';
            $('mammalLabel').style.display = 'block';
        } catch(e) {}
    }else if (dataType=='bird'){
        if(page.indexOf("submitFrog.do") >=0 || page.indexOf("editfrog.do") >=0
            || page.indexOf("submitWorm.do") >=0 || page.indexOf("editworm.do") >=0 ){
            document.location ="submit2.do?t=bird";
        }
        try{
            $('herpLabel').style.display = 'none';
            $('herpSelect').style.display = 'none';
            $('mammalLabel').style.display = 'none';
            $('mammalSelect').style.display = 'none';
            $('birdSelect').style.display = 'block';
            $('birdLabel').style.display = 'block';
        } catch(e) {}
    }else if (dataType=='herp'){
        if(page.indexOf("submitFrog.do") >=0 || page.indexOf("editfrog.do") >=0
            || page.indexOf("submitWorm.do") >=0 || page.indexOf("editworm.do") >=0 ){
            document.location ="submit2.do?t=herp";
        }
        try{
            $('birdSelect').style.display = 'none';
            $('birdLabel').style.display = 'none';
            $('mammalLabel').style.display = 'none';
            $('mammalSelect').style.display = 'none';
            $('herpSelect').style.display = 'block';
            $('herpLabel').style.display = 'block';
        } catch(e) {}
    }else if (dataType=='prj_frog'){
        if(page.indexOf("submitFrog.do" ) ==-1 ){
            document.location ="submitFrog.do";
        }
    }else if (dataType=='prj_worm'){
        if(page.indexOf("submitWorm.do" ) ==-1 ){
            document.location ="submitWorm.do";
        }
    }
}
function setNotes(isChecked){if(isChecked)$('notesbox').disabled=false;else $('notesbox').disabled=true;}
function setLocation(isChecked){if(isChecked)$('locationName').disabled=false;else $('locationName').disabled=true;}
function setLatLon(coords){if(coords!=""){try{var y=coords.split("|")[0];var x=coords.split("|")[1];var t=.02;try{$('lat').value=y;$('lon').value=x;$('name').value=coords.split("|")[2];}catch(e){}
zoombarClick('zoom5',x,y);}catch(e){alert(e);}}}
function toggleUserFilter(isChecked){$('sitename').checked=isChecked;$('sitename').disabled=true;}
function doSelectAll(isChecked){if(isChecked){$('obscounty').checked=true;$('lat').checked=true;$('lon').checked=true;$('plotno').checked=true;$('obstype').checked=true;$('obstm').checked=true;$('notes').checked=true;$('habitat').checked=true;$('obsspecies').checked=true;$('count').checked=true;try{if($('user').checked==true){$('sitename').checked=true;}}catch(e){}}else{$('obscounty').checked=false;$('lat').checked=false;$('lon').checked=false;$('plotno').checked=false;$('obstype').checked=false;$('obstm').checked=false;$('notes').checked=false;$('habitat').checked=false;$('obsspecies').checked=false;$('count').checked=false;try{$('sitename').checked=false;}catch(e){}}}
function calcTemps(form){var temp;var wtemp;if(form.degreesIn.value=='f'){try{temp=(5/9)*(form.temperature.value-32);form.temperature.value=temp;}catch(e){}}
if(form.degrees2In.value=='f'){try{wtemp=(5/9)*(form.water_temperature.value-32);form.water_temperature.value=wtemp;}catch(e){}}
return true;}
var myX;var myY;function setupHelp(){Event.observe(document,'mousemove',function(event){myX=Event.pointerX(event);myY=Event.pointerY(event);});try{Event.stop(event);}catch(e){}}
function showHelp(id){var content;var xpos;var ypos;var boxwidth=200+40;var yOffset=120;content='<div><div style="float: left"><img src="images/help_question.gif"></div><div style="float: right"><a href="javascript: hideHelp()" style="text-decoration: none;color: #A3CB7F;">close</a></div></div><br>';content+='<div style="padding: 5px;">';switch(id){case 1:xpos=myX;ypos=myY;content+="Submitting data is a three step process. <br><b>Step 1:</b><br> In step one you will use the map interface to locate your sight. You will then press 'Continue' to move to step two. <br><b>Step 2:</b><br> Step two allows you to enter multiple entries at your current location. Once you have entered all of your sighting you can continue to step three. <br><b>Step 3:</b><br>  At step three you review and confirm the data you entered. Once you have confirmed your entries you may submit them into the Nature Mapping database.";break;case 2:xpos=myX-boxwidth;ypos=myY-yOffset;content+="Click <a href=\"profile2.do\">here</a> to manage your saved locations. You can also access your locations from the 'Edit Profile' link above.";break;case 3:xpos=myX-boxwidth;ypos=myY;content+="This menu displays your current entries. These items will not be entered into the Nature Mapping database until you complete the 'Submit Data' process. Use this menu to edit or delete your current entries.";break;case 4:xpos=myX-boxwidth;ypos=myY;content+="The Nature Mapping data explorer is an interactive web mapping application used to view observations from the Nature Mapping database. <br>To Interact with the map, select a tool from the tool bar then click in the map area.<br> Add or remove data from the map by using the selection options on the right.";break;case 5:xpos=myX-boxwidth;ypos=myY;content+="To search by using the map, click the tool button under this option.  Use the directional arrows around the map and the zoom in/out feature on top of the map to navigate to your location.  If you know your location's Zip Code, first search by address using the Zip Code.  This will jump you to the center of that Zip Code.  Then, select Edit next to Add Site.  Next, select Plot on Map.  Now, you can navigate to your location.";break;case 6:xpos=myX-boxwidth;ypos=myY;content+="Select this to use the model's suggested trade area.";break;case 7:xpos=myX-boxwidth;ypos=myY;content+="Select this to use your trade area.";break;case 8:xpos=myX-boxwidth;ypos=myY;content+="Select this to customize a trade area.  First, click the tool button under this option.  Then, use your mouse to click on the map and draw where you would like your trade area.  Double-click on the last node to close and view your trade area.";break;case 9:xpos=myX-boxwidth;ypos=myY;content+="This represents the density classification of your selected site and trade area.  Either Urban, Suburban, or Rural will automatically be determined for you.";break;case 10:xpos=myX-boxwidth;ypos=myY;content+="Enter the retail SQFT of the proposed new site.";break;case 11:xpos=myX-boxwidth;ypos=myY;content+="This equals the number of households in your proposed new trade area.  You can edit this value prior to running the analysis.";break;case 12:xpos=myX-boxwidth;ypos=myY;content+="This represents the distance of your proposed site to the nearest big box (Home Depot, Lowes, or Menards by default).  You can edit this value prior to running the analysis.";break;case 13:xpos=myX-boxwidth;ypos=myY;content+="Equals the median household income in your proposed new trade area.  You can edit this value prior to running the analysis.";break;case 14:xpos=myX-boxwidth;ypos=myY;content+="The logic for Estimated Full Time Equivalents is:  there are 1.5 Estimated Full Time Equivalents per 1000 sqft.  For a 14,000 sqft store, the default FTE value is 21.  This variable has a positive impact on the sales forecast. You can edit this prior to running the analysis.";break;case 15:xpos=myX-boxwidth;ypos=myY;content+="When checked, this will require that analog stores be of the same density class as the proposed new new store.  Uncheck to include all density class stores for consideration in the analog model.  ";break;case 16:xpos=myX-boxwidth;ypos=myY;content+="Enter a name for this sales forecast.  This will become the file name in your History folder, if you choose to save this analysis.";break;case 17:xpos=myX-boxwidth;ypos=myY;content+="Click \"Preview Forecast\" to open Excel and view your site's sales forecast.  ";break;case 18:xpos=myX-boxwidth;ypos=myY;content+="Select this option to save this sales forecast in your History folder.  ";break;case 19:xpos=myX-boxwidth;ypos=myY;content+="Select this option if you do not want to save this sales forecast in your History folder.";break;default:break;}
content+='</div>';$('helpWindow').innerHTML=content;$('helpWindow').style.top=""+ypos+"px";$('helpWindow').style.left=""+xpos+"px";$('helpWindow').style.display="block";}
function hideHelp(){$('helpWindow').style.display="none";try{Event.stop(event);}catch(e){}}