$("#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+"