if(window.gecko&&navigator.mozIsLocallyAvailable){window.gecko3=true}if($chk(Group)){Group.implement({initialize:function(){this.instances=(arguments.length==1&&$type(arguments[0])=="array")?$A(arguments[0]):$A(arguments);this.events={};this.checker={}}})}Element.extend({destroy:function(A){this.hasChild?(this.getChildren().destroy()):this.empty();$chk(A)?this.replaceWith(A):this.remove()},replaceImg:function(A){if(this.getTag()=="img"&&A.getTag()=="img"){return A.replaceWith(this.setProperties(A.getProperties("id","class","alt","title")))}else{return null}}});function $max(A){A.push(Math.max(A.pop(),A.pop()));return(A.length==1)?A[0]:$max(A)}function $pgSz(){$$($("lft"),$("cen"),$("rgt")).setStyle(window.ie?"height":"min-height",$("hld").getSize().size.y)}function $lambda(A){return(typeof A=="function")?A:function(){return A}}function $defined(A){return(A!=undefined)}function getSub(B){var A=ajReg.filter(function(C,D){return C.id==B});return A[0]?A[0].subregions:[]}function getLnk(){var C=$("reg").getValue().toInt();var B=$("sub").getValue().toInt();var A=$("act").getValue().toInt();if(C>0){return(C>0?("/region_"+C):"")+(B>0?("/subregion_"+B):"")+(A>0?("/activity_"+A):"")}else{return false}}function doSearch(){var A=getLnk();if(!A){alert("Please narrow your search, by selecting a region.")}else{doLink("/search"+A)}return A}function loadSub(A){$ES("option",$("sub")).forEach(function(D,C){if(D.getProperty("value").toInt()>0){D.destroy()}});var B=new Element("option",{value:0}).setText("Select Subregion").injectInside($("act"));getSub(this.getValue().toInt()).forEach(function(C,D){var E=new Element("option",{id:"oS"+C.id,value:C.id}).setText(C.name).injectInside($("sub"));E.selected=$pick(C.sel,false)})}function loadReg(){$("reg").empty();var A=new Element("option",{value:0}).setText("Select Region").injectInside($("reg"));ajReg.forEach(function(B,C){var D=new Element("option",{id:"oR"+B.id,value:B.id}).setText(B.name).injectInside($("reg"));D.selected=$pick(B.sel,false)});loadSub.attempt([],$("reg"))}function loadAct(){$("act").empty();var A=new Element("option",{value:0}).setText("Select Activity").injectInside($("act"));ajAct.forEach(function(D,B){var C=new Element("option",{value:D.id}).setText(D.name).injectInside($("act"));C.selected=D.sel})}var searchReady=false;function pgSz(A){window.addEvent("domready",function(){if(A){$("reg").onchange=loadSub.bindAsEventListener($("reg"));loadReg();loadAct();if(searchReady){searchReadyFunc()}else{searchReady=true}}})}var imgA;function doAjaxImg(A){if(!$chk(imgA)){imgA=Asset.image("/images/ajax-sm.gif",{"class":"ajax",title:"Loading"})}if($chk(A)){imgA.injectInside(A)}return imgA}function addZebra(){$ES("tr",this).forEach(function(B,A){B.addClass(A%2==1?"even":"odd")})}function doZebra(){window.addEvent("domready",function(){$ES("table.zebra").forEach(function(B,A){addZebra.attempt([],B)})})}var intNumPop=0;var dS;function msAgo(){return dS?((new Date()).getTime()-dS):-1}function popUp(){var B=arguments[0];B=($type(B)=="object")?$(new Event(B).target).getProperty("href"):B;var A=arguments[1];var C=arguments[2];if(B){var D=($chk(A)&&$chk(C))?window.open(B,"","scrollbars=1,width="+A+",height="+C):window.open(B);return false}else{return true}}function doLink(A){document.location.href=A;return false}function doSubmit(B){var C=$(B);var A=new Element("input",{type:"hidden",name:"jsSubmit",value:"submit"});A.injectInside(C);C.submit();return false}function checkAll(D,A){var B=$ES("input[name="+A+"]");var C=$(D).getProperty("checked");B.setProperty("checked",C)}function createClose(A){var B=new Element("img",{styles:{"border-left":"1px #000000 solid","border-bottom":"1px #000000 solid"},src:"/images/icons/cancel.png",alt:"[Close]","class":"jsLnk close",id:"divAjaxClose"+intNumPop});B.addEvent("click",function(){A.remove()});B.injectInside(A)}function doPopupDiv(D,I,G,E,H,F){var C=16;var B=8;if(G+F+2*B>getScrollHeight()){G-=(2*B+H+G-getScrollHeight())}if(E+F+2*C>getScrollWidth()){E-=(2*C+F+E-getScrollWidth())}var K=new Element("div",{styles:{position:"absolute","z-index":"100",top:G+"px",left:E+"px",height:"auto",width:F+"px",padding:C+"px "+B+"px",border:"1px #333333 solid","background-color":"#EEEEEE","font-family":"Verdana","font-size":"90%",overflow:"hidden","text-align":I},"class":"ajaxPopUp",name:"ajaxPopUp",id:"divAjaxPopUp"+intNumPop});K.setHTML(D);K.injectAfter($E("div"));var A=K.getCoordinates().right;var J=A-getScrollWidth();if(J>0){K.setStyle("left",A)}createClose(K);intNumPop++;return K}function doAjaxPopup(B,G,K,D,H,F,N,M){var J=B?new Event(B):false;var I=$(J.target);var L;var E=J?J.page.y-6:this.getPosition().y;var C=J?J.page.x-6:this.getPosition().x;var A=new Ajax(G,{method:"get",onFailure:function(){doLink(G+"?"+K)},onSuccess:function(O){if(F){$ES("div[name=ajaxPopUp]").each(function(Q){Q.remove()})}var P=doPopupDiv(O,"center",E,C,H,D);if($chk(N)){(function(){P.remove()}).delay(N)}if($chk(M)){if($chk(I)){M.attempt([P],I)}else{M()}}}});if(K===""){A.request("rnd="+$random(100000,999999))}else{A.request(K+"&amp;rnd="+$random(100000,999999))}return false}function doTextPopup(A,D,H,C,G,F){var I=new Event(A);var J;var E=I.page.y-6;var B=I.page.x-6;if(H===""){H="left"}if(F){$ES("div[name=ajaxPopUp]").each(function(K){K.remove()})}doPopupDiv(D,H,E,B,G,C);return false}function doObjRemoval(A){var B=$(A);if($chk(B)){B.empty();B.remove()}}function rmvErr(A){p=($chk(A))?$(A).getParent().getParent():null;if($chk(p)){p.removeClass("error")}};