var subcats_size=1,req_subcats; function updateSubCats(c){for(var a=c+1,b=subcats_size;b>=a;b--)subcats_size--,jQuery("#event_category_div"+b).length&&jQuery("#event_category_div"+b).remove();a=jQuery("#event_category"+c).val();jQuery.get("/index.cfm",{event:"submit_event_subcategories_xml",id:a,index:c},function(a){jQuery(a).find("xml").each(function(){var a=parseInt(jQuery(this).find("index").text(),10)+1;if(jQuery(this).find("category").length>0){subcats_size++;jQuery("#subcat_index").val(a);var b=jQuery("<div/>").attr("id", "event_category_div"+a),d=jQuery("<select/>").attr({id:"event_category"+a,name:"event_category"+a}).change(function(){updateSubCats(a)});jQuery(b).append(d);jQuery("#subcats_div").append(b);var e=jQuery("#event_category"+a);jQuery(this).find("category").each(function(){jQuery(e).append('<option value="'+jQuery(this).find("id").text()+'">'+unescape(jQuery(this).find("name").text())+"</option>")});updateSubCats(a)}else jQuery("#subcat_index").val(c)})})} function toggleDiv(c){jQuery("#"+c).slideDown("slow")}function changeDiv(c,a){a=="block"?jQuery("#"+c).slideDown("slow"):jQuery("#"+c).slideUp("slow")}function hideDiv(c){c=="all"?jQuery("div[id$=_occurance]").slideUp("slow"):jQuery("div[id="+c+"]").slideUp("slow")}function resetEventLocId(){jQuery("#event_loc_id").val(0)}function disableFields(c,a){for(var b=0;b<c.length;b++)jQuery("#"+c[b]).attr("disabled",a)} function enableFields(){disableFields(["event_loc_phone","event_address1","event_address2","event_state","event_zip","event_city","event_location_website"],!1)}function eventPopUp(c){c=window.open(c,"name","height=500,width=650");window.focus&&c.focus();return!1} function locationSuggest(){var c="/event/calendarLocationSuggest",a=jQuery("#event_location").val();a!==""&&(c+="/event_location/"+a);a=jQuery("#event_loc_phone").val();a!==""&&(c+="/event_loc_phone/"+a);a=jQuery("#event_address1").val();a!==""&&(c+="/event_address1/"+a);a=jQuery("#event_address2").val();a!==""&&(c+="/event_address2/"+a);a=jQuery("#event_city").val();a!==""&&(c+="/event_city/"+a);a=jQuery("#event_state").val();a!=""&&(c+="/event_state/"+a);a=jQuery("#event_zip").val();a!=""&&(c+= "/event_zip/"+a);eventPopUp(c)} jQuery(document).ready(function(){jQuery("#submitEventForm input[type=submit]").click(function(){var c=/^(([0-9]{1})*[- .(]*([0-9a-zA-Z]{3})*[- .)]*[0-9a-zA-Z]{3}[- .]*[0-9a-zA-Z]{4})+$/,a=[],b;jQuery("#submitEventForm input[name=submitter_name]").val()===""&&(a.push("Submitter Name is required."),typeof b=="undefined"&&(b=jQuery("#submitEventForm input[name=submitter_name]")));if(jQuery("#submitEventForm input[name=submitter_phone]").val()===""||jQuery("#submitEventForm input[name=submitter_phone]").val()!==""&& !c.test(jQuery("#submitEventForm input[name=submitter_phone]").val()))a.push("Valid submitter phone number is required."),typeof b=="undefined"&&(b=jQuery("#submitEventForm input[name=submitter_phone]"));jQuery("#submitEventForm input[name=event_name]").val()===""&&(a.push("Event Name is required."),typeof b=="undefined"&&(b=jQuery("#submitEventForm input[name=event_name]")));jQuery("#submitEventForm textarea[name=event_description]").val().length>500&&(a.push("Please limit event description to 500 characters."), typeof b=="undefined"&&(b=jQuery("#submitEventForm textarea[name=event_description]")));jQuery("#submitEventForm input[name=event_admission]").val()===""&&(a.push("Event Admission is required."),typeof b=="undefined"&&(b=jQuery("#submitEventForm input[name=event_admission]")));jQuery("#submitEventForm input[name=event_date]").val()===""&&(a.push("Event Date is required."),typeof b=="undefined"&&(b=jQuery("#submitEventForm input[name=event_date]")));jQuery("#submitEventForm input[name=event_occurance]:checked").val()== "multiple"&&jQuery("#submitEventForm input[name=event_end_date]").val()===""&&(a.push("Event End Date is required."),typeof b=="undefined"&&(b=jQuery("#submitEventForm input[name=event_end_date]")));jQuery("#submitEventForm input[name=event_time]:checked").val()=="specific"&&jQuery("#submitEventForm input[name=start_time]").val()===""&&(a.push("Event Start Time is required."),typeof b=="undefined"&&(b=jQuery("#submitEventForm input[name=start_time]")));jQuery("#submitEventForm input[name=event_location]").val()=== ""&&(a.push("Location Name is required."),typeof b=="undefined"&&(b=jQuery("#submitEventForm input[name=event_location]")));jQuery("#submitEventForm input[name=event_loc_phone]").val()===""&&(a.push("Location Phone is required."),typeof b=="undefined"&&(b=jQuery("#submitEventForm input[name=event_loc_phone]")));jQuery("#submitEventForm input[name=event_address1]").val()===""&&(a.push("Location Address is required."),typeof b=="undefined"&&(b=jQuery("#submitEventForm input[name=event_address1]"))); if(a.length>0)return jQuery.showMessage({thisMessage:a,className:"error",displayNavigation:!1,autoClose:!0}),b.focus(),!1;enableFields();return!0});jQuery("#submitEventForm select[name=event_category0]").change(function(){updateSubCats(0)})});

