var mouse_x=0;var mouse_y=0;var mouse_window_x=0;var mouse_window_y=0;var help_text="";var Temp=new Object;var plans_options=new Array();var active_event_id="";var active_series_id="";var active_day_timestamp="";var current_calendar_id="";var dialog_box=null;var info_window=new Object;var info_window_width=400;var info_window_height=400;var plans_url="";var theme_url="";var css_path="";var page_width=0;var page_height=0;var event_target=null;var browser_type=null;var cal_password="";var logged_in=false;var calendars=new Array();var events=new Array();var pending_events=new Array();var users=new Array();var current_user=null;var success=false;var messages="";addLoadEvent(plans_page_loaded);function plans_page_loaded(){if(document.attachEvent){document.attachEvent("onmousemove",mousemove);document.attachEvent("onclick",hide_contextmenus);}if(document.addEventListener){document.addEventListener("mousemove",mousemove,true);document.addEventListener("click",hide_contextmenus,true);}xmlhttp_init();update_login();do_on_load();if(messages!=null&&messages!=""){update_messages(messages);}format_messages();}function page_unloaded(){if(info_window.close){info_window.close();}}function do_on_load(){}function update_messages(_1){if(_1){document.getElementById("plans_messages").innerHTML=_1;document.getElementById("plans_messages").style.display="block";scrollto(document.getElementById("plans_messages"),0,-20);}else{document.getElementById("plans_messages").style.display="none";}format_messages();}function format_messages(){if(!document.getElementById("plans_messages")){return;}var _2=document.getElementById("plans_messages").innerHTML;_2=_2.replace(/\[status\]/,"");_2=_2.replace(/\[warning\]/,"<span class=\"warning\">Warning:</span> ");_2=_2.replace(/\[error\]/,"<span class=\"error\">Error:</span> ");document.getElementById("plans_messages").innerHTML=_2;}function update_login(){if(!document.getElementById("login_logout")){return;}if(!plans_options["sessions"]){document.getElementById("login_logout").parentNode.removeChild(document.getElementById("login_logout"));return;}if(logged_in){document.getElementById("login_logout").innerHTML="<a href=\"javascript:logout()\">"+get_lang("logout")+"</a>";}else{var _3="<span id=\"login_form\" style=\"display:none;\">";_3+="Password: <input name=\"login_password\" type=\"password\" id=\"login_password\" style=\"width:12ex;\" onKeyPress=\"if (event.keyCode == 13) login();\"/>";_3+=" <a href=\"javascript:login()\">"+get_lang("submit")+"</a> ";_3+="</span>";_3+="<a style=\"position:relative;\" id=\"login_switch\" href=\"javascript:toggle_login('login_form')\">"+get_lang("login")+"</a>";_3+="<br style=\"clear:both;\"/>";document.getElementById("login_logout").innerHTML=_3;}}function login_logout(_4){var _5=plans_url+"?cal_id="+current_calendar_id+"&js_login=1";if(_4){_5+="&logout=1";}else{if(document.getElementById("login_password")){var _6=document.getElementById("login_password").value;_5+="&cal_password="+_6;}}try{xmlhttp.open("GET",_5,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){eval(xmlhttp.responseText);update_messages(messages);update_login();}};xmlhttp.send(null);}catch(e){}}function login(){update_messages("logging in...");login_logout(false);}function logout(){update_messages("logging out...");login_logout(true);}function show_help(){info_window=this.open("","info_window","resizable=yes,status=yes,scrollbars=yes,top="+info_window_y+",left="+info_window_x+",width="+info_window_width+",height="+info_window_height);doc=info_window.document;doc.open("text/html");doc.write("<html>");doc.write("<head>");doc.write("<title>"+get_lang("help_box_title")+"</title>");doc.write("<link rel=\"stylesheet\" href=\""+css_path+"\" type=\"text/css\" media=screen>");doc.write("</head>");doc.write("<body onResize=\"javascript:do_onresize();\">");doc.write(help_text);doc.write("</body></html>");doc.close();info_window.focus();}function add_edit_user(_7){var _8=null;var _9="";var _a="";if(users[_7]){_8=users[_7];}else{_8=new User();}Temp.user_id=_7;_9+="<div onKeyPress=\"if (event.keyCode == 13) add_edit_user_submit();\">";_9+="<div class=\"leftcol\"><span class=\"required_field\">"+plans_lang["add_user_name"]+":</span></div>";_9+="<div class=\"rightcol\"><input id=\"user_name\" value=\""+_8.name+"\"/></div>";_9+="<div class=\"leftcol\"><span class=\"required_field\">"+plans_lang["user_password"]+":</span></div>";_9+="<div class=\"rightcol\"><input id=\"user_password\" type=\"password\"/></div>";if(users[_7]){_9+="<div class=\"leftcol\"><span class=\"optional_field\">"+plans_lang["user_new_password"]+":</span></div>";_9+="<div class=\"rightcol\"><input id=\"user_new_password\" type=\"password\"/></div>";_9+="<div class=\"leftcol\"><span class=\"optional_field\">"+plans_lang["repeat_new_password"]+":</span></div>";_9+="<div class=\"rightcol\"><input id=\"user_repeat_password\" type=\"password\"/></div>";}else{_9+="<div class=\"leftcol\"><span class=\"required_field\">"+plans_lang["repeat_password"]+":</span></div>";_9+="<div class=\"rightcol\"><input id=\"user_repeat_password\" type=\"password\"/></div>";}if(!logged_in){_9+="<div class=\"leftcol\"><span class=\"required_field\">"+plans_lang["calendar_password"]+":</span></div>";_9+="<div class=\"rightcol\"><input id=\"user_cal_password\" type=\"password\"/></div>";}_a=(users[_7])?plans_lang["update_user"]:plans_lang["add_user"];_9+="<div class=\"leftcol\">&nbsp;</div><div class=\"rightcol\"><a href=\"javascript:add_edit_user_submit()\">"+_a+"</a></div>";if(users[_7]){_9+="<div class=\"leftcol\">&nbsp;</div><div class=\"rightcol\" style=\"text-align:right;\"><a href=\"javascript:add_edit_user_submit(true)\">"+plans_lang["delete_user"]+"</a></div>";}_9+="</div>";dialog_box_init();dialog_box.reset();_a=(users[_7])?plans_lang["edit_user"]:plans_lang["add_user"];dialog_box.setTitle(_a);dialog_box.element.style.display="block";if(users[_7]){dialog_box.anchor(document.getElementById(_7+"_edit_user_link"));}else{dialog_box.anchor(document.getElementById("add_user_link"));}dialog_box.setContents(_9);}function add_edit_user_submit(_b){var _c=(Temp.user_id)?Temp.user_id:"";var _d=document.getElementById("user_name").value;var _e=document.getElementById("user_password").value;var _f=(document.getElementById("user_new_password"))?document.getElementById("user_new_password").value:"";var _10=document.getElementById("user_repeat_password").value;var _11=(_b)?1:"";var url=plans_url+"?add_edit_user=1&cal_id="+current_calendar_id+"&user_id="+_c+"&delete="+_11+"&name="+_d+"&password="+_e+"&new_password="+_f+"&repeat_password="+_10;if(document.getElementById("cal_password")){url+="&cal_password="+document.getElementById("user_cal_password").value;}try{xmlhttp.open("GET",url,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){eval(xmlhttp.responseText);if(success){list_users();}update_messages(messages);}};xmlhttp.send(null);}catch(e){}dialog_box.close();}function fade_preview(){document.getElementById("bg_preview_e1").style.background=fade("#ffffcc",(1+parseInt(document.update_cal_form.background_events_fade_factor.value)));document.getElementById("bg_preview_e2").style.background=fade("#ccffff",(1+parseInt(document.update_cal_form.background_events_fade_factor.value)));}function fade(_13,_14){if(!_13.match(/#([0-9]|[A-F]){6}/i)){return false;}var rgb=hex2rgb(_13.substring(1,7));var hsv=rgb2hsv(rgb);hsv[1]=hsv[1]/_14;var _17=hsv2rgb(hsv);return "rgb("+_17[0]+","+_17[1]+","+_17[2]+")";}function add_new_ical(){dialog_box_init();dialog_box.reset();var _18="";_18+="<div class=\"leftcol\"><span class=\"required_field\">"+plans_lang["ical_url"]+":</span></div>";_18+="<div class=\"rightcol\"><input id=\"ical_url\" value=\"\"/></div>";if(plans_options["sessions"]==0){_18+="<div class=\"leftcol\"><span class=\"required_field\">"+plans_lang["password"]+":</span></div>";_18+="<div class=\"rightcol\"><input id=\"cal_password\" type=\"password\" value=\"\"/></div>";}_18+="<a href=\"javascript:add_new_ical_submit();\">"+plans_lang["add_ical"]+"</a>";dialog_box_init();dialog_box.reset();dialog_box.setTitle("Add New iCal calendar!");dialog_box.setContents(_18);dialog_box.element.style.display="block";dialog_box.anchor(document.getElementById("add_new_ical_link"));}function add_new_ical_submit(){var _19=document.getElementById("ical_url").value;var _1a="";if(document.getElementById("cal_password")){_1a=document.getElementById("cal_password").value;}try{xmlhttp.open("GET",plans_url+"?add_new_ical=1&ical_url="+_19+"&cal_password="+_1a,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){eval(xmlhttp.responseText);update_messages(messages);if(success){dialog_box.close();}}};xmlhttp.send(null);}catch(e){}}function validate_event(){var url=plans_url+"?validate_event=1";url+="&evt_title="+document.getElementById("evt_title").value;url+="&evt_start_date="+document.getElementById("evt_start_date").value;url+="&evt_days="+document.getElementById("evt_days").value;url+="&all_day_event="+document.getElementById("all_day_event").value;url+="&evt_start_time="+document.getElementById("evt_start_time").value;url+="&evt_end_time="+document.getElementById("evt_end_time").value;xmlhttp.open("GET",url,false);xmlhttp.send(null);eval(xmlhttp.responseText);update_messages(messages);return success;}function dialog_box_init(){if(!dialog_box){dialog_box=new DialogBox({"id":"dialog_box","element_id":"plans_dialog_box","images_url":(theme_url+"/graphics/")});}}function list_users(){if(!users||users.length==0){return;}var _1c="";for(var i in users){_1c+=users[i].name+" <a id=\""+users[i].id+"_edit_user_link\" href=\"javascript:add_edit_user("+users[i].id+")\">("+get_lang("edit")+")</a><br/>";}if(document.getElementById("select_users")){document.getElementById("select_users").innerHTML=_1c;}}function tab_show(_1e){if(_1e==null){return;}var _1f,i;i=0;while(document.getElementById("tab"+i)&&i<100){if(i==_1e){document.getElementById("tab"+i).className+=" active";document.getElementById("tab_area"+i).style.display="";document.getElementById("tab"+i).blur();}else{removename(document.getElementById("tab"+i),"active");document.getElementById("tab_area"+i).style.display="none";}i++;}}function toggle_visible(_20){if(document.getElementById(_20)==null){return;}el=document.getElementById(_20);if(el.style.display=="none"){el.style.display="";}else{el.style.display="none";}}function toggle_login(_21){toggle_visible(_21);if((document.getElementById("login_switch").innerHTML=="[x]")){document.getElementById("login_switch").innerHTML="login";document.getElementById("login_switch").style.top="0";document.getElementById("login_switch").style.left="0";}else{document.getElementById("login_switch").innerHTML="[x]";document.getElementById("login_switch").style.top="-10px";document.getElementById("login_switch").style.left="5px";}}function recur_toggle(){if(document.add_event_form.recurring_event.checked){document.add_event_form.recurrence_type[0].disabled=false;document.add_event_form.recurrence_type[1].disabled=false;document.add_event_form.recurrence_type[2].disabled=false;document.add_event_form.recurrence_type[3].disabled=false;document.add_event_form.weekday_of_month_type.disabled=false;document.add_event_form.custom_months.disabled=false;document.add_event_form.year_fit_type[0].disabled=false;document.add_event_form.year_fit_type[1].disabled=false;document.add_event_form.custom_months.disabled=false;if(!document.add_event_form.recurrence_type[1].checked){document.add_event_form.weekday_of_month_type.disabled=true;}if(document.add_event_form.year_fit_type[0].checked){document.add_event_form.custom_months.disabled=true;}document.add_event_form.recur_end_date.disabled=false;}else{document.add_event_form.recurrence_type[0].disabled=true;document.add_event_form.recurrence_type[1].disabled=true;document.add_event_form.recurrence_type[2].disabled=true;document.add_event_form.recurrence_type[3].disabled=true;setTimeout("document.add_event_form.every_x_days.disabled=true",100);setTimeout("document.add_event_form.every_x_weeks.disabled=true",100);setTimeout("document.add_event_form.weekday_of_month_type.disabled=true",100);setTimeout("document.add_event_form.custom_months.disabled=true",100);document.add_event_form.year_fit_type[0].disabled=true;document.add_event_form.year_fit_type[1].disabled=true;document.add_event_form.custom_months.disabled=true;document.add_event_form.recur_end_date.disabled=true;}recurrence_type_update();}function recurrence_type_update(_22){document.add_event_form.weekday_of_month_type.disabled=true;document.add_event_form.every_x_days.disabled=true;document.add_event_form.every_x_weeks.disabled=true;if(document.add_event_form.recurrence_type[1].checked&&!document.add_event_form.recurrence_type[1].disabled){document.add_event_form.weekday_of_month_type.disabled=false;}if(document.add_event_form.recurrence_type[2].checked&&!document.add_event_form.recurrence_type[2].disabled){document.add_event_form.every_x_days.disabled=false;}if(document.add_event_form.recurrence_type[3].checked&&!document.add_event_form.recurrence_type[3].disabled){document.add_event_form.every_x_weeks.disabled=false;}if(!_22){setTimeout("recurrence_type_update(true)",100);}}function update_remote_calendar_requests(){if(!document.update_cal_form||!document.update_cal_form.allow_remote_calendar_requests){return;}if(document.update_cal_form.allow_remote_calendar_requests.checked){document.update_cal_form.remote_calendar_requests_require_password.disabled=false;if(document.update_cal_form.remote_calendar_requests_require_password.checked){document.update_cal_form.remote_calendar_requests_password.disabled=false;}}}function show_event_contextmenu(e,_24,_25,_26){if(e.ctrlKey||plans_options["right_click_menus_enabled"]!=1){return true;}active_event_id=_24;active_series_id=_26;var _27=document.getElementById("contextmenu");var _28="<div id=\"contextmenu_innerbox\" style=\"padding-top:2px;padding-bottom:2px;\">";_28+="<div class=\"context_menuitem\" onmouseup=\"edit_event()\" onmouseover=\"context_menuitem_highlight(this, '#000000')\" onmouseout=\"context_menuitem_unhighlight(this)\">"+plans_lang["context_menu_edit_event"]+"</div>";_28+="<div class=\"context_menuitem\" onmouseup=\"clone_event()\" onmouseover=\"context_menuitem_highlight(this, '#000000')\" onmouseout=\"context_menuitem_unhighlight(this)\">"+plans_lang["context_menu_clone_event"]+"</div>";_28+="<div class=\"context_menuitem\" onmouseup=\"delete_event()\" onmouseover= \"context_menuitem_highlight(this, '#000000')\" onmouseout=\"context_menuitem_unhighlight(this)\">"+plans_lang["context_menu_delete_event"]+"</div>";_28+="</div>";_27.innerHTML=_28;document.getElementById("contextmenu_innerbox").style.borderStyle="solid";document.getElementById("contextmenu_innerbox").style.borderWidth="1px";document.getElementById("contextmenu_innerbox").style.borderTopColor=_25;document.getElementById("contextmenu_innerbox").style.borderLeftColor=_25;show_contextmenu(_27,e);return false;}function show_day_contextmenu(e,_2a){if(e.ctrlKey||plans_options["right_click_menus_enabled"]!=1){return true;}get_page_boundaries();active_day_timestamp=_2a;var _2b=document.getElementById("contextmenu");var _2c="";_2c+="<div id=\"contextmenu_innerbox\" style=\"padding-top:2px;padding-bottom:2px;\">";_2c+="<div class=\"context_menuitem\" onmouseup=\"add_event_on_day()\" onmouseover=\"context_menuitem_highlight(this, '#000000')\" onmouseout=\"context_menuitem_unhighlight(this)\">"+plans_lang["add_event_on_this_day"]+"</div>";_2c+="</div>";_2b.innerHTML=_2c;document.getElementById("contextmenu_innerbox").style.borderStyle="solid";document.getElementById("contextmenu_innerbox").style.borderWidth="1px";document.getElementById("contextmenu_innerbox").style.borderTopColor="#ffffff";document.getElementById("contextmenu_innerbox").style.borderLeftColor="#ffffff";show_contextmenu(_2b,e);return false;}function show_contextmenu(_2d,_2e){get_page_boundaries();_2d.style.left=mouse_x+"px";_2d.style.top=mouse_y+"px";_2d.style.zIndex=100000;_2d.style.visibility="visible";if(browser_type!="IE"){if(distance_to_right_edge<_2d.offsetWidth){_2d.style.left=2+mouse_x-_2d.offsetWidth+"px";}if(distance_to_bottom<_2d.offsetHeight){_2d.style.top=2+mouse_y-_2d.offsetHeight+"px";}}_2e.cancelBubble=true;if(_2e.stopPropagation){_2e.stopPropagation();}if(_2e.preventDefault){_2e.preventDefault();}}function hide_contextmenus(){if(!document.getElementById("contextmenu")){return;}document.getElementById("contextmenu").style.visibility="hidden";}function context_menuitem_highlight(_2f,_30){_2f.className="context_menuitem_highlight";}function context_menuitem_unhighlight(_31){_31.className="context_menuitem";}function get_page_boundaries(){if(document.body.clientWidth){distance_to_right_edge=document.body.clientWidth-mouse_window_x;distance_to_bottom=document.body.clientHeight-mouse_window_y;}else{if(window.innerWidth){distance_to_right_edge=window.innerWidth-mouse_x;distance_to_bottom=window.innerHeight-mouse_y;}}}function edit_event(){window.location.href=plans_url+"?active_tab=1&add_edit_event=edit&evt_id="+active_event_id+"";}function clone_event(){window.location.href=plans_url+"?active_tab=1&add_edit_event=add&evt_id="+active_event_id+"";}function add_event_on_day(){window.location.href=plans_url+"?active_tab=1&cal_id="+current_calendar_id+"&add_edit_event=add&add_date_timestamp="+active_day_timestamp;}function delete_event(){dialog_box_init();dialog_box.reset();var _32="";if(logged_in||plans_options["disable_passwords"]==1){if(active_series_id){_32+="<div class=\"leftcol\"><span class=\"required_field\">"+plans_lang["recurring_event_delete_all1"]+"</span></div>";_32+="<div class=\"rightcol\"><a href=\"javascript:delete_event_submit(true);\">"+get_lang("recurring_event_delete_all2")+"</a>";_32+="<br/><a href=\"javascript:delete_event_submit();\">"+get_lang("recurring_event_delete_all3")+"</a></div>";}else{_32+="<div class=\"leftcol\"><span class=\"required_field\">"+plans_lang["event_delete1"]+"</span></div>";_32+="<div class=\"rightcol\"><a href=\"javascript:delete_event_submit();\">"+get_lang("event_delete2")+"</a></div>";}}else{_32+="<div class=\"leftcol\"><span class=\"required_field\">"+plans_lang["password"]+":</span></div>";_32+="<div class=\"rightcol\"><input type=\"password\" id=\"delete_event_cal_password\" value=\""+""+"\"/></div>";if(active_series_id){_32+="<div class=\"leftcol\"><span class=\"required_field\">"+plans_lang["recurring_event_delete_all1"]+"</span></div>";_32+="<div class=\"rightcol\"><a href=\"javascript:delete_event_submit(true);\">"+get_lang("recurring_event_delete_all2")+"</a>";_32+="<br/><a href=\"javascript:delete_event_submit();\">"+get_lang("recurring_event_delete_all3")+"</a></div>";}else{_32+="<div class=\"leftcol\"><span class=\"required_field\">"+plans_lang["event_delete1"]+":</span></div>";_32+="<a href=\"javascript:delete_event_submit();\">"+get_lang("event_delete2")+"</a></div>";}}dialog_box.setTitle(get_lang("delete_event"));dialog_box.setContents(_32);dialog_box.element.style.display="block";dialog_box.anchor();if(document.getElementById("delete_event_cal_password")){document.getElementById("delete_event_cal_password").select();}}function delete_event_submit(_33){var _34=(document.getElementById("delete_event_cal_password"))?document.getElementById("delete_event_cal_password").value:"";var url=plans_url+"?api_command=delete_event&output_format=javascript&evt_id="+active_event_id;if(_34!=""){url+="&cal_password="+_34;}if(_33&&active_series_id!=""){url+="&all_in_series=1&series_id="+active_series_id;}try{xmlhttp.open("GET",url,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){eval(xmlhttp.responseText);}};xmlhttp.send(null);}catch(e){}}function pending_events_toggle_events(_36){for(var _37 in pending_events){if(_36==1){if(!document.getElementById("pending_event_approve_"+_37).checked&&!document.getElementById("pending_event_delete_"+_37).checked){document.getElementById("pending_event_approve_"+_37).checked=true;}else{if(document.getElementById("pending_event_approve_"+_37).checked&&!document.getElementById("pending_event_delete_"+_37).checked){document.getElementById("pending_event_approve_"+_37).checked=false;}}}else{if(_36==2){if(!document.getElementById("pending_event_approve_"+_37).checked&&!document.getElementById("pending_event_delete_"+_37).checked){document.getElementById("pending_event_delete_"+_37).checked=true;}else{if(document.getElementById("pending_event_delete_"+_37).checked&&!document.getElementById("pending_event_approve_"+_37).checked){document.getElementById("pending_event_delete_"+_37).checked=false;}}}}}}function approve_pending_events_toggle(){var _38="";if(document.getElementById("pending_events").style.display=="block"){document.getElementById("pending_events").style.display="none";return;}_38+="<div style=\"text-align:right;\"><img src=\""+theme_url+"/graphics/green_check.gif\" onclick=\"pending_events_toggle_events(1)\"><img src=\""+theme_url+"/graphics/trashcan.gif\" onclick=\"pending_events_toggle_events(2)\"/></div>";for(var _39 in pending_events){_38+=generate_pending_event(pending_events[_39]);}_38+="<br style=\"clear:both;\">";_38+="<a style=\"border:solid 1px #ccc;padding:4px;margin-top:5px;\" href=\"javascript:approve_pending_events_submit()\">"+get_lang("email_reminder_text5")+"</a>";_38+="<br style=\"clear:both;\">";document.getElementById("pending_events").innerHTML=_38;document.getElementById("pending_events").style.display="block";}function approve_pending_events_submit(){var _3a=new Array();var _3b=new Array();for(pending_event_id in pending_events){var _3c=document.getElementById("pending_event_approve_"+pending_event_id);var _3d=document.getElementById("pending_event_delete_"+pending_event_id);if(_3c&&_3c.checked){_3a.push(pending_event_id);}if(_3d&&_3d.checked){_3b.push(pending_event_id);}}if(_3a.length==0&&_3b.length==0){alert(get_lang("no_pending_events_checked"));return;}if(!logged_in&&cal_password==""){var _3e="";_3e+="<div class=\"leftcol\"><span class=\"required_field\">"+plans_lang["calendar_password"]+":</span></div>";_3e+="<div class=\"rightcol\"><input id=\"cal_password\" type=\"password\" onKeyPress=\"if (event.keyCode == 13) {cal_password = document.getElementById('cal_password').value;approve_pending_events_submit();dialog_box.close();}\"/></div>";_3e+="<a href=\"\" onclick=\"cal_password = document.getElementById('cal_password').value;approve_pending_events_submit();dialog_box.close();return false;\">ok</a>";dialog_box_init();dialog_box.reset();dialog_box.setTitle("Password Needed");dialog_box.setContents(_3e);dialog_box.element.style.display="block";dialog_box.anchor(document.getElementById("tab_menu"));return;}var url=plans_url+"?manage_pending_events=1&approve="+_3a+"&delete="+_3b;if(cal_password!=""){url+="&cal_password="+cal_password;}try{xmlhttp.open("GET",url,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){eval(xmlhttp.responseText);update_messages(messages);}};xmlhttp.send(null);}catch(e){}}function do_onresize(){if(document.body.clientWidth){opener.info_window_width=document.body.clientWidth;opener.info_window_height=document.body.clientHeight;}else{if(this.outerWidth){opener.info_window_width=this.outerWidth;opener.info_window_height=this.outerHeight;}}}function display_event(_40){var _41=window_x()-info_window_width;var _42=window_y();if(_40.match(/^r/)){var _43=remote_event_details[_40].url;info_window=this.open(_43,"info_window","resizable=yes,status=yes,scrollbars=yes,top="+_42+",left="+_41+",width="+info_window_width+",height="+info_window_height);}else{var _44=plans_url+"?view_event=1&evt_id="+_40;info_window=this.open(_44,"info_window","resizable=yes,status=yes,scrollbars=yes,top="+_42+",left="+_41+",width="+info_window_width+",height="+info_window_height);}info_window.focus();}function display_pending_event(_45){var _46=window_x()-info_window_width;var _47=window_y();var _48=plans_url+"?view_pending_event=1&pending_event_id="+_45;info_window=this.open(_48,"info_window","resizable=yes,status=yes,scrollbars=yes,top="+_47+",left="+_46+",width="+info_window_width+",height="+info_window_height);info_window.focus();}function generate_pending_event(_49){var _4a="";_4a+="<div style=\"text-align:right;\">";_4a+=generate_list_event(_49,"javascript:display_pending_event("+_49.id+")");_4a+="<input name=\"pending_event_"+_49.id+"\" id=\"pending_event_approve_"+_49.id+"\" type=\"radio\"/><input name=\"pending_event_"+_49.id+"\" id=\"pending_event_delete_"+_49.id+"\" type=\"radio\"/></div>";return _4a;}function generate_list_event(_4b,_4c){var _4d="";var _4e;var _4f;var _50=nice_date(_4b.start,_4b.end);_4d+="<span class=\"small_note\" style=\"line-height:20px;\">"+_50;if(_4b.icon&&_4b.icon!="blank"){_4d+="<img src=\""+theme_url+"/icons/"+_4b.icon+"_16x16.gif\"/>";}_4d+="<a href=\"javascript:display_pending_event("+_4b.id+")\">"+_4b.title+"</a>";_4d+="</span>";return _4d;}function nice_date(_51,end,_53,_54){_51=new Date(_51*1000);end=new Date(end*1000);var _55="";var _56=" - ";var _57=(_54||_51.getUTCFullYear()!=rightnow.getUTCFullYear())?", "+_51.getUTCFullYear():"";var _58=(_54||end.getUTCFullYear()!=rightnow.getUTCFullYear())?", "+end.getUTCFullYear():"";var _59=(_53)?plans_lang["months_abv"][_51.getUTCMonth()]:plans_lang["months"][_51.getUTCMonth()];var _5a=(_53)?plans_lang["months_abv"][end.getUTCMonth()]:plans_lang["months"][end.getUTCMonth()];if(date_format=="dd/mm/yy"){if(_51.getUTCMonth()==end.getUTCMonth()&&_51.getUTCFullYear()==end.getUTCFullYear()&&_51.getUTCDate()==end.getUTCDate()){_55=_51.getUTCDate()+" "+_59+_57;}else{if(_51.getUTCMonth()==end.getUTCMonth()&&_51.getUTCFullYear()==end.getUTCFullYear()){_55=_51.getUTCDate()+_56+end.getUTCDate()+" "+_59+_57;}else{if(_51.getUTCFullYear()!=end.getUTCFullYear()){_55=_51.getUTCDate()+_59+_57+_56+end.getUTCDate()+_5a+_58;}else{_55=_51.getUTCDate()+_59+_56+end.getUTCDate()+_5a+_58;}}}}else{if(_51.getUTCMonth()==end.getUTCMonth()&&_51.getUTCFullYear()==end.getUTCFullYear()&&_51.getUTCDate()==end.getUTCDate()){_55=_59+" "+_51.getUTCDate()+_57;}else{if(_51.getUTCMonth()==end.getUTCMonth()&&_51.getUTCFullYear()==end.getUTCFullYear()){_55=_59+""+_51.getUTCDate()+_56+end.getUTCDate()+_57;}else{if(_51.getUTCFullYear()!=end.getUTCFullYear()){_55=_59+" "+_51.getUTCDate()+_57+_56+_5a+" "+end.getUTCDate()+_58;}else{_55=_59+" "+_51.getUTCDate()+_56+_5a+" "+end.getUTCDate()+_58;}}}}return _55;}function nice_time(_5b,end,_5d){var _5e=new Date(_5b*1000);var _5f=new Date(end*1000);var _60=(_5e.getDay()==_5f.getDay())?"":"dna ";var _61="";_61=formatDate(_5e,_60+"sh:mm ampm")+" - "+formatDate(_5f,_60+"sh:mm ampm");if(end-_5b<=1){_61=_61.replace(/s*-.+/,"");return _61;}var _62=new RegExp("(.*) am(.*am.*)");var _63=new RegExp("(.*) pm(.*pm.*)");_61=_61.replace(_62,"$1$2");_61=_61.replace(_63,"$1$2");_61=_61.replace(/am/,plans_lang["am"]);_61=_61.replace(/pm/,plans_lang["pm"]);return _61;}function addZero(_64){return ((_64<10)?"0":"")+_64;}function formatDate(_65,_66){var _67=addZero(_65.getDate());var _68=addZero(_65.getMonth()+1);var _69=plans_lang["months"][_65.getMonth()];var _6a=plans_lang["months_abv"][_65.getMonth()];var _6b=plans_lang["day_names"][_65.getDay()];var _6c=plans_lang["day_names_abv"][_65.getDay()];var _6d=addZero(_65.getFullYear());var _6e=addZero(_65.getFullYear().toString().substring(3,4));var _6f=(_66.indexOf("yyyy")>-1?_6d:_6e);var _70=addZero(_65.getUTCHours());var _71=(_70<12)?"am":"pm";var _72=_70;if(_70>12){_72-=12;}if(_72==0){_72=12;}var _73=addZero(_65.getUTCMinutes());var _74=addZero(_65.getUTCSeconds());var _75=_66.replace(/dd/g,_67).replace(/MM/g,_68).replace(/MNA/g,_6a).replace(/MN/g,_69).replace(/y{1,4}/g,_6f);_75=_75.replace(/hh/g,_70).replace(/sh/g,_72).replace(/mm/g,_73).replace(/ss/g,_74).replace(/ampm/g,_71);_75=_75.replace(/dna/g,_6c).replace(/dn/g,_6b);return _75;}function xmlhttp_init(){try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}if(!xmlhttp&&typeof XMLHttpRequest!="undefined"){xmlhttp=new XMLHttpRequest();}}function get_lang(key){if(plans_lang[key]){return plans_lang[key];}return "";}function User(i,n){this.id=(i)?i:null;this.name=(n)?n:"";}function Calendar(_79){this.id=get_property(_79,"id",null);this.title=get_property(_79,"title","");this.local_background_calendars_string=get_property(_79,"local_background_calendars","");this.local_background_calendars=this.local_background_calendars_string.split(",");if(!this.local_background_calendars){this.local_background_calendars=new Array();}}function Event(_7a){this.id=get_property(_7a,"id",null);this.title=get_property(_7a,"title","");this.details=get_property(_7a,"details","");this.details_url=get_property(_7a,"details_url",false);this.icon=get_property(_7a,"icon","");this.bgcolor=get_property(_7a,"bgcolor","");this.unit_number=get_property(_7a,"unit_number","");this.start=get_property(_7a,"start","");this.end=get_property(_7a,"end","");this.timestamp=get_property(_7a,"timestamp",0);this.days=get_property(_7a,"days",1);this.all_day_event=get_property(_7a,"all_day_event",false);this.no_end_time=get_property(_7a,"no_end_time",false);this.cal_ids_string=get_property(_7a,"cal_ids","");this.cal_ids=this.cal_ids_string.split(",");}