text: this.JSON||(this.JSON={});
  (function(){function b(a){return 10>a?"0"+a:a}function a(a){d.lastIndex=0;return d.test(a)?'"'+a.replace(d,function(a){var c=k[a];return"string"===typeof c?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function c(b,e){var d,q,r,k,s=f,p,m=e[b];m&&"object"===typeof m&&"function"===typeof m.toJSON&&(m=m.toJSON(b));"function"===typeof g&&(m=g.call(e,b,m));switch(typeof m){case "string":return a(m);case "number":return isFinite(m)?String(m):"null";case "boolean":case "null":return String(m);case "object":if(!m)return"null";
  f+=h;p=[];if("[object Array]"===Object.prototype.toString.apply(m)){k=m.length;for(d=0;d<k;d+=1)p[d]=c(d,m)||"null";r=0===p.length?"[]":f?"[\n"+f+p.join(",\n"+f)+"\n"+s+"]":"["+p.join(",")+"]";f=s;return r}if(g&&"object"===typeof g)for(k=g.length,d=0;d<k;d+=1)q=g[d],"string"===typeof q&&(r=c(q,m))&&p.push(a(q)+(f?": ":":")+r);else for(q in m)Object.hasOwnProperty.call(m,q)&&(r=c(q,m))&&p.push(a(q)+(f?": ":":")+r);r=0===p.length?"{}":f?"{\n"+f+p.join(",\n"+f)+"\n"+s+"}":"{"+p.join(",")+"}";f=s;return r}}
  "function"!==typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(a){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+b(this.getUTCMonth()+1)+"-"+b(this.getUTCDate())+"T"+b(this.getUTCHours())+":"+b(this.getUTCMinutes())+":"+b(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()});var e=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,d=
  /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f,h,k={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},g;"function"!==typeof JSON.stringify&&(JSON.stringify=function(a,b,e){var d;h=f="";if("number"===typeof e)for(d=0;d<e;d+=1)h+=" ";else"string"===typeof e&&(h=e);if((g=b)&&"function"!==typeof b&&("object"!==typeof b||"number"!==typeof b.length))throw Error("JSON.stringify");return c("",{"":a})});
  "function"!==typeof JSON.parse&&(JSON.parse=function(a,b){function c(a,e){var d,f,g=a[e];if(g&&"object"===typeof g)for(d in g)Object.hasOwnProperty.call(g,d)&&(f=c(g,d),void 0!==f?g[d]=f:delete g[d]);return b.call(a,e,g)}var d;a=String(a);e.lastIndex=0;e.test(a)&&(a=a.replace(e,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
  "]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return d=eval("("+a+")"),"function"===typeof b?c({"":d},""):d;throw new SyntaxError("JSON.parse");})})();
  (function(b){function a(a){return a&&a.constructor===Number?a+"px":a}b.fn.bgiframe=b.browser.msie&&/msie 6\.0/i.test(navigator.userAgent)?function(c){c=b.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:!0,src:"javascript:false;"},c);var e='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+c.src+'"style="display:block;position:absolute;z-index:-1;'+(!1!==c.opacity?"filter:Alpha(Opacity='0');":"")+"top:"+("auto"==c.top?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":
  a(c.top))+";left:"+("auto"==c.left?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":a(c.left))+";width:"+("auto"==c.width?"expression(this.parentNode.offsetWidth+'px')":a(c.width))+";height:"+("auto"==c.height?"expression(this.parentNode.offsetHeight+'px')":a(c.height))+';"/>';return this.each(function(){0===b(this).children("iframe.bgiframe").length&&this.insertBefore(document.createElement(e),this.firstChild)})}:function(){return this};b.fn.bgIframe=b.fn.bgiframe})(jQuery);
  function get_form_values(b){var a={};jQuery(b).find("input,select,textarea").each(function(b){if(this.name)if(a[this.name]||(a[this.name]=[]),"select"===this.nodeName.toLowerCase()){var e=a[this.name];$(this).find("option").each(function(a){this.selected&&e.push(this.value)})}else("input"!==this.nodeName.toLowerCase()||"checkbox"!==this.type&&"radio"!==this.type||this.checked)&&a[this.name].push(this.value||"")});return a}
  function restore_form_values(b,a){var c=jQuery;c(b).find("input,select,textarea").each(function(b){if(this.name){var d=a[this.name];"undefined"!=typeof d&&null!==d&&("input"!==this.nodeName.toLowerCase()||"checkbox"!==this.type&&"radio"!==this.type?"select"===this.nodeName.toLowerCase()?c(this).find("option").each(function(a){this.selected=1<d.length?0<=c.inArray(this.value,d):0==d.length?!1:this.value===d[0]}):this.value=d.length?d[0]:"":this.checked=1<d.length?0<=c.inArray(this.value,d):0==d.length?
  !1:this.value===d[0])}})}
  function init_cached_state(b){var a=jQuery;b=b||"#EntryForm";onbeforeunload_fns=[];onbeforerestorevalues_fns=[];window.onbeforeunload=function(){var c={form_values:get_form_values(b)};a.each(onbeforeunload_fns,function(a,b){b(c)});document.getElementById("cache_form_values").value=JSON.stringify(c)};window.cache_register_onbeforeunload=function(a){onbeforeunload_fns.push(a)};window.cache_register_onbeforerestorevalues=function(a){onbeforerestorevalues_fns.push(a)};window.restore_cached_state=function(){var c=
  document.getElementById("cache_form_values");if(c.value){var e=JSON.parse(c.value);a.each(onbeforerestorevalues_fns,function(a,b){b(e)});restore_form_values(b,e.form_values)}}}
  (function(){var b=function(a){a=a.toLowerCase();a=a.replace(RegExp("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]","g"),"a");a=a.replace(RegExp("\u00e6","g"),"ae");a=a.replace(RegExp("\u00e7","g"),"c");a=a.replace(RegExp("[\u00e8\u00e9\u00ea\u00eb]","g"),"e");a=a.replace(RegExp("[\u00ec\u00ed\u00ee\u00ef]","g"),"i");a=a.replace(RegExp("\u00f1","g"),"n");a=a.replace(RegExp("[\u00f2\u00f3\u00f4\u00f5\u00f6]","g"),"o");a=a.replace(RegExp("\u009c","g"),"oe");a=a.replace(RegExp("[\u00f9\u00fa\u00fb\u00fc]","g"),
  "u");return a=a.replace(RegExp("[\u00fd\u00ff]","g"),"y")};window.string_ci_ai=b;var a=function(a,d,c,h,k){c=c||"value";h=h||"";k=k||"";return function(g,l){if(d.term&&(new RegExp(h+a.ui.autocomplete.escapeRegex(d.term)+k,"i")).test(g.term)&&d.content&&13>d.content.length){var n=new RegExp(h+a.ui.autocomplete.escapeRegex(g.term)+k,"i");l(a.grep(d.content,function(a){return n.test(b(a[c]))}));return!0}return!1}};window.default_cache_search_fn=a;var c=function(c,d,f,h,k){f=f||{};k=k||a(c,f,h||"value");
  return function(a,h,n){a.term=b(a.term);f.term===a.term&&f.content?h(f.content):k(a,h)||c.ajax({url:n||d,dataType:"json",data:a,cache:!1,success:function(b){f.term=a.term;f.content=b;h(b)}})}};window.create_caching_source_fn=c;window.init_community_autocomplete=function(a,b,f,h){a("#"+b).autocomplete({focus:function(a,b){return!1},source:c(a,f),minLength:h})}})();"undefined"==typeof entryform&&(entryform={});
  function create_checklist_onbefore_fns(b,a,c,e){cache_register_onbeforeunload(function(b){b[a+"_added"]=c});cache_register_onbeforerestorevalues(function(c){(c=c[a+"_added"])&&b.each(c,function(a,b){e(b.chkid,b.display,"")})})}
  function basic_chk_add_html(b,a){return function(c,e){b("#"+a+"_existing_add_table").append(b("<tr>").append(b("<td>").append(b("<input>").prop({id:a+"_ID_"+c,type:"checkbox",checked:!0,defaultChecked:!0,name:a+"_ID",value:c})).append(document.createTextNode(" "+e))).append(b("<td>").append(b("<input>").prop({id:a+"_NOTES_"+c,name:a+"_NOTES_"+c,size:entryform.chk_notes_size,maxlength:entryform.chk_notes_maxlen}))))}}
  function init_autocomplete_checklist(b,a){var c=a.field,e=a.source;a.minLength=a.minLength||1;a.delay=a.delay||300;a.add_new_html=a.add_new_html||basic_chk_add_html(b,c);a.match_prop=a.match_prop||"value";var d=a.added_values||[],f=function(b,f){var e=document.getElementById(c+"_ID_"+b);e?e.checked=!0:(d.push({chkid:b,display:f}),a.add_new_html(b,f))};create_checklist_onbefore_fns(b,c,d,f);var h=b("#NEW_"+c),k={},g=function(a){h.data({chkid:"",display:""}).prop("value","").focus();b("#"+c+"_error").hide("slow",
  function(){b(this).remove()})},l=null,n=null;(function(c){b.isArray(c)?(n=function(d,f){var e=new RegExp(b.ui.autocomplete.escapeRegex(string_ci_ai(d.term)));f(b.grep(c,function(b){return e.test(string_ci_ai(b[a.match_prop]||b))}))},l=function(d,f){var e=string_ci_ai(d),g=b.grep(c,function(b){return string_ci_ai(string_ci_ai(b[a.match_prop]||b))===e});if(1===g.length)return f(g[0]),!0;f()}):"string"===typeof c?(n=create_caching_source_fn(b,c,k,a.match_prop),l=function(c,d,f){var e=string_ci_ai(c);
  if(k.content){var g=b.grep(k.content,function(b){return string_ci_ai(b[a.match_prop])===e});if(1===g.length){d(g[0]);return}}f||string_ci_ai(k.term||"")===e?d():n({term:e},function(a){l(c,d,!0)})}):(n=c,l=a.look_for_fn)})(e);var t=b("#add_"+c).click(function(d){d=h.data("chkid");var e=h.data("display"),n=h[0].value;d&&e&&e==n?(f(d,e),g()):l(h[0].value,function(d){d?(f(d.chkid,d[a.match_prop]),g()):0===b("#"+c+"_error").length&&(b("#"+c+"_new_input_table").before(b('<div class="ui-widget clearfix" style="margin: 0.25em;">\r\n                <div class="ui-state-error error-field-wrapper"> \r\n                <span class="ui-icon ui-icon-alert error-notice-icon"></span>[MSG]\r\n                </div>\r\n            </div>'.replace("[MSG]",
  b("<div>").text(a.not_found_msg||"Not Found").html())).hide().prop("id",c+"_error")),b("#"+c+"_error").show("slow"))})});h.autocomplete({focus:function(a,b){return!1},source:n,minLength:a.minLength,delay:a.delay,select:function(b,c){h.data({chkid:c.item.chkid,display:c.item[a.match_prop]})}}).keypress(function(a){"13"==a.keyCode&&(a.preventDefault(),h.autocomplete("close"),t.trigger("click"))})}
  function only_items_chk_add_html(b,a,c){return function(e,d){c&&c();b("#"+a+"_existing_add_container").append(b("<input>").prop({id:a+"_ID_"+e,type:"checkbox",checked:!0,defaultChecked:!0,name:a+"_ID",value:e})).append("&nbsp;").append(document.createTextNode(d)).append(" ; ")}}
  function init_check_for_autochecklist(b){var a=jQuery,c=function(b){b=a(this).data("jump_location");(b=document.getElementById(b))&&b.scrollIntoView(!0)},e=function(){return a("<li>").append(a("<span>").data("jump_location",this.id).addClass("UnaddedChecklistJump SimulateLink").append(a(this).parentsUntil("td[data-field-display-name]").parent().data("fieldDisplayName")))},d=a("input[id^=NEW_]");d.length&&(a("#EntryForm").submit(function(c){var h=d.map(function(){return this.value?this:null});if(h.length&&
  !c.isDefaultPrevented()){if(!confirm(b)){c.preventDefault();a("#SUBMIT_BUTTON").prop("disabled",!1);c=a("#unadded_checklist_error_box");var k=a("#unadded_checklist_error_list"),g=c.is(":visible");g&&k.children("ul:first").hide("slow",function(){a(this).remove()});var l=a("<ul>");g&&l.hide();k.append(l);a.each(h.map(e),function(){l.append(this)});g?l.show("slow"):c.show("slow")}}else c.isDefaultPrevented()&&(c=a("#unadded_checklist_error_box"),k=a("#unadded_checklist_error_list"),c.hide("slow",function(){k.children().remove()}))}),
  a(".UnaddedChecklistJump").live("click",c))}
  (function(){var b=jQuery;window.init_municipality_autocomplete=function(a,c,e){a.each(function(){var a={},f=this,h=this.id.replace("Web",""),k=b("#"+h),g=b(this).data("cm_info",{value:this.value,chkid:k[0].value}).autocomplete({focus:function(a,b){return!1},source:create_caching_source_fn(b,c,a),minLength:1,select:function(a,b){g.data("cm_info",{chkid:b.item.chkid,value:b.item.value})},close:function(){g.is(":focus")||l()}}).keypress(function(a){"13"==a.keyCode&&(a.preventDefault(),g.autocomplete("close"))}),
  l=function(){var c=g.data("cm_info"),h=f.value,l;if(h)if(c&&c.chkid&&c.value&&c.value===h)k[0].value=c.chkid;else{l=string_ci_ai(h);if(a.content&&(c=b.grep(a.content,function(a){return string_ci_ai(a.value)===l}),1===c.length)){k[0].value=c[0].chkid;g.data("cm_info",c[0]);return}setTimeout(function(){g[0].focus()},1);alert(e)}else k[0].value=""};g.blur(function(){g.autocomplete("widget").is(":visible")||l()})})}})();
  (function(){window.init_cm_checklist=function(b,a,c){var e={},d=create_caching_source_fn(b,a,e,"label"),f=c.parent_cmid_input||null,h=9999,k=b("#cm-checklist-template").html(),g=b("#cm-checklist-target");a=f?function(a,b,c){a.parent=f.val();return d(a,b,c)}:d;var l=function(a,f,g){var h=string_ci_ai(a);if(e.content){var k=b.grep(e.content,function(a){return string_ci_ai(a[c.match_prop])===h});if(1===k.length){f(k[0]);return}}g||string_ci_ai(e.term||"")===h?f():d({term:h},function(b){l(a,f,!0)})};
  c.parent_cmid_input&&(f=b(c.parent_cmid_input));c.source=a;c.look_for_fn=l;c.add_new_html=function(a,c){to_add=b(k.replace(/\[COUNT\]/g,h++).replace(/\[ID\]/g,a).replace(/\[LABEL\]/g,b("<div>").text(c).html()));g.is(":hidden")?g.removeClass("hidden").append(to_add):g.append(to_add);return!1};init_autocomplete_checklist(b,c)};window.init_community_edit=function(b){var a=9999,c=null,e=null;b("#add-alternate-name").click(function(d){var f=null;d.preventDefault();c||(c=b("#alt-name-template").html(),
  e=b("#alt-name-target"));f=b(c.replace(/\[COUNT\]/g,a++));e.is(":hidden")?e.removeClass("hidden").append(f):e.append(f);return!1})}})();
  