SportsShares.UI.FullCalendar=new function(){var _c=SportsShares.Config.UI.FullCalendar;
var _init=function(nodeId,hasEventInteraction,filterFunction){hasEventInteraction=hasEventInteraction||false;
filterFunction=filterFunction||null;jQuery("#"+nodeId).fullCalendar({header:{right:"today",center:"prev, title, next",left:""},events:[],timeFormat:"h:mm tt",eventClick:hasEventInteraction?function(calEvent,jsEvent,view){SportsShares.UI.EventManagement.GetEvent(calEvent);
}:null,viewDisplay:function(){_addEvents(nodeId);if(filterFunction){filterFunction();
}}});};var _mini=function(nodeId,month){jQuery("#"+nodeId).fullCalendar({draggable:false,events:[],timeFormat:"h:mm tt",header:{right:"",center:"title",left:""},month:month,miniCalendar:true,viewDisplay:function(){_addEvents(nodeId);
},eventClick:function(calEvent,jsEvent,view){_goToMonth(calEvent.start,_c.PrimaryCalendarNodeId);
return false;},dayClick:function(dayDate,view){_goToMonth(dayDate,_c.PrimaryCalendarNodeId);
},dayNamesShort:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],eventOffset:_c.MiniEventCssTopOffset});
};var _addEvents=function(nodeId){var calendar=jQuery("#"+nodeId);if(calendar.fullCalendar("clientEvents").length==0){calendar.fullCalendar("addEventSource",_c.Events);
}calendar=null;};var _goToMonth=function(date,nodeId){var month=date.getMonth();var newDate=jQuery("#"+nodeId).fullCalendar("gotoDate",date.getFullYear(),month,date.getDate()).fullCalendar("getDate");
if(jQuery(_c.MiniCalendarsCssSelector).length>0){var prevCal=jQuery(_c.MiniCalendarsCssSelector+":first");
var prevDate=prevCal.fullCalendar("getDate");var nextCal=jQuery(_c.MiniCalendarsCssSelector+":last");
var nextDate=nextCal.fullCalendar("getDate");prevDate.year=newDate.month==0?newDate.year-1:newDate.year;
prevDate.month=newDate.month==0?11:newDate.month-1;nextDate.year=newDate.month==11?newDate.year+1:newDate.year;
nextDate.month=newDate.month==11?0:newDate.month+1;prevCal.fullCalendar("gotoDate",prevDate.year,prevDate.month,newDate.day);
jQuery(_c.MiniCalendarsCssSelector+":eq(1)").fullCalendar("gotoDate",newDate.year,newDate.month,newDate.day);
nextCal.fullCalendar("gotoDate",nextDate.year,nextDate.month,newDate.day);}newDate=null;
prevCal=null;prevDate=null;nextCal=null;nextDate=null;};var _iterate=function(cssSelector,direction){try{direction=direction.toLowerCase();
if(direction==="prev"||direction==="next"){jQuery(cssSelector).fullCalendar(direction);
}}catch(ex){}};var _setEventClassName=function(calendarNodeId,calEvent,className){calEvent.className=className;
jQuery("#"+calendarNodeId).fullCalendar("updateEvent",calEvent);};return{Init:function(nodeId,hasEventInteraction,filterFunction){_init(nodeId,hasEventInteraction,filterFunction);
},Mini:function(nodeId,month){_mini(nodeId,month);},AddEvents:function(nodeId){_addEvents(nodeId);
},Iterate:function(cssSelector,direction){_iterate(cssSelector,direction);},SetEventClassName:function(calendarNodeId,calEvent,className){_setEventClassName(calendarNodeId,calEvent,className);
}};};