/* Minified: main.js, widgets.Calendar.js */
jQuery.fn.calendarCurrentCellId=null;jQuery.fn.calendarFocusCell=function(){var cell=$(this);var link=cell.find("div.day_num a");var details=cell.find("div.day_details");cell.addClass("zoomed");cell.find("div.day_brief").hide();if(details.children().length){details.show()}else{details.show();details.append('<img src="'+App.Wireframe.Utils.indicatorUrl()+'" class="indicator" alt="Working..." />');details.load(App.extendUrl(link.attr("href"),{skip_layout:1}),function(){details.find("a").click(function(e){e.stopPropagation();return true})})}};jQuery.fn.calendarUnfocusCell=function(){var cell=$(this);cell.removeClass("collapsed").removeClass("zoomed");cell.find("div.day_brief").show();cell.find("div.day_details").hide()};$(document).ready(function(){});
App.widgets.Calendar=function(){var calendar_type=null;var calendar=null;var calendar_table_wrapper=null;var calendar_table=null;var calendar_table_body=null;var calendar_table_header_row=null;var calendar_table_rows=null;var calendar_table_cells=null;var calendar_spiral=null;var resize_calendar_table=function(){calendar_table_cells.find("div.day_brief").hide();calendar_table_cells.css("height","auto");var row_count=calendar_table_rows.length;var row_height=(calendar_table_wrapper.height()-calendar_table_header_row.height())/row_count;calendar_table_cells.each(function(){var cell=$(this);cell.css("height",row_height+"px");cell.data("day_brief").css("height",row_height-20+"px").show();if(cell.data("day_brief_data").height()>cell.data("day_brief").height()){cell.data("hidden_data").show()}});var spiral_width=Math.floor((calendar_table_wrapper.width()-60)/44)*44;calendar_spiral.width(spiral_width).css("left",(((calendar.width()-spiral_width)/2)-10)+"px")};var show_day_view=function(cell){var remove_day_view=function(){calendar_overview.remove();calendar_day_container.remove();$(document).unbind("keypress.calendar_day_view");return false};var calendar_overview=$('<div class="calendar_day_overlay"></div>').appendTo(calendar);var calendar_day_container=$('<div class="calendar_day_container"></div>').appendTo(calendar);var calendar_day_title=$('<div class="calendar_day_container_title"></div>').appendTo(calendar_day_container);calendar_day_title.html(cell.attr("date_title"));var calendar_day_close=$('<a href="#" class="calendar_day_close">'+App.lang("Close")+"</a>").appendTo(calendar_day_title);var calendar_day_body=$('<div class="calendar_day_body"></div>').appendTo(calendar_day_container);calendar_overview.click(remove_day_view);calendar_day_close.click(remove_day_view);calendar_day_body.html(cell.data("day_full").html());$(document).bind("keypress.calendar_day_view",function(event){if(event.keyCode==27){remove_day_view()}})};return{init:function(calendar_id,cal_type){cal_type=cal_type.toLowerCase();if(cal_type!="monthly"&&cal_type!="weekly"){cal_type="monthly"}calendar_type=cal_type;calendar=$("#"+calendar_id);calendar_table_wrapper=calendar.find(".calendar_table_wrapper");calendar_table=calendar.find("table.calendar");calendar_table_header_row=calendar.find("thead tr");calendar_table_body=calendar_table.find("tbody");calendar_table_rows=calendar_table_body.find("tr");calendar_table_cells=calendar_table_body.find("td");calendar_spiral=calendar.find("div.calendar_header_metal_spiral");calendar_table_cells.each(function(){var cell=$(this);cell.data("day_brief",cell.find("div.day_brief"));cell.data("hidden_data",cell.find("div.hidden_data"));cell.data("day_brief_data",cell.find("div.day_brief ul:first"));cell.data("day_full",cell.find("div.day_details:first"));cell.click(function(){show_day_view(cell)})});resize_calendar_table();App.Wireframe.Content.bind("window_resize.content",resize_calendar_table)}}}();
