$("#datePanel").show();$("#createPanel").show();$("#dayOptionsBtn").show();$("#zipPanel").show();$.fn.Attend=function(a){if($.trim($(this).text())=="Attend"){attendText="attend";$(this).text("Deattend")}else{attendText="deattend";$(this).text("Attend")}$.ajax({type:"POST",url:WhatsUp247.baseUrl+"/event/"+attendText+"/id/"+a+"",cache:false})};$.fn.DisableScroll=function(){scrollEnabled=0;setTimeout("scrollEnabled=1",500)};$.fn.CreateEvent=function(d,c,a,b){if($(".newEventBox").length>0){return}$.ajax({type:"GET",url:WhatsUp247.baseUrl+"/event/createevent",cache:false,dataType:"json",success:function(f){if(f){$("#eventDataDiv").prepend(f.output);if(d!=null){$(".newEventBox > .listButtonDiv > .editBtn").attr("onclick",'$(this).ToggleEdit($(this),"'+d+'","'+c+'",'+a+',null,"'+b+'")')}window.scrollTo(0,0);$(".newEventBox > .listButtonDiv > .editBtn").click()}}})};$.fn.CopyEvent=function(c,a,b){if(a=="1"){$(".copyDialog").dialog({title:"This event repeats",buttons:{Yes:function(){$(this).dialog("close");$(this).CreateEvent(c,true,true,b)},No:function(){$(this).dialog("close");$(this).CreateEvent(c,true,false,false)}}}).dialog("open")}else{$(this).CreateEvent(c,true,false,false)}};$.fn.DayClick=function(c){var b=WhatsUp247.baseUrl+"";if(!c){e.parents("td").unbind("click");if($("#search_zip").val()==$("#search_zip").attr("title")){$("#search_zip").val(null)}if($("#searchFilter").val()==$("#searchFilter").attr("title")){$("#searchFilter").val(null)}location.href=b+"/event/day/category/"+$("#categoryFilter").val()+"/distance/"+$("#distanceFilter").val()+"/zip/"+$("#zipFilter").val()+"/search/"+$("#searchFilter").val()+"/year/"+year+"/month/"+month+"/day/"+day}else{if(day==""){var a=new Date();day=a.getDate()}$.ajax({type:"GET",url:WhatsUp247.baseUrl+"/event/save/start/"+year+"-"+month+"-"+day,cache:false,success:function(d){if(d){$("#addevent").html(d).dialog({title:eventTitle,dialogClass:"addEventDialog",close:function(){$("html, body").css("overflow","visible")},open:function(){$("html, body").css("overflow","hidden")}}).dialog("open")}},statusCode:{404:function(){alert("System error!")}}})}};$.fn.moveTo=function(a){return this.each(function(){var b=$(this).clone();$(b).appendTo(a);$(this).remove()})};$.fn.GetEvents=function(a){if(a){window.scrollTo(0,0);$("#eventDataDiv").html("");offset=0;startDate=0}if($("#searchFilter").val()==$("#searchFilter").attr("title")){$("#searchFilter").val(null)}var b=WhatsUp247.baseUrl+"/event/list/category/"+$("#categoryFilter").val()+"/distance/"+$("#distanceFilter").val()+"/zip/"+$("#zipFilter").val()+"/search/"+$("#searchFilter").val()+"/dateFrom/"+$("#dateFilterFromAlt").val()+"/year/"+year+"/month/"+month+"/day/"+day+"/dateFilter/"+$("#dateFilter").val()+"/view/"+viewSelect+"/offset/"+offset+"/startDate/"+startDate+"/remote/true/apiKey/"+apiKey;if(typeof isaffiliatelink!=="undefined"&&isaffiliatelink==true){b+="/affiliate/"+isaffiliatelink}if(typeof eventId!=="undefined"&&eventId!==""&&$("#eventDataDiv").html()==""){$(".eventBoxSingle").moveTo("#eventDataDiv");b=b+"/id/"+eventId;a=false}$.ajax({type:"GET",url:b,cache:false,dataType:"json",timeout:15000,beforeSend:function(){$("#loadingEventDataDiv").show()},complete:function(){$("#eventDataDiv").fadeTo("slow",1);$("#loadingEventDataDiv").hide()},success:function(c){if(c){offset=c.offset;startDate=c.startDate;lastDate=c.lastDate;lastShortDate=c.lastShortDate;if(a){$("#eventDataDiv").html();$("#eventDataDiv").html(c.output)}else{button=$("#eventDataDiv #moreButton").detach();$("#eventDataDiv").append(c.output).append(button)}if(offset>0){$("#eventDataDiv #moreButtonDate").text(lastDate);$("#eventDataDiv #moreButtonShortDate").text(lastShortDate)}else{$("#eventDataDiv #moreButton").css("cursor","default");$("#eventDataDiv #moreButtonDate, #eventDataDiv #moreButtonShortDate").text("");$("#eventDataDiv #moreButtonText").text("No More Events Found")}if(apiKey!=""){$(this).VertCenter($("#orgHeaderName"),$("#orgHeaderContainer"))}$("#zipSearch").attr("title",c.city+", "+c.state+" ("+c.zip+")");$("#zipSearch").val("");$("#zipSearch").blur();$("#zipSearch").inputHints();$("#searchFilter").inputHints();$("#zipFilter").attr("value",c.zip);if(typeof apiKey=="undefined"||apiKey==""){document.title="What's Up In "+c.city+", "+c.state}else{document.title="What's Up @ "+c.orgName}$(this).SetUpAffiliateList();$(this).GuestFilter()}},statusCode:{404:function(){alert("System error!")}}})};$.fn.GetCatCloud=function(){var a=WhatsUp247.baseUrl+"/event/wordcloud/distance/"+$("#distanceFilter").val()+"/zip/"+$("#zipFilter").val()+"/dateFrom/"+$("#dateFilterFromAlt").val()+"/year/"+year+"/month/"+month+"/day/"+day+"/dateFilter/"+$("#dateFilter").val()+"/startDate/"+startDate+"/remote/true/apiKey/"+apiKey;$.ajax({type:"GET",url:a,cache:false,dataType:"html",success:function(b){if(b){$("#rightContainer").html(b)}},statusCode:{404:function(){alert("System error!")}}})};$.fn.GuestFilter=function(){if(loggedIn){return}$("[id^='tab']:not(#tabAllEvents)").unbind().click(function(){$(this).GuestMessage($(this).attr("id"))});$(".ActionButtons").unbind().click(function(){$(this).GuestMessage($(this).text())}).removeAttr("onclick");$(".name").unbind().click(function(){$(this).GuestMessage($(this).text())}).removeAttr("onclick")};$.fn.GuestMessage=function(a){switch($.trim(a)){case"tabMyInterests":$("#guestMessage").text("'My Interest' will allow you to be notified when events that interest you occur.");break;case"tabAttending":$("#guestMessage").text("'Attending' will keep a complete list of events that you have selected to attend.");break;case"Attend":$("#guestMessage").text("'Attend' will keep a complete list of events that you have selected to attend.");break;case"View":$("#guestMessage").text("'View' will allow you to see detailed information about each event, including; time, place, contact info, and more.");break}$("#guestDataDiv").dialog("open")};$.fn.ToggleEvent=function(a){eventBox=a.parents(".eventBox:first");viewBtn=eventBox.find(".viewBtn:first");if(eventBox.hasClass("eventBoxOpen")){eventBox.removeClass("eventBoxOpen");eventBox.find("a").css("display","none");eventBox.find(".affListLink").hide();viewBtn.html("Details")}else{eventBox.addClass("eventBoxOpen");eventBox.find("a").css("display","block");eventBox.find(".affListLink").show();viewBtn.html("Close");twttr.widgets.load();gapi.plusone.go();FB.XFBML.parse(a.find(".fb-like")[0])}};$.fn.UpdateRecurrenceDays=function(){var a=0;$("#recurrenceDaysDiv input").each(function(){if($(this).attr("checked")=="checked"){a+=parseInt($(this).val())}});$("#recurrence_days").val(a)};$.fn.SaveEvent=function(){$(this).UpdateRecurrenceDays();var a="id="+$("#id").val()+"&name="+encodeURIComponent($("#ename").val())+"&description="+encodeURIComponent($("#description").val())+"&category="+$("#category").val()+"&start="+$("#start").val()+"&end="+$("#end").val()+"&organization="+$("#organization").val()+"&fee_description="+encodeURIComponent($("#fee_description").val())+"&location="+encodeURIComponent($("#location").val())+"&address="+encodeURIComponent($("#address").val())+"&city="+encodeURIComponent($("#city").val())+"&state="+$("#state").val()+"&zip="+$("#zip").val()+"&contact_name="+encodeURIComponent($("#contact_name").val())+"&contact_phone="+$("#contact_phone").val()+"&contact_email="+$("#contact_email").val()+"&city_website="+$("#city_website").val()+"&flyer="+$("#flyer").val();if($("#recurrenceCycle").length>0&&$("#recurrenceCycle").val()!="0"){a+="&recurrence=1&recurrence_cycle="+$("#recurrenceCycle").val();switch(parseInt($("#recurrenceCycle").val())){case 1:a+="&recurrence_day_count="+$("#recurrenceDayCount").val();break;case 2:a+="&recurrence_week_count="+$("#recurrenceWeekCount").val()+"&recurrence_days="+$("#recurrence_days").val();break;case 3:a+="&recurrence_month_count="+$("#recurrenceMonthCount").val()+"&recurrence_month_type="+$("input:radio[name=recurrenceMonthType]:checked").val()+"&recurrence_month_start="+$("#recurrenceMonthStart").val()+"&recurrence_month_day_number="+$("#recurrenceMonthDayNumber").val()+"&recurrence_month_day="+$("#recurrenceMonthDay").val();break;case 4:a+="&recurrence_year_count="+$("#recurrenceYearCount").val()+"&recurrence_year_type="+$("input:radio[name=recurrenceYearType]:checked").val()+"&recurrence_year_start="+$("#recurrenceYearStart").val()+"&recurrence_year_day_number="+$("#recurrenceYearDayNumber").val()+"&recurrence_year_day="+$("#recurrenceYearDay").val()+"&recurrence_year_month="+$("#recurrenceYearMonth").val();break}}if($("#fee").attr("checked")=="checked"){a+="&fee=1"}else{a+="&fee=0"}if($("#private").attr("checked")=="checked"){a+="&private=1"}else{a+="&private=0"}if($("#allday").attr("checked")=="checked"){a+="&starttime=00:00:00&endtime=00:00:00"}else{a+="&starttime="+$("#starttime").val()+"&endtime="+$("#endtime").val()}$.ajax({type:"POST",url:WhatsUp247.baseUrl+"/event/save/remote/true/",data:a,cache:false,success:function(b){$(this).GetEvents(true)},statusCode:{404:function(){}}})};$.fn.DeleteEvent=function(){$(".deleteDialog").dialog({modal:true,draggable:false,autoOpen:true,height:170,width:300,resizable:false,show:"blind",hide:"blind",buttons:{Ok:function(){var a="id="+$("#id").val();$(this).dialog("close");$.ajax({type:"POST",url:WhatsUp247.baseUrl+"/event/delete/",data:a,cache:false,success:function(b){$(".deleteDialog").dialog("close");$(this).GetEvents(true)}})},Cancel:function(){$(".deleteDialog").dialog("close")}}})};$.fn.CancelEdit=function(a){$(".cancelDialog").dialog({modal:true,draggable:false,autoOpen:false,height:165,width:300,resizable:false,show:"blind",hide:"blind",buttons:{Discard:function(){a.parent().parent().removeClass("eventBoxEdit");if(a.parent().parent().hasClass("newEventBox")){$(".newEventBox").remove()}else{a.parent().parent().html(eventHtml)}$(".cancelDialog").dialog("close");$(".eventBoxPending .editBtn").click();$(".eventBoxPending").removeClass("eventBoxPending")},Cancel:function(){$(".cancelDialog").dialog("close")}}}).dialog("open")};$.fn.ToggleEdit=function(g,b,a,c,f,j,i){var h=g.parent().parent();if($(".eventBoxEdit").length>0&&!h.hasClass("eventBoxEdit")){$(".eventBoxPending").removeClass("eventBoxPending");h.addClass("eventBoxPending");$(".eventBoxEdit > .editRight > .viewBtn").click()}else{if(c==true&&$.trim(g.text())=="Edit"&&a!="true"){$("#editRepeatDiv").dialog({title:"This event repeats",buttons:{Open:function(){$(this).dialog("close");if(parseInt($("input:radio[name=editRepeatRadio]:checked").val())>0){$(this).ToggleEdit(g,j,"",false,f,j,i)}else{$(this).ToggleEdit(g,b,"",false,f,j,i)}},Cancel:function(){$(this).dialog("close")}}}).dialog("open")}else{if(h.hasClass("eventBoxEdit")){if(g.html()=="Save"){if($("#eventForm").valid()==true){$(this).SaveEvent($(this))}}else{$(this).CancelEdit(g)}}else{if(!i){i=false}if(c&&j.length==b.length){b=j}var d="&id="+b+"&attendDate="+f+"&forceView="+i;if(a=="true"){d+="©=true"}$.ajax({type:"GET",url:WhatsUp247.baseUrl+"/event/save/",data:d,cache:false,success:function(k){eventHtml=h.html();borderColor=h.find(".listDivider").css("border-color");h.find(".editBtn").html("Save").attr("onclick",'$(this).ToggleEdit($(this), "'+b+'","", "'+c+'", "'+f+'", "'+j+'", "'+i+'")');h.find(".deleteBtn").css("display","block");if(b!==undefined){h.find(".viewBtn").html("Cancel").attr("onclick",'$(this).ToggleEdit($(this), "'+b+'","", "", "'+f+'", "'+j+'", "'+i+'")')}h.addClass("eventBoxEdit");rightContent=h.find(".listButtonDiv").html();h.html(k+"
"+rightContent+"
");if(a=="true"){$(".newEventBox #id").val("");if(!c){h.find("#recurrenceCycle").val("0");h.find("#recurringPanel > div").hide();h.find("#recurringPanel > div:first").show()}}h.css("display","block").find(".accordionEdit").accordion({fillspace:true}).find(".editRightDivider").css("border-color",borderColor)}})}}}};$.fn.SetUpAffiliateList=function(){$(".affListLink").hover(function(){$(this).parent().find(".affList").load(WhatsUp247.baseUrl+"/affiliate/eventpopup/orgid/"+$(this).parent().find(".affOrgId").val()).show()},function(){$(this).parent().find(".affList").hide()})};$.fn.UpdateEventText=function(){var b;if($("#recurrenceCycle").val()!="0"){switch(parseInt($("#recurrenceCycle").val())){case 1:b="Event will repeat daily every "+$("#recurrenceDayCount").val()+" days between "+$("#start").val()+" - "+$("#end").val();break;case 2:var a="";$("#recurrenceDaysDiv input").each(function(){if($(this).attr("checked")=="checked"){a+=", "+$(this).parent().html().substr(-3,3)}});b="Event will repeat weekly every "+$("#recurrenceWeekCount").val()+" weeks between "+$("#start").val()+" - "+$("#end").val()+" on "+a;break;case 3:b="Event will repeat monthly every "+$("#recurrenceMonthCount").val()+" days between "+$("#start").val()+" - "+$("#end").val();break;case 4:b="Event will repeat yearly every "+$("#recurrenceYearCount").val()+" days between "+$("#start").val()+" - "+$("#end").val();break}}else{b="Event will begin on "+$("#start").val()+" at "+$("#starttime").val()+" and end on "+$("#end").val()+" at "+$("#endtime").val()}$("#recurrenceTextDiv").html(b)};$.fn.OpenRecurringPanel=function(){$("#recurringPanel").css("display","block");$("#recurringPanel").animate({left:"0px"},"right");$("#recurringBtn").html("Close")};$.fn.CloseRecurringPanel=function(){$("#recurringPanel").animate({left:"-275px"},"slow",function(){$("#recurringPanel").css("display","none")});$("#recurringBtn").html("Open");$(this).UpdateEventText()};$.fn.CountEvents=function(i,b,f,d){var c=i.split("/");var a=new Date(c[2],c[0]-1,c[1]);c=b.split("/");var h=new Date(c[2],c[0]-1,c[1]);var g=h-a;switch(d){case"4":g/=365;case"3":g/=31;case"2":g/=7;default:g/=(1000*60*60*24)}return Math.ceil(g/f)};$.fn.ToggleRecurringPanel=function(){$(".recurrencePanels").each(function(){$(this).hide()});$("#recurrenceSubPanel"+$("#recurrenceCycle").val()).show()};$.fn.InitRecurringPanel=function(){var b=new Date();var a=("0"+b.getDay()).slice(-2);var c=("0"+(b.getMonth()+1)).slice(-2);$("#recurringPanel > div > div:first-child > input").val(1);$("#recurrenceDaysDiv > span").each(function(){if($(this).text()==b.getDayName(true)){$(this).find("input").attr("checked","checked");return}});$("#recurrenceMonthStart").val(a);$("#recurrenceYearStart").val(c+"/"+a)};$.fn.VertCenter=function(a,b){mVert=(b.height()-a.height())/2;a.css("margin-top",mVert);a.css("margin-bottom",mVert)};$.fn.MoreEvents=function(){if(offset>0){$("#loadingEventDataDiv").show();$("#eventDataDiv").fadeTo("fast",0.5);$(this).GetEvents(false)}};$.fn.TabInit=function(){$("#tabAllEvents").click(function(){$(".tabSelected").removeClass("tabSelected");$(this).addClass("tabSelected");$("#milePanel").show();$("#zipPanel").show();$("#categoryPanel").show();$("#datePanel").show();$("#createPanel").show();$("#interestPanel").hide();$("#datePanel").show();$("#interestDropDown").hide();$("#filterPanel").show();$("#createEventBtn").show();viewSelect=1;$(this).GetEvents(true)});$("#tabMyInterests").click(function(){$(".tabSelected").removeClass("tabSelected");$(this).addClass("tabSelected");$("#datePanel").show();$("#milePanel").hide();$("#zipPanel").hide();$("#categoryPanel").hide();$("#createPanel").hide();$("#interestPanel").show();$("#interestBtn").show();$("#createEventBtn").hide();viewSelect=3;apiKey="";$(this).GetEvents(true)});$("#tabAttending").click(function(){$(".tabSelected").removeClass("tabSelected");$(this).addClass("tabSelected");$("#datePanel").show();$("#milePanel").hide();$("#zipPanel").hide();$("#categoryPanel").show();$("#createPanel").show();$("#interestPanel").hide();$("#datePanel").show();$("#interestDropDown").hide();$("#filterPanel").show();$("#createEventBtn").show();viewSelect=4;apiKey="";$(this).GetEvents(true)});$("#tabMyEvents").click(function(){$(".tabSelected").removeClass("tabSelected");$(this).addClass("tabSelected");$("#milePanel").hide();$("#zipPanel").hide();$("#categoryPanel").show();$("#datePanel").hide();$("#createPanel").show();$("#interestPanel").hide();$("#datePanel").show();$("#interestDropDown").hide();$("#filterPanel").show();$("#createEventBtn").show();viewSelect=2;apiKey="";$(this).GetEvents(true)});$("#categoryPanel").click(function(){})};$.fn.EventValidatorInit=function(){jQuery.validator.addMethod("phoneUS",function(a,b){a=a.replace(/\s+/g,"");return this.optional(b)||a.length>9&&a.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/)});jQuery.validator.addMethod("recurrenceDate",function(b,a,c){if($("#recurrenceCycle").val()!="0"&&$("#start").val()==$("#end").val()&&childEvent!="true"){return false}else{return true}});jQuery.validator.addMethod("recurrenceLimit",function(d,a,f){if($("#recurrenceCycle").val()>"0"){return true}var b=$("#recurrenceCycle").val();var c=0;switch(b){case"1":c=$(this).CountEvents($("#start").val(),$("#end").val(),$("#recurrenceDayCount").val(),b);if(c>30){return false}break;case"2":c=$(this).CountEvents($("#start").val(),$("#end").val(),$("#recurrenceWeekCount").val(),b);if(c>24){return false}break;case"3":c=$(this).CountEvents($("#start").val(),$("#end").val(),$("#recurrenceMonthCount").val(),b);if(c>12){return false}break;case"4":c=$(this).CountEvents($("#start").val(),$("#end").val(),$("#recurrenceYearCount").val(),b);if(c>6){return false}break;default:return false}return true});jQuery.validator.addMethod("timesValid",function(){var g=$("#endtime").val().substring(3,5);var b=$("#starttime").val().substring(3,5);var c=$("#endtime").val().substring(0,2);var f=$("#starttime").val().substring(0,2);var a=$("#endtime").val().substring(6,8);var d=$("#starttime").val().substring(6,8);if(c*1==12){c=0}if(f*1==12){f=0}if(a=="PM"){c=c*1+12}if(d=="PM"){f=f*1+12}if($("#start").val()==$("#end").val()){if((f>c)||(f==c&&b>g)){return false}}return true});jQuery.validator.addMethod("datesValid",function(b,a){dateToValue=$("#end").val();dateFromValue=$("#start").val();if(Date.parse(dateToValue)