function textcountAlert(b,a){if(b.value.length>a){alert("Sorry, you're over the text limit for that field. The limit is "+a+" characters.");return false}return true}function request_statoids_for_country(){var b;var a=get_selected("countrySelectId");if(a){b=new AjaxRequest();b.statoidsForCountry(a)}}function AjaxRequest(){var a=this;a.loadStatoidsForCountry=function(g,c){a.statoids=g.statoids;jQuery("#statoidSelectId").empty();var d='<option value=""></option>';var b;var f;for(var e=0;e<a.statoids.length;e++){b=a.statoids[e].statoid;f=a.statoids[e].code;d+='<option value="'+f+'">'+b+"</option>"}jQuery("#statoidSelectId").append(d);jQuery("#statoidSelectId").attr("style","width:50;")};a.statoidsForCountry=function(b){a.url="/pubs/statoids";a.params="country="+b;a.callback=a.loadStatoidsForCountry;a.send()};a.onError=function(c,d,b){};a.send=function(){jQuery.ajax({type:"GET",url:a.url,data:a.params,dataType:"json",contentType:"application/json; charset=utf-8",success:a.callback,error:a.onError})}}function clear_selector(b){var a=document.getElementById(b);a.options.length=0}function get_selected(c){var b=document.getElementById(c);if(b){var a=b.selectedIndex;return b.options[a].value}else{return null}}function get_selected_by_name(d,c){var b=document[d][c];if(b){var a=b.selectedIndex;return b.options[a].value}else{return null}}function show_selected_by_crash_type(b){if(b){document.getElementById("soloId").style.display="none";document.getElementById("vehicleId").style.display="none";document.getElementById("pedestrianId").style.display="none";document.getElementById("bicycleId").style.display="none";document.getElementById("otherId").style.display="none";var a=b+"Id";document.getElementById(a).style.display="block"}else{}}function show_selected_by_part_stolen(b){if(b){document.getElementById("whole_bikeId").style.display="none";document.getElementById("wheelsId").style.display="none";document.getElementById("partsId").style.display="none";var a=b+"Id";document.getElementById(a).style.display="block"}else{}}function toggle_other_field(a,b){if(b){if(b=="Other"||b=="other"){document.getElementById(a).style.display="block"}else{document.getElementById(a).style.display="none"}}else{}}function loadTagIntoForm(a,b){if(a=="factor"){if(!$("#factor1").val()){$("#factor1").val(b)}else{if(!$("#factor2").val()){$("#factor2").val(b)}else{if(!$("#factor3").val()){$("#factor3").val(b)}else{if(!$("#factor4").val()){$("#factor4").val(b)}}}}}else{if(a=="lesson"){if(!$("#lesson1").val()){$("#lesson1").val(b)}else{if(!$("#lesson2").val()){$("#lesson2").val(b)}}}}};
