(function(A){A.vail_calendar={eventsPerPage:10,eventRows:null,pageList:A(".pagination .pageList"),totalPages:0,currentPage:1,_init:function(){A(".evtVail,.evtBeavercreek,.evtBreckenridge,.evtKeystone,.evtHeavenly").each(function(){var B=A(this);
var C=B.html();
B.text("").removeClass("evtLoad").prepend("<i></i>").append(A("<span></span>").append("<span></span>").append("<i></i>").append(C));
if(A.browser.msie&&A.browser.version=="6.0"&&(B.width()%2==1)){B.find("span i").css("right","-1px")
}});
A("div.column.w1.lt5").addClass("hideFromPrint");
A("div.column.w4.rt1").addClass("fullWidthPrint");
A(".eventList .filters input").each(function(){var B=A(this);
if(A.browser.msie){B.parents("label").addClass("ieFix")
}B.bind("click",A.vail_calendar.filterChangeHandler)
});
A.vail_calendar.filterChangeHandler()
},initPagination:function(){A.vail_calendar.eventRows=A(".eventList .list tbody tr[class*='unfiltered']");
if(A.vail_calendar.eventRows.length==0){A(".eventList .list table").hide();
A(".eventList .list .noevents").show()
}else{A(".eventList .list table").show();
A(".eventList .list .noevents").hide()
}A.vail_calendar.totalPages=Math.ceil(A.vail_calendar.eventRows.length/A.vail_calendar.eventsPerPage);
A.vail_calendar.pageList.text("");
if(A.vail_calendar.totalPages>1){for(n=1;
n<=A.vail_calendar.totalPages;
n++){A('<a href="" pageid="'+n+'">'+n+"</a>").click(function(){A.vail_calendar.displayPage(A(this).text());
return false
}).appendTo(A.vail_calendar.pageList)
}}A.vail_calendar.currentPage=A.vail_calendar.calcCurrentPage();
A.vail_calendar.displayPage(A.vail_calendar.currentPage)
},calcCurrentPage:function(){var B=new Date();
var C={row:0,delta:Infinity};
A.vail_calendar.eventRows.each(function(E){var G=A(this).find(".dtstart").attr("title");
var D=new Date(G.substr(0,4),G.substr(4,2)-1,G.substr(6,2));
var F=(D-B);
if(F<C.delta&&F>=0){C.row=E;
C.delta=F
}});
return Math.ceil((C.row+1)/A.vail_calendar.eventsPerPage)
},displayPage:function(C){A.vail_calendar.currentPage=C;
var B={firstEvent:C*A.vail_calendar.eventsPerPage-A.vail_calendar.eventsPerPage,lastEvent:C*A.vail_calendar.eventsPerPage};
A.vail_calendar.eventRows.each(function(D){if(D>=B.firstEvent&&D<B.lastEvent){A(this).show()
}else{A(this).hide()
}});
A.vail_calendar.pageList.find("a").removeClass("current");
A.vail_calendar.pageList.find("a[pageid="+C+"]").addClass("current");
if(C==1){A(".pagination .prevButton").hide()
}else{A(".pagination .prevButton").show()
}if(C>=A.vail_calendar.totalPages){A(".pagination .nextButton").hide()
}else{A(".pagination .nextButton").show()
}},filterChangeHandler:function(B){A(".eventList tr").each(function(){var C=A(this);
if(A.vail_calendar.determineEventDisplay(C)){C.addClass("unfiltered");
if(A.browser.msie){C.show()
}else{C.fadeIn()
}}else{C.removeClass("unfiltered");
if(A.browser.msie){C.hide()
}else{C.fadeOut()
}}});
A.vail_calendar.initPagination()
},determineEventDisplay:function(B){var C=true;
A.each(B.attr("class").split(" "),function(){var D=A("#eventType_"+this+", #resort_"+this).get(0);
if(D&&!D.checked){C=false
}});
return C
}};
A(".pagination .btn.prev").click(function(){A.vail_calendar.displayPage(A.vail_calendar.currentPage-1);
return false
});
A(".pagination .btn.next").click(function(){A.vail_calendar.displayPage(A.vail_calendar.currentPage+1);
return false
});
A(".eventList .list select.year").change(function(){var B=A(this).val();
if(B!=""){location.href=(B)
}});
A(".eventList .list select.month").change(function(){var B=A(this).val();
if(B!=""){location.href=(B)
}})
})(jQuery);
jQuery(jQuery.vail_calendar._init);