var Ami={};Ami.Data={};Ami.SetReadOnly=function(a){if(a==true){$("#ReadOnly").val("1");$("#tbbLinkTasks").removeClass("tb_btn_enabled");$("#tbbUnlinkTasks").removeClass("tb_btn_enabled");$("#tbbIndent").removeClass("tb_btn_enabled");$("#tbbOutdent").removeClass("tb_btn_enabled");$("#tbbLinkTasks").unbind("");$("#tbbUnlinkTasks").unbind("");$("#tbbIndent").unbind("");$("#tbbOutdent").unbind("");Ami.Utils.changeBackgroundImageX("#tbbLinkTasks div",20);Ami.Utils.changeBackgroundImageX("#tbbUnlinkTasks div",20);Ami.Utils.changeBackgroundImageX("#tbbIndent div",20);Ami.Utils.changeBackgroundImageX("#tbbOutdent div",20)}else{$("#ReadOnly").val("0");$("#tbbLinkTasks").addClass("tb_btn_enabled");$("#tbbUnlinkTasks").addClass("tb_btn_enabled");$("#tbbIndent").addClass("tb_btn_enabled");$("#tbbOutdent").addClass("tb_btn_enabled");$(".tb_btn_enabled").hover(function(){$(this).addClass("tb_btn_hover")},function(){$(this).removeClass("tb_btn_hover")});Ami.Utils.changeBackgroundImageX("#tbbLinkTasks div",-20);Ami.Utils.changeBackgroundImageX("#tbbUnlinkTasks div",-20);Ami.Utils.changeBackgroundImageX("#tbbIndent div",-20);Ami.Utils.changeBackgroundImageX("#tbbOutdent div",-20)}};Ami.IsReadOnly=function(){if($("#ReadOnly").val()=="1"){return true}else{return false}};var AmiConst={UP:1,RIGHT:2,DOWN:3,LEFT:4,HOME:5,END:6,PGDOWN:7,PGUP:8};Ami.Utils={};$.datepicker.getregion=function(b){var a=$.datepicker.regional[b];if(a){return a}b=b.split("-");a=$.datepicker.regional[0];if(b.length==2&&a){return a}return $.datepicker.regional[""]};Ami.Utils.runCommand=function(a){Ami.Utils.runCommand2(a,Ami.Utils.defaultOnSuccess)};Ami.Utils.runCommand2=function(c,a){var b={ProjectFileID:""};Ami.Utils.runCommand3(c,a,b)};Ami.Utils.runCommand3=function(d,a,c){if(a==null){a=Ami.Utils.defaultOnSuccess}var b;c.ProjectFileID=$("#ProjectID").val();$.ajax({type:"POST",url:"/WebService.asmx/"+d,data:$.toJSON(c),contentType:"application/json; charset=utf-8",dataType:"json",success:function(e){a(e.d)}})};Ami.Utils.defaultOnSuccess=function(msg){var r=eval("("+msg+")");if(r.msg!=null){Ami.Dialogs.MsgBox.show2(r.msg,"ok",r.icon)}};Ami.Utils.setCursorToEnd=function(a){var b=document.getElementById(a);b.focus();b.setSelectionRange(b.value.length,b.value.length);var c=document.createEvent("KeyboardEvent");c.initKeyEvent("keypress",true,true,null,false,false,false,false,0,32);b.dispatchEvent(c);c=document.createEvent("KeyboardEvent");c.initKeyEvent("keypress",true,true,null,false,false,false,false,8,0);b.dispatchEvent(c)};Ami.Utils.changeBackgroundImageX=function(b,a){var c=parseInt($(b).css("background-position").match(/[0-9]{1,6}/)[0])+a;$(b).css("background-position",$(b).css("background-position").replace(/[0-9]{1,6}/,c))};Ami.Utils.isError=function(msg,ref){if(msg.d[0]=="<"){return false}if(typeof ref=="undefined"){ref={}}ref.msgObject=eval("("+msg.d+")");if(ref.msgObject.msg!=null){Ami.Dialogs.MsgBox.show2(ref.msgObject.msg,"ok",ref.msgObject.icon);return true}return false};Ami.Utils.isUserRegistered=function(){return $("#login_info a[href$=Login.aspx]").length==0};Ami.Utils.isUserOwner=function(){if($("#IsOwner").val()=="1"){return true}else{return false}};Ami.Utils.getDate=function(a){if($(a).val()==$("#null_date_mark").val()){return null}else{return $(a).datepicker("getDate")}};Ami.Utils.getAlignValue=function(a){return a=="left"?0:(a=="center"?1:2)};String.prototype.format=function(){var a=this;for(arg in arguments){a=a.replace("{"+arg+"}",arguments[arg])}return a};Ami.Validation={};Ami.Validation.set=function(b,a){if(!$(b).length){return}var c=$.data($(b)[0],"rules");if(!c){c={}}$.extend(c,a);$.data($(b)[0],"rules",c)};Ami.Validation.check=function(a){var c=$.data($(a)[0],"rules");if(!c){return true}var b=true;for(elementID in c){for(rule in c[elementID]){b&=Ami.Validation.checkElement(elementID,rule,c[elementID][rule])}}return b};Ami.Validation.checkElement=function(c,d,e){var b=true;var a=$("#"+c)[0];switch(d){case"required":b=Ami.Validation.checkRequired(a);break;case"range":b=Ami.Validation.checkRange(a,e);break}if(!b){Ami.Validation.showMessage(c,d,e)}return b};Ami.Validation.checkRequired=function(a){return $(a).val().length>0};Ami.Validation.checkRange=function(a,c){var b=$(a).val();return b>=c[0]&b<=c[1]};Ami.Validation.showMessage=function(a,c,e){var d="#"+a+"_"+c+"_error";if($(d).length==0){d="#validation_error_msg_"+c}var f=$("label[for='"+a+"']").text().replace(":","");var b=$(d).val().format(f,e,e[0],e[1]);Ami.Dialogs.MsgBox.show2(b,"ok","error")};Ami.Events={};function pageLoad(){Ami.Events.pageLoad()}$(function(){Ami.Events.documentReady()});Ami.Events.pageLoad=function(){$("#right_scroll_nested1").bind("scroll",function(a){scrollRight()});Ami.LeftPanel.init();$("#vscroll").bind("scroll",function(a){scrollVertical()});$("#GanttChartImg2").bind("load",function(a){ganttChartImgLoaded()});$("#right").css("top",$("#left").css("top"))};Ami.Events.documentReady=function(){Ami.Grid.init();Ami.Grid.selectFristCell();Ami.Dialogs.MsgBox.init();Ami.Presenter.init();$(window).bind("scroll",function(d){return false});$.scrollTo.defaults.axis="xy";SetSizes();$(window).bind("resize",function(d){ResizeListner(d)});$("#SelectedCellText").bind("dblclick",function(d){b=new Ami.Dialogs.TaskInfo;b.showCommand({event:d,tabIndex:-1})});$("#tbbNew").bind("click",function(d){Ami.Events.newProject()});$("#tbbOpen").bind("click",function(d){$("#BrowseOpenFilePanel").dialog("open")});$("#tbbSave").bind("click",function(d){window.location="../save.aspx?ProjectFileID="+$("#ProjectID").val()});$("#tbbPrint").bind("click",function(d){PrintProject()});$("#tbbPrintPreview").bind("click",function(d){b=new Ami.Dialogs.PrintSettings;b.showCommand({doNotLoad:true})});$("#tbbTaskInformation").bind("click",function(d){b=new Ami.Dialogs.TaskInfo;b.showCommand({event:d,tabIndex:-1})});$("#tbbTaskNotes").bind("click",function(d){b=new Ami.Dialogs.TaskInfo;b.showCommand({event:d,tabIndex:4})});$("#tbbZoomIn").bind("click",function(d){ZoomIn()});$("#tbbZoomOut").bind("click",function(d){ZoomOut()});$("#tbbShowSubtasks").bind("click",function(d){Ami.Grid.showSubTasksClick()});$("#tbbHideSubtasks").bind("click",function(d){Ami.Grid.hideSubTasksClick()});$("#tbbIndent").bind("click",function(d){Ami.Grid.indentTasksClick()});$("#tbbOutdent").bind("click",function(d){Ami.Grid.outdentTasksClick()});$("#tbbLinkTasks").bind("click",function(d){Ami.Grid.linkTasksTasksClick()});$("#tbbUnlinkTasks").bind("click",function(d){Ami.Grid.unlinkTasksTasksClick()});$("#mi_new").bind("click",function(d){Ami.Events.newProject()});$("#mi_open").bind("click",function(d){$("#BrowseOpenFilePanel").dialog("open")});$("#mi_print").bind("click",function(d){PrintProject()});$("#mi_printpreview").bind("click",function(d){b=new Ami.Dialogs.PrintSettings;b.showCommand({doNotLoad:true})});$("#mi_taskinfo").bind("click",function(d){b=new Ami.Dialogs.TaskInfo;b.showCommand({event:d,tabIndex:-1})});$("#mi_tasknotes").bind("click",function(d){b=new Ami.Dialogs.TaskInfo;b.showCommand({event:d,tabIndex:4})});$("#mi_projectinfo").bind("click",function(d){b=new Ami.Dialogs.ProjectInfo;b.showCommand()});$("#mi_share").bind("click",function(d){b=new Ami.Dialogs.Share;b.showCommand()});$("#mi_opentemplate").bind("click",function(d){OpenBrowseTemplateDialog()});$("#mi_rp").bind("click",function(d){toggleRPanel(d)});$("#mi_timescale").bind("click",function(d){b=new Ami.Dialogs.Timescale;b.showCommand()});$(".right_header").bind("dblclick",function(d){b=new Ami.Dialogs.Timescale;b.showCommand();return false});$("#mi_insert_task").bind("click",function(d){Ami.Grid.insertTasksClick(d)});$("#mi_delete_task").bind("click",function(d){Ami.Grid.deleteTasksClick(d)});$("#mi_link_tasks").bind("click",function(d){Ami.Grid.linkTasksTasksClick()});$("#mi_unlink_tasks").bind("click",function(d){Ami.Grid.unlinkTasksTasksClick()});$("#info_panel_view_samples").bind("click",function(d){OpenBrowseTemplateDialog()});$("#hide_rp").bind("click",function(d){toggleRPanel(d)});Hacks();$("#right_scroll_nested2").width($(".timescale_header").width());$(".gantt_rendering div").width($(".timescale_header").width());$("#vscroll_nested").height($("#grid_table").height()+30);$("#sep").draggable({axis:"x",containment:[51,0,$("#vscroll").position().left-7,100]});$("#sep").bind("dragstop",function(e,d){SeparatorDragStop(e,true)});$(".tb_btn_enabled").hover(function(){$(this).addClass("tb_btn_hover")},function(){$(this).removeClass("tb_btn_hover")});$("#GanttChart1").mousewheel(function(e,d){MouseWheelScroll(e,d)});if($("#ReadOnly").val()=="1"){Ami.SetReadOnly(true)}if($("#rp_AutoHide").val()=="1"){HideRPanelNA()}$("#reading_error_msgbox").dialog({resizable:false,height:200,width:350,modal:true,position:"center",buttons:{Ok:function(){$(this).dialog("close")}},autoOpen:false});$("#BrowseOpenFilePanel").dialog({resizable:false,height:200,width:600,modal:true,position:"center",buttons:{Open:function(){ShowUploadIndicator()},Cancel:function(){$(this).dialog("close")}},autoOpen:false});$("#BrowseOpenFilePanel").parent().appendTo($("form:first"));$("#templates").dialog({resizable:false,height:400,width:400,modal:true,position:"center",buttons:{Close:function(){$(this).dialog("close")}},autoOpen:false});if($("#msgbox_message")[0].innerHTML.length>0){Ami.Dialogs.MsgBox.show()}if($("#reading_error_msgbox_message")[0].innerHTML.length>0){$("#reading_error_msgbox").dialog("open")}$("ul.sf-menu").supersubs({minWidth:12,maxWidth:27,extraWidth:1}).find("ul").bgIframe({opacity:false});var c=$("#DateFormat").val();var a=$("#Language").val();$.datepicker.setDefaults($.datepicker.getregion(a));$.datepicker.setDefaults({dateFormat:c});$("#sep").css("left",$(".right_header").css("left"));SeparatorDragStop(false)};Ami.Events.newProject=function(){document.cookie="Preferences=ProjectFileID=; expires=Thu, 01-Jan-70 00:00:01 GMT;";window.location="../app.aspx"};Ami.LeftPanel={};Ami.LeftPanel.init=function(){Ami.LeftPanel.setEvents();Ami.LeftPanel.HScroll.init()};Ami.LeftPanel.setEvents=function(){};Ami.LeftPanel.HScroll={};Ami.LeftPanel.HScroll.init=function(){$("#left_scroll").bind("scroll",function(a){Ami.LeftPanel.HScroll.onScroll(a)})};Ami.LeftPanel.HScroll.onScroll=function(a){var b=$get("left_scroll").scrollLeft;Ami.LeftPanel.HScroll.scrollContainerTo(b)};Ami.LeftPanel.HScroll.scrollDelta=function(a){var b=$get("left_scroll").scrollLeft+a;$("#left_scroll").stop().scrollTo(b)};Ami.LeftPanel.HScroll.scrollContainerTo=function(a){$.scrollTo.defaults.axis="x";$("#left_header").stop().scrollTo(a);$("#left").stop().scrollTo(a)};Ami.GanttChart={};Ami.GanttChart.refreshImage=function(a){var c=$("#gr0").css("background-image");c=c.replace(/zoom=[0-9]*/,"zoom="+Math.floor(Math.random()*1000000));c=c.replace(/isBlank=True/,"isBlank=False");if(a!="0"){c=c.replace(/timeSpanPerPixel=[0-9]*/,"timeSpanPerPixel="+a)}$("#gr0").css("background-image","");$(".gantt_rendering div").css("background-image",c)};Ami.GanttChart.refreshTimescale=function(c){var e=$(".right_header").css("left"),d=$(".right_header").width();$(".right_header").remove();$(c).insertAfter("#sep");var a=$(".timescale_header").width();$(".gantt_rendering div").width(a);$(".gantt_rendering").width(a);$("#right_scroll_nested2").width(a);$(".right_header").css("left",e);$(".right_header").width(d);$(".right_header").bind("dblclick",function(f){b=new Ami.Dialogs.Timescale;b.showCommand()})};function ZoomIn(){Ami.Utils.runCommand2("ZoomIn",Ami.GanttChart.onAfterZoom)}function ZoomOut(){Ami.Utils.runCommand2("ZoomOut",Ami.GanttChart.onAfterZoom)}Ami.GanttChart.onAfterZoom=function(a){$("#hidden_div").trigger("Ami.GanttChart.AfterZoom",a)};Ami.Dialogs=function(){};Ami.Dialogs.prototype.dialogID="";Ami.Dialogs.prototype.showCommand=function(a){if($(this.dialogID).length==0){this.load(a)}else{this.loadData(a)}};Ami.Dialogs.prototype.load=function(b){var a=this;$.ajax({type:"POST",url:"/WebService.asmx/GetDialog",data:"{'DialogID':'"+this.dialogID+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(c){Ami.Dialogs.afterLoad(c,a,b)}})};Ami.Dialogs.afterLoad=function(a,c,b){if(Ami.Utils.isError(a)){return}$("#hidden_div").append(a.d);c.init();c.loadData(b)};Ami.Dialogs.prototype.onOkClicked=function(){};Ami.Dialogs.prototype.setValidationRules=function(){};Ami.Dialogs.prototype.init=function(){$(this.dialogID).dialog({resizable:false,height:450,width:650,modal:true,position:"center",buttons:{OK:this.onOkClicked,Cancel:function(){$(this).dialog("close")}},autoOpen:false});this.setValidationRules()};Ami.Dialogs.prototype.loadData=function(b){var c=this;if(typeof b!="undefined"&&typeof b.doNotLoad!="undefined"){var a={};a.d="{}";Ami.Dialogs.show(a,c,b)}else{$.ajax({type:"POST",url:"/WebService.asmx/GetDialogData",data:"{'ProjectFileID':'"+$("#ProjectID").val()+"','DialogID':'"+this.dialogID+"','Params':'"+$.toJSON(b)+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(d){Ami.Dialogs.show(d,c,b)}})}};Ami.Dialogs.prototype.initControls=function(a){};Ami.Dialogs.show=function(a,c,b){var d={};if(Ami.Utils.isError(a,d)){return}c.initControls(d.msgObject,b);$(c.dialogID).dialog("open").parent().appendTo(jQuery("form:first"))};Ami.Dialogs.ProjectInfo=function(){Ami.Dialogs.call(this)};Ami.Dialogs.ProjectInfo.prototype=new Ami.Dialogs;Ami.Dialogs.ProjectInfo.prototype.dialogID="#project_info_dlg";Ami.Dialogs.ProjectInfo.prototype.initControls=function(a){$("#project_info_start").val(a.start);$("#project_info_finish").val(a.finish);$("#project_info_status").val(a.status);$("#project_info_current").val(a.current);$("#project_info_calendar").val(a.calendar);$("#project_info_schedule").val(a.schedule);$("#project_info_priority").val(a.priority)};Ami.Dialogs.ProjectInfo.prototype.init=function(){Ami.Dialogs.prototype.init.apply(Ami.Dialogs.ProjectInfo.prototype);$("#project_info_start").datepicker();$("#project_info_current").datepicker();$("#project_info_finish").datepicker();$("#project_info_status").datepicker()};Ami.Dialogs.ProjectInfo.prototype.onOkClicked=function(){var a={Start:$("#project_info_start").datepicker("getDate"),Finish:$("#project_info_finish").datepicker("getDate"),Status:$("#project_info_status").datepicker("getDate"),Current:$("#project_info_current").datepicker("getDate"),Calendar:$("#project_info_calendar").val(),Schedule:$("#project_info_schedule").val(),Priority:$("#project_info_priority").val()};$("#project_info_dlg").dialog("close");Ami.Utils.runCommand3("ProjectInfo_SetData",Ami.Dialogs.ProjectInfo.AfterSetData,a)};Ami.Dialogs.ProjectInfo.AfterSetData=function(a){$("#hidden_div").trigger("Ami.Dialogs.ProjectInfo.AfterSetData",a)};Ami.Dialogs.TaskInfo=function(){Ami.Dialogs.call(this)};Ami.Dialogs.TaskInfo.prototype=new Ami.Dialogs;Ami.Dialogs.TaskInfo.prototype.dialogID="#task_info_dlg";Ami.Dialogs.TaskInfo.prototype.showCommand=function(a){if($(".grid_table_td_selected").length>0){var b=($(".grid_table_td_selected").parents().filter("tr").attr("id")).substring(2);if(b){if(a.event.target.id=="SelectedCellUp"||a.event.target.id=="SelectedCellDown"){return}Ami.Dialogs.prototype.showCommand.apply(Ami.Dialogs.TaskInfo.prototype,[{taskID:b,tabIndex:a.tabIndex}])}}};Ami.Dialogs.TaskInfo.prototype.init=function(){Ami.Dialogs.prototype.init.apply(Ami.Dialogs.TaskInfo.prototype);$("#task_info_dlg_tabs").tabs({selected:0});$("#task_info_dlg_start").datepicker();$("#task_info_dlg_finish").datepicker();$("#task_info_dlg_deadline").datepicker();$("#task_info_dlg_constraint_date").datepicker()};Ami.Dialogs.TaskInfo.prototype.onOkClicked=function(){var a={taskID:$("#task_info_dlg_taskID").val(),name:$("#task_info_dlg_name").val(),duration:Ami.Dialogs.TaskInfo.duration.value,durationFormat:Ami.Dialogs.TaskInfo.duration.units.value,percentageComplete:$("#task_info_dlg_percentage_complete").val(),priority:$("#task_info_dlg_priority").val(),start:Ami.Utils.getDate("#task_info_dlg_start"),finish:Ami.Utils.getDate("#task_info_dlg_finish"),hideBar:$("#task_info_dlg_hide_bar").is(":checked"),rollup:$("#task_info_dlg_rollup").is(":checked"),deadline:Ami.Utils.getDate("#task_info_dlg_deadline"),constraintType:$("#task_info_dlg_constraint_type").val(),constraintDate:Ami.Utils.getDate("#task_info_dlg_constraint_date"),taskType:$("#task_info_dlg_task_type").val(),effortDriven:$("#task_info_dlg_effort_driven").is(":checked"),calendar:$("#task_info_dlg_calendar").val(),ignoreResourceCalendar:$("#task_info_dlg_ignore_resource_calendar").is(":checked"),wbs:$("#task_info_dlg_wbs").val(),earnedValueMethod:$("#task_info_dlg_earned_value_method").val(),milestone:$("#task_info_dlg_milestone").is(":checked"),notes:$("#task_info_dlg_tab_notes textarea").text()};Ami.Utils.runCommand3("TaskInfo_SetData",Ami.Dialogs.TaskInfo.AfterSetData,a);$(this).dialog("close")};Ami.Dialogs.TaskInfo.AfterSetData=function(a){$("#hidden_div").trigger("Ami.Dialogs.Timescale.AfterSetData",a)};Ami.Dialogs.TaskInfo.prototype.initControls=function(a,c){if(a.empty!=null){Ami.Dialogs.TaskInfo.clearControls();return}$("#task_info_dlg_taskID").val(c.taskID);$("#task_info_dlg_name").val(a.name);Ami.Dialogs.TaskInfo.duration=new Ami.Duration(a.duration,a.durationFormat);$("#task_info_dlg_duration").val(Ami.Dialogs.TaskInfo.duration.toString2());$("#task_info_dlg_estimated").attr("checked",(Ami.Dialogs.TaskInfo.duration.isEstimated()));$("#task_info_dlg_percentage_complete").val(a.percentageComplete);$("#task_info_dlg_priority").val(a.priority);$("#task_info_dlg_start").val(a.start);$("#task_info_dlg_finish").val(a.finish);$("#task_info_dlg_hide_bar").attr("checked",(a.hideBar=="True"));$("#task_info_dlg_rollup").attr("checked",(a.rollup=="True"));$("#task_info_dlg_deadline").val(a.deadline);$("#task_info_dlg_constraint_type").val(a.constraintType);$("#task_info_dlg_constraint_date").val(a.constraintDate);$("#task_info_dlg_task_type").val(a.taskType);$("#task_info_dlg_effort_driven").attr("checked",(a.effortDriven=="True"));$("#task_info_dlg_calendar").val(a.calendar);$("#task_info_dlg_ignore_resource_calendar").attr("checked",(a.ignoreResourceCalendar=="True"));$("#task_info_dlg_wbs").val(a.wbs);$("#task_info_dlg_earned_value_method").val(a.earnedValueMethod);$("#task_info_dlg_milestone").attr("checked",(a.milestone=="True"));$("#task_info_dlg_tab_notes textarea").text(a.notes);Ami.Dialogs.TaskInfo.clearGrids();for(var b=0;b<a.predecessors.length;b++){var e=a.predecessors[b];duration=new Ami.Duration(e.duration,e.durationFormat);var d="<tr><td>"+e.id+"</td><td>"+e.taskName+"</td><td>"+Ami.RelationType.toString2(e.type)+"</td><td>"+duration.toString2()+"</td></tr>";if(b==0){$("#task_info_dlg_tab_predecessors table tbody").html(d)}else{$("#task_info_dlg_tab_predecessors table tbody").append(d)}}for(var b=0;b<a.resources.length;b++){var f=a.resources[b];var d="<tr><td>"+f.resourceName+"</td><td>"+f.assignmentOwner+"</td><td>"+f.units+"</td><td>"+f.cost+"</td></tr>";if(b==0){$("#task_info_dlg_tab_resources table tbody").html(d)}else{$("#task_info_dlg_tab_resources table tbody").append(d)}}$("#task_info_dlg_dlg").dialog("open");if(c.tabIndex>=0&&c.tabIndex<=4){$("#task_info_dlg_tabs").tabs("select",c.tabIndex)}};Ami.Dialogs.TaskInfo.clearControls=function(){$("#task_info_dlg_dlg").dialog("open");$("#task_info_dlg_name").val("");$("#task_info_dlg_duration").val("");$("#task_info_dlg_estimated").attr("checked",false);$("#task_info_dlg_percent_complete").val("");$("#task_info_dlg_priority").val("");$("#task_info_dlg_start").val("");$("#task_info_dlg_finish").val("");$("#task_info_dlg_hide_bar").attr("checked",false);$("#task_info_dlg_rollup").attr("checked",false);$("#task_info_dlg_deadline").val("");$("#task_info_dlg_constraint_type").val("");$("#task_info_dlg_constraint_value").val("");$("#task_info_dlg_task_type").val("");$("#task_info_dlg_effort_driven").attr("checked",false);$("#task_info_dlg_calendar").val("");$("#task_info_dlg_ignore_resource_calendar").attr("checked",false);$("#task_info_dlg_wbs").val("");$("#task_info_dlg_earned_value_method").val("");$("#task_info_dlg_milestone").attr("checked",false);$("#task_info_dlg_tab_notes textarea").text("");Ami.Dialogs.TaskInfo.clearGrids()};Ami.Dialogs.TaskInfo.clearGrids=function(){$("#task_info_dlg_tab_predecessors table tbody").html("<tr><td></td><td></td><td></td><td></td></tr>");$("#task_info_dlg_tab_resources table tbody").html("<tr><td></td><td></td><td></td><td></td></tr>")};Ami.Dialogs.Timescale=function(){Ami.Dialogs.call(this)};Ami.Dialogs.Timescale.prototype=new Ami.Dialogs;Ami.Dialogs.Timescale.prototype.dialogID="#timescale_dlg";Ami.Dialogs.Timescale.prototype.init=function(){Ami.Dialogs.prototype.init.apply(Ami.Dialogs.Timescale.prototype);$("#timescale_dlg_tabs").tabs({selected:0});var a=Ami.Dialogs.Timescale.prototype;a.setEvents();a.copyDropBoxes()};Ami.Dialogs.Timescale.prototype.setEvents=function(){$("#timescale_dlg_top_tier_units").change(function(){Ami.Dialogs.Timescale.prototype.onTopTierUnitsChange()});$("#timescale_dlg_middle_tier_units").change(function(){Ami.Dialogs.Timescale.prototype.onMiddleTierUnitsChange()});$("#timescale_dlg_bottom_tier_units").change(function(){Ami.Dialogs.Timescale.prototype.onBottomTierUnitsChange()});$("#timescale_dlg_show").change(function(){Ami.Dialogs.Timescale.prototype.onShowChange()})};Ami.Dialogs.Timescale.prototype.initControls=function(a){var b="#timescale_dlg_top_tier_";$(b+"units").val(this.number2Units(a.top_tier_units));$(b+"align").val(a.top_tier_align);this.updateLabelOptions(b);$(b+"label").val(a.top_tier_label);$(b+"tick_lines").attr("checked",a.top_tier_tick_lines=="True");$(b+"use_fiscal_year").attr("checked",a.top_tier_use_fiscal_year=="True");$(b+"count").val(a.top_tier_count);b="#timescale_dlg_middle_tier_";$(b+"units").val(this.number2Units(a.middle_tier_units));$(b+"align").val(a.middle_tier_align);this.updateLabelOptions(b);$(b+"label").val(a.middle_tier_label);$(b+"tick_lines").attr("checked",a.middle_tier_tick_lines=="True");$(b+"use_fiscal_year").attr("checked",a.middle_tier_use_fiscal_year=="True");$(b+"count").val(a.middle_tier_count);b="#timescale_dlg_bottom_tier_";$(b+"units").val(this.number2Units(a.bottom_tier_units));$(b+"align").val(a.bottom_tier_align);this.updateLabelOptions(b);$(b+"label").val(a.bottom_tier_label);$(b+"tick_lines").attr("checked",a.bottom_tier_tick_lines=="True");$(b+"use_fiscal_year").attr("checked",a.bottom_tier_use_fiscal_year=="True");$(b+"count").val(a.bottom_tier_count);b="#timescale_dlg_";$(b+"show").val(a.show);$(b+"size").val(a.size);$(b+"scale_separator").attr("checked",a.separator=="True");b="#timescale_dlg_nwt_";$(b+"draw").val(a.nwt_draw);$(b+"calendar").val(a.nwt_calendar);$(b+"color").val(a.nwt_color);$(b+"pattern").val(a.nwt_pattern);this.colorSelect(b+"color option");this.disableAllTiers(false)};Ami.Dialogs.Timescale.prototype.colorSelect=function(a){var c="background-color";$(a+":eq(1)").css(c,"black");$(a+":eq(2)").css(c,"red");$(a+":eq(3)").css(c,"yellow");$(a+":eq(4)").css(c,"lime");$(a+":eq(5)").css(c,"aqua");$(a+":eq(6)").css(c,"blue");$(a+":eq(7)").css(c,"fuchsia");$(a+":eq(8)").css(c,"maroon");$(a+":eq(9)").css(c,"green");$(a+":eq(10)").css(c,"olive");$(a+":eq(11)").css(c,"navy");$(a+":eq(12)").css(c,"purple");$(a+":eq(13)").css(c,"teal");$(a+":eq(14)").css(c,"gray");$(a+":eq(15)").css(c,"silver")};Ami.Dialogs.Timescale.prototype.onOkClicked=function(){var f=Ami.Dialogs.Timescale.prototype;var c="#timescale_dlg_bottom_tier_";var h="#timescale_dlg_top_tier_";var b="#timescale_dlg_middle_tier_";var g="#timescale_dlg_nwt_";var e="#timescale_dlg_";var a={top_tier_units:f.unit2Number($(h+"units").val()),middle_tier_units:f.unit2Number($(b+"units").val()),bottom_tier_units:f.unit2Number($(c+"units").val()),top_tier_label:$(h+"label").val(),middle_tier_label:$(b+"label").val(),bottom_tier_label:$(c+"label").val(),top_tier_fiscal_year:$(h+"use_fiscal_year").is(":checked"),middle_tier_fiscal_year:$(b+"use_fiscal_year").is(":checked"),bottom_tier_fiscal_year:$(c+"use_fiscal_year").is(":checked"),top_tier_count:$(h+"count").val(),middle_tier_count:$(b+"count").val(),bottom_tier_count:$(c+"count").val(),top_tier_align:$(h+"align").val(),middle_tier_align:$(b+"align").val(),bottom_tier_align:$(c+"align").val(),top_tier_tick_lines:$(h+"tick_lines").is(":checked"),middle_tier_tick_lines:$(b+"tick_lines").is(":checked"),bottom_tier_tick_lines:$(c+"tick_lines").is(":checked"),nwt_draw:$(g+"draw").val(),nwt_color:$(g+"color").val(),nwt_pattern:$(g+"pattern").val(),nwt_calendar:$(g+"calendar").val(),size:$(e+"size").val(),separator:$(e+"scale_separator").is(":checked"),show:$(e+"show").val()};Ami.Utils.runCommand3("Timescale_SetData",Ami.Dialogs.Timescale.AfterSetData,a);$(f.dialogID).dialog("close")};Ami.Dialogs.Timescale.AfterSetData=function(a){$("#hidden_div").trigger("Ami.Dialogs.Timescale.AfterSetData",a)};Ami.Dialogs.Timescale.prototype.onShowChange=function(){this.disableAllTiers(true)};Ami.Dialogs.Timescale.prototype.disableAllTiers=function(b){var a=$("#timescale_dlg_show").val();if(a==1){this.disableTier("top",true,b);this.disableTier("bottom",true,b)}else{if(a==2){this.disableTier("top",true,b);this.disableTier("bottom",false,b)}else{this.disableTier("top",false,b);this.disableTier("bottom",false,b)}}};Ami.Dialogs.Timescale.prototype.onTopTierUnitsChange=function(){if(!this.isCurrentUnitChangeValid("top")){$("#timescale_dlg_top_tier_units").val($("#timescale_dlg_middle_tier_units").val());Ami.Dialogs.MsgBox.show2($("#TierSizeMismatch").val(),"ok","warning",300,500)}this.updateLabelOptions("#timescale_dlg_top_tier_")};Ami.Dialogs.Timescale.prototype.onMiddleTierUnitsChange=function(){if(!this.isCurrentUnitChangeValid("middle")){$("#timescale_dlg_middle_tier_units").val($("#timescale_dlg_bottom_tier_units").val());Ami.Dialogs.MsgBox.show2($("#TierSizeMismatch").val(),"ok","warning",300,500)}this.updateLabelOptions("#timescale_dlg_middle_tier_")};Ami.Dialogs.Timescale.prototype.onBottomTierUnitsChange=function(){if(!this.isCurrentUnitChangeValid("bottom")){$("#timescale_dlg_bottom_tier_units").val($("#timescale_dlg_middle_tier_units").val());Ami.Dialogs.MsgBox.show2($("#TierSizeMismatch").val(),"ok","warning",300,500)}this.updateLabelOptions("#timescale_dlg_bottom_tier_")};Ami.Dialogs.Timescale.prototype.disableTier=function(d,b,a){var c="#timescale_dlg_"+d+"_tier_";if(b){this.saveUnitAndLabel(c);$(c+"units option[value=no]").show();$(c+"units").val("no").attr("disabled",true);$(c+"tab span").addClass("disabled_label");$(c+"label").attr("disabled",true);$(c+"use_fiscal_year").attr("disabled",true);$(c+"count").attr("disabled",true);$(c+"align").attr("disabled",true);$(c+"tick_lines").attr("disabled",true)}else{$(c+"units").removeAttr("disabled");$(c+"units option[value=no]").hide();$(c+"tab span").removeClass("disabled_label");$(c+"label").removeAttr("disabled");$(c+"use_fiscal_year").removeAttr("disabled");$(c+"count").removeAttr("disabled");$(c+"align").removeAttr("disabled");$(c+"tick_lines").removeAttr("disabled");if(a){this.restoreUnitAndLabel(c,d)}}};Ami.Dialogs.Timescale.prototype.saveUnitAndLabel=function(a){if($(a+"units").val()!=null&&$(a+"units").val()!="no"){$(a+"label").data("old",$(a+"label").val());$(a+"units").data("old",$(a+"units").val())}};Ami.Dialogs.Timescale.prototype.restoreUnitAndLabel=function(a,b){savedUnits=$(a+"units").data("old");if(savedUnits!=null){if(this.isUnitValid(b,savedUnits)){$(a+"units").val(savedUnits)}else{this.setDefaultUnits(a,b)}this.updateLabelOptions(a);$(a+"label").val($(a+"label").data("old"))}else{this.setDefaultUnits(a,b);this.updateLabelOptions(a);this.setDefaultLabel(a)}};Ami.Dialogs.Timescale.prototype.updateLabelOptions=function(a){$(a+"label").children().hide().filter("[value^="+$(a+"units").val()+"]").show();this.setDefaultLabel(a)};Ami.Dialogs.Timescale.prototype.setDefaultUnits=function(c,e){var a=this.unit2Number($("#timescale_dlg_middle_tier_units").val());var b=a;if(e=="top"){if(a<8){b++}}else{if(a>0){b--}}var d=this.number2Units(b);$(c+"units").val(d)};Ami.Dialogs.Timescale.prototype.setDefaultLabel=function(a){var b=$(a+"units").val();switch(b){case"yr":b+="0";break;case"hy":b+="123";break;case"qr":b+="2";break;case"mo":b+="9";break;case"tm":b+="137";break;case"wk":b+="13";break;case"dy":b+="20";break;case"hr":b+="30";break;case"mi":b+="33";break;default:b+="35"}$(a+"label").val(b)};Ami.Dialogs.Timescale.prototype.copyDropBoxes=function(){$("#timescale_dlg_middle_tier_label").html($("#timescale_dlg_top_tier_label").html());$("#timescale_dlg_bottom_tier_label").html($("#timescale_dlg_top_tier_label").html())};Ami.Dialogs.Timescale.prototype.isCurrentUnitChangeValid=function(d){var a="#timescale_dlg_",c="_tier_units";return this.isUnitValid(d,$(a+d+c).val())};Ami.Dialogs.Timescale.prototype.isUnitValid=function(a,c){var f,g,d="#timescale_dlg_",h="_tier_units";if(a=="middle"){f="top";g="bottom"}else{if(a=="top"){f="none";g="middle"}else{f="middle";g="none"}}if((this.isTierEnabled(f)&&this.isUnitsAlessB($(d+f+h).val(),$(d+a+h).val()))||(this.isTierEnabled(g)&&this.isUnitsAlessB($(d+a+h).val(),$(d+g+h).val()))){return false}return true};Ami.Dialogs.Timescale.prototype.isTierEnabled=function(a){return(a!="none")&&!$("#timescale_dlg_"+a+"_tier_tab span:first").hasClass("disabled_label")};Ami.Dialogs.Timescale.prototype.isUnitsAlessB=function(a,b){return this.unit2Number(a)<this.unit2Number(b)};Ami.Dialogs.Timescale.prototype.unit2Number=function(a){switch(a){case"yr":return 8;case"hy":return 7;case"qr":return 6;case"mo":return 5;case"tm":return 4;case"wk":return 3;case"dy":return 2;case"hr":return 1;case"mi":return 0;default:return -1}};Ami.Dialogs.Timescale.prototype.number2Units=function(a){switch(a){case 8:return"yr";case 7:return"hy";case 6:return"qr";case 5:return"mo";case 4:return"tm";case 3:return"wk";case 2:return"dy";case 1:return"hr";case 0:return"mi";default:return"no"}};Ami.Dialogs.Share=function(){Ami.Dialogs.call(this)};Ami.Dialogs.Share.prototype=new Ami.Dialogs;Ami.Dialogs.Share.prototype.dialogID="#share_dlg";Ami.Dialogs.Share.prototype.onOkClicked=function(){$(this).dialog("close")};Ami.Dialogs.Share.prototype.init=function(){Ami.Dialogs.prototype.init.apply(Ami.Dialogs.Share.prototype);$("#UploadingImg2").after($("#FileUpload2"));Ami.Dialogs.Share.prototype.setEvents()};Ami.Dialogs.Share.prototype.setEvents=function(){$("#share_dlg_delete").bind("click",function(a){Ami.Utils.runCommand("ShareDelete");$("#share_dlg").dialog("close")});$("#share_dlg_change_code").bind("click",function(a){Ami.Utils.runCommand2("ShareChangeCode",Ami.Dialogs.Share.prototype.onShareChangeCodeSuccess)});$("#share_dlg_change_file").bind("click",function(a){$("#FileUpload2").show();$("#share_dlg_submit").show()});$("#share_dlg_submit").bind("click",function(a){Ami.Dialogs.Share.prototype.showUploadIndicator2()})};Ami.Dialogs.Share.prototype.initControls=function(a){var b=a.projectFileCode;Ami.Dialogs.Share.prototype.setCode(b);if(Ami.Utils.isUserRegistered()){$(".share_dlg_free").hide();$(".share_dlg_premium").show();if(Ami.Utils.isUserOwner()){$(".share_dlg_owner").show()}else{$(".share_dlg_owner").hide()}}else{$(".share_dlg_free").show();$(".share_dlg_premium").hide();$(".share_dlg_owner").hide()}$("#FileUpload2").hide();$("#share_dlg_submit").hide();$("#UploadingImg2").hide()};Ami.Dialogs.Share.prototype.setCode=function(a){$("#share_dlg_link").val("http://"+window.location.hostname+"/open/"+a);$("#share_dlg_email_link").attr("href","mailto:?subject=You%20have%20received%20AmiProject%20link!&body=http://"+window.location.hostname+"/open/"+a)};Ami.Dialogs.Share.prototype.onShareChangeCodeSuccess=function(msg){var r=eval("("+msg+")");if(r.projectFileCode!=null){Ami.Dialogs.Share.prototype.setCode(r.projectFileCode)}};Ami.Dialogs.Share.prototype.showUploadIndicator2=function(){$("#FileUpload2").hide();$("#UploadingImg2").show();$("#share_dlg_submit").html("Uploading... Please wait");$("#share_dlg_submit").unbind("click");$("#IsOwner").after($("#FileUpload2"));__doPostBack("","")};Ami.Dialogs.MsgBox={};Ami.Dialogs.MsgBox.init=function(){$("#msgbox").dialog({resizable:false,height:200,width:350,modal:true,position:"center",buttons:{Ok:Ami.Dialogs.MsgBox.close},autoOpen:false});$(".ui-dialog").keydown(function(a){if((a.keyCode==13||a.keyCode==27)&&$(".cellError").length==1){Ami.Dialogs.MsgBox.close();return false}})};Ami.Dialogs.MsgBox.show=function(){$("#msgbox").dialog("option","buttons",{Ok:function(){Ami.Dialogs.MsgBox.close()}}).dialog("open")};Ami.Dialogs.MsgBox.showYN=function(){$("#msgbox").dialog("option","buttons",{No:function(){Ami.Dialogs.MsgBox.close()},Yes:function(){Ami.Dialogs.MsgBox.close()}}).dialog("open")};Ami.Dialogs.MsgBox.show2=function(c,e,a,b,d){$("#msgbox_message")[0].innerHTML=c;switch(e){case"yn":var e={No:function(){Ami.Dialogs.MsgBox.close();Ami.Dialogs.MsgBox.close()},Yes:function(){Ami.Dialogs.MsgBox.close()}};break;case"ok":default:var e={Ok:function(){Ami.Dialogs.MsgBox.close()}}}$("#msgbox_icon").attr("class","msgbox-icon-"+a);if(typeof b!="undefined"){$("#msgbox").dialog("option","height",b).dialog("open")}if(typeof d!="undefined"){$("#msgbox").dialog("option","width",d).dialog("open")}$("#msgbox").dialog("option","buttons",e).dialog("open")};Ami.Dialogs.MsgBox.showCellError=function(a){$("#msgbox").addClass("cellError");$("#msgbox_message")[0].innerHTML=a;$("#msgbox_icon").attr("class","msgbox-icon-error");$("#msgbox").dialog("option","buttons",{Ok:Ami.Dialogs.MsgBox.close}).dialog("open")};Ami.Dialogs.MsgBox.close=function(){$("#msgbox").dialog("close");if($(".cellError").length==1){$("#SelectedCellText").focus();$("#msgbox").removeClass("cellError")}};Ami.Dialogs.FieldSettings=function(){Ami.Dialogs.call(this)};Ami.Dialogs.FieldSettings.prototype=new Ami.Dialogs;Ami.Dialogs.FieldSettings.prototype.dialogID="#field_settings_dlg";Ami.Dialogs.FieldSettings.prototype.setValidationRules=function(){Ami.Validation.set(this.dialogID,{field_settings_dlg_width:{required:true,range:[1,128]}})};Ami.Dialogs.FieldSettings.prototype.initControls=function(a,b){$("#field_settings_dlg_cmd").val(b.command);$("#field_settings_dlg_column_position").val(b.columnPosition);$("#field_settings_dlg_column_id").val(b.columnID);if(b.command=="insert"){$("#field_settings_dlg_field_name").val("23");$("#field_settings_dlg_title").val("");$("#field_settings_dlg_align_title").val("1");$("#field_settings_dlg_align_data").val("2");$("#field_settings_dlg_width").val("10");$("#field_settings_dlg_htwrapping").attr("checked",true)}else{$("#field_settings_dlg_field_name").val(b.columnID);Ami.Dialogs.FieldSettings.prototype.getParams(b);$("#field_settings_dlg_title").val(b.title);$("#field_settings_dlg_align_title").val(b.alignTitle);$("#field_settings_dlg_align_data").val(b.alignData);$("#field_settings_dlg_width").val(b.width);$("#field_settings_dlg_htwrapping").attr("checked",b.headerTextWrapping=="True")}};Ami.Dialogs.FieldSettings.prototype.getParams=function(b){var d=$(".left_header_col:eq("+(b.columnPosition-2)+")");var a=$.trim($(d)[0].innerHTML);b.title=a!=$("#field_settings_dlg_field_name option:selected").text()?a:"";b.alignTitle=Ami.Utils.getAlignValue($(d).attr("align"));var c=$("#grid_table col:eq("+(b.columnPosition-2)+")");b.alignData=Ami.Utils.getAlignValue($(c).attr("align"));b.width=Math.round(parseInt($(c).attr("width"))/6);b.headerTextWrapping=false};Ami.Dialogs.FieldSettings.prototype.init=function(){Ami.Dialogs.prototype.init.apply(Ami.Dialogs.FieldSettings.prototype);$(this.dialogID).dialog({resizable:false,height:250,width:350})};Ami.Dialogs.FieldSettings.prototype.onOkClicked=function(){if(!Ami.Validation.check(Ami.Dialogs.FieldSettings.prototype.dialogID)){return}var a={cmd:$("#field_settings_dlg_cmd").val(),position:$("#field_settings_dlg_column_position").val(),fieldID:$("#field_settings_dlg_field_name").val(),title:$("#field_settings_dlg_title").val(),alignTitle:$("#field_settings_dlg_align_title").val(),alignData:$("#field_settings_dlg_align_data").val(),width:$("#field_settings_dlg_width").val(),headerTextWrapping:$("#field_settings_dlg_htwrapping").attr("checked")};$("#field_settings_dlg").dialog("close");Ami.Utils.runCommand3("FieldSettings_SetData",Ami.Dialogs.FieldSettings.AfterSetData,a)};Ami.Dialogs.FieldSettings.AfterSetData=function(a){$("#hidden_div").trigger("Ami.Dialogs.FieldSettings.AfterSetData",a)};Ami.Dialogs.FieldSettings.prototype.showCommand=function(a){Ami.Dialogs.prototype.showCommand.apply(Ami.Dialogs.FieldSettings.prototype,[a])};$(function(){window.printSettings={pageSize:5,orientation:1,scale:100}});PrintProject=function(){window.location="../print.aspx?ProjectFileID="+$("#ProjectID").val()+"&PageSize="+window.printSettings.pageSize+"&Orientation="+window.printSettings.orientation+"&Scale="+window.printSettings.scale};Ami.Dialogs.PrintSettings=function(){Ami.Dialogs.call(this)};Ami.Dialogs.PrintSettings.prototype=new Ami.Dialogs;Ami.Dialogs.PrintSettings.prototype.dialogID="#print_settings_dlg";Ami.Dialogs.PrintSettings.prototype.setValidationRules=function(){Ami.Validation.set(this.dialogID,{print_settings_dlg_page_scale:{required:true,range:[10,500]}})};Ami.Dialogs.PrintSettings.prototype.initControls=function(a,b){$("#print_settings_dlg_page_size").val(window.printSettings.pageSize);$("#print_settings_dlg_page_scale").val(window.printSettings.scale)};Ami.Dialogs.PrintSettings.prototype.init=function(){Ami.Dialogs.prototype.init.apply(Ami.Dialogs.PrintSettings.prototype);$(this.dialogID).dialog({resizable:false,height:250,width:350});$("#print_settings_dlg_page_scale").css("text-align","right");$("#print_settings_dlg td").css("padding","5px")};Ami.Dialogs.PrintSettings.prototype.onOkClicked=function(){if(!Ami.Validation.check(Ami.Dialogs.PrintSettings.prototype.dialogID)){return}window.printSettings={pageSize:$("#print_settings_dlg_page_size").val(),orientation:$("[name=print_settings_dlg_page_orientation]:checked").val(),scale:$("#print_settings_dlg_page_scale").val()};$("#print_settings_dlg").dialog("close");PrintProject()};Ami.Dialogs.PrintSettings.AfterSetData=function(a){$("#hidden_div").trigger("Ami.Dialogs.PrintSettings.AfterSetData",a)};Ami.Dialogs.PrintSettings.prototype.showCommand=function(a){Ami.Dialogs.prototype.showCommand.apply(Ami.Dialogs.PrintSettings.prototype,[a])};$(function(){Ami.DurationUnitsPlural=$("#duration_format_plural").val().split(",");Ami.DurationUnitsSingular=$("#duration_format").val().split(",");Ami.DurationUnitsIndex=[3,4,5,6,7,8,9,10,11,12,19,20,21,35,36,37,38,39,40,41,42,43,44,51,52,53]});Ami.Duration=function(b,a){this.units=new Ami.DurationUnits(a);this.value=b;this.toString2=function(){if(this.value<0){this.value=0}return this.value.toString()+" "+this.units.toString2(this.value==1)};this.isEstimated=function(){return this.units.toString2(true).indexOf("?")!=-1}};Ami.DurationUnits=function(a){this.value=a;this.getIndex=function(){for(var b=0;b<Ami.DurationUnitsIndex.length;b++){if(Ami.DurationUnitsIndex[b]==this.value){return b}}return -1};this.toString2=function(b){var c=this.getIndex();if(b){return Ami.DurationUnitsSingular[c]}else{return Ami.DurationUnitsPlural[c]}}};Ami.Duration.parse=function(b){if(b.search(/\d+\s*\w*\s*/)==-1){return null}var a=parseInt(b.match(/\d+/)[0]);var c="";b+=" ";switch((b.match(/\D+/)[0]).replace(/^\s*/,"").replace(/\s*$/,"")){case"":case"days":case"day":case"d.":case"d":c=7;break;case"week":case"weeks":case"wk":case"wk.":case"w":case"w.":c=9;break;case"month":case"months":case"mon.":case"mon":case"mo":case"mo.":c=11;break;case"hour":case"hours":case"hr.":case"hr":case"h.":case"h":c=5;break;case"minute":case"minutes":case"min.":case"min":case"mi.":case"mi":case"m.":case"m":c=3;break;case"edays":case"eday":case"ed.":case"ed":c=8;break;case"eweek":case"eweeks":case"ewk":case"ewk.":case"ew":case"ew.":c=10;break;case"emonth":case"emonths":case"emon.":case"emon":case"emo":case"emo.":c=12;break;case"ehour":case"ehours":case"ehr.":case"ehr":case"eh.":case"eh":c=6;break;case"eminute":case"eminutes":case"emin.":case"emin":case"emi.":case"emi":case"em.":case"em":c=4;break;case"days?":case"day?":case"d.?":case"d?":c=39;break;case"week?":case"weeks?":case"wk?":case"wk.?":case"w?":case"w.?":c=41;break;case"month?":case"months?":case"mon.?":case"mon?":case"mo?":case"mo.?":c=43;break;case"hour?":case"hours?":case"hr.?":case"hr?":case"h.?":case"h?":c=37;break;case"minute?":case"minutes?":case"min.?":case"min?":case"mi.?":case"mi?":case"m.?":case"m?":c=35;break;default:c=7}return new Ami.Duration(a,c)};Ami.Flag=function(){};$(function(){Ami.Flag.Label=$("#flag_format").val().split(",")});Ami.Flag.parse=function(a){if(Ami.Flag.Label[0].toLowerCase().indexOf(a.toLowerCase())==0){return true}if(Ami.Flag.Label[1].toLowerCase().indexOf(a.toLowerCase())==0){return false}return null};Ami.Currency=function(){};$(function(){Ami.Currency.Symbol=$("#currency_symbol").val();Ami.Currency.GroupSeparator=$("#currency_group_separator").val();Ami.Currency.DecimalSeparator=$("#currency_decimal_separator").val();Ami.Currency.SymbolPlacement=parseInt($("#currency_symbol_placement").val());Ami.Currency.DecimalDigits=parseInt($("#currency_decimal_separator").val())});Ami.Currency.parse=function(a){a=a.replace(Ami.Currency.Symbol,"");a=a.replace(Ami.Currency.GroupSeparator,"");a=a.replace(Ami.Currency.DecimalSeparator,".");var b=parseFloat(a);return isNaN(b)?null:b};Ami.Currency.toString2=function(a){var b=a<0;a=Math.abs(a.toFixed(Ami.Currency.DecimalDigits));var c=String(a);c=c.replace(".",Ami.Currency.DecimalSeparator);c=Ami.Currency.addGroupSeparator(c);c=Ami.Currency.addSymbol(c);if(b){c="-"+c}return c};Ami.Currency.addSymbol=function(a){switch(Ami.Currency.SymbolPlacement){case 1:a+=Ami.Currency.Symbol;break;case 2:a=Ami.Currency.Symbol+" "+a;break;case 3:a+=" "+Ami.Currency.Symbol;break;case 0:default:a=Ami.Currency.Symbol+a;break}return a};Ami.Currency.addGroupSeparator=function(a){a+="";x=a.split(Ami.Currency.DecimalSeparator);x1=x[0];x2=x.length>1?Ami.Currency.DecimalSeparator+x[1]:"";var b=/(\d+)(\d{3})/;while(b.test(x1)){x1=x1.replace(b,"$1"+Ami.Currency.GroupSeparator+"$2")}return x1+x2};Ami.RelationType={};$(function(){Ami.RelationType.Strings=$("#relation_type").val().split(",");Ami.RelationType.Values=[1,2,1,0,-1]});Ami.RelationType.toString2=function(b){for(var a=0;a<Ami.RelationType.Values.length;a++){if(Ami.RelationType.Values[a]==b){return Ami.RelationType.Strings[a]}}return""};Ami.Grid={};Ami.Grid.RangeSelect={};Ami.Grid.RowSelect={};Ami.Grid.init=function(){Ami.Grid.setEvents();$("#SelectedCell").appendTo($("#left"));$("#CheckBoxComboboxList").appendTo($("#left"));$("#FlagComboboxList").appendTo($("#left"));$(".left_header_col_resizer").draggable({axis:"x"});$(".left_header_col_resizer:last").width(1);Ami.Grid.setCollapsedData();var a=document.getElementById("grid_table");if(a.onselectstart!="undefined"){a.onselectstart=function(){return false}}if(typeof a.style.MozUserSelect!="undefined"){a.style.MozUserSelect="none"}};Ami.Grid.setEvents=function(){$("#grid_table").unbind("click");$("#grid_table").unbind("dblclick");$(window).unbind("keydown");$("#grid_table").bind("mousedown",function(a){Ami.Grid.onCellClick(a)});$("#grid_table").bind("dblclick",function(a){Ami.Grid.onCellDblClick(a)});$("#grid_table td").bind("mousedown",function(a){Ami.Grid.onMouseDown(a)});$("#grid_table td").bind("mouseup",function(a){Ami.Grid.onMouseUp(a)});$("#grid_table td").bind("mouseenter",function(a){Ami.Grid.onMouseEnter(a)});$("#grid_table tr").bind("mouseenter",function(a){Ami.Grid.onMouseEnterRow(a)});$("#SelectedCell").unbind("mouseup");$("#SelectedCell").bind("mouseup",function(a){Ami.Grid.onMouseUp(a)});$("#SelectedCell").unbind("dblclick");$("#SelectedCell").bind("dblclick",function(a){b=new Ami.Dialogs.TaskInfo;b.showCommand({event:a,tabIndex:-1})});$(window).keydown(Ami.Grid.globalKeyDown);$(window).keydown(Ami.Grid.globalKeyPress);$("#SelectedCellText").datepicker({onClose:function(c,a){Ami.Grid.SelectedCell.finishEdit("stay")}});$(".left_header_col_resizer").bind("dragstop",function(c,a){Ami.Grid.columnDragStop(c,a)});$(".expander").bind("click",function(a){Ami.Grid.toggleSubtaskVisibility(a.target);return false});$("#grid_table").mousewheel(function(c,a){MouseWheelScroll(c,a)});$("#SelectedCell").mousewheel(function(c,a){MouseWheelScroll(c,a)});$("#SelectedCellExp").unbind("click");$("#SelectedCellExpRes").unbind("click");$("#SelectedCellExpFlag").unbind("click");$("#SelectedCellUp").unbind("click");$("#SelectedCellDown").unbind("click");$("#SelectedCellUp").unbind("dblclick");$("#SelectedCellDown").unbind("dblclick");$("#SelectedCellExp").bind("click",function(a){Ami.Grid.SelectedCell.onExpClick(a)});$("#SelectedCellExpRes").bind("click",function(a){Ami.Grid.SelectedCell.onExpResClick(a)});$("#SelectedCellExpFlag").bind("click",function(a){Ami.Grid.SelectedCell.onExpFlagClick(a)});$("#SelectedCellUp").bind("click",function(a){Ami.Grid.SelectedCell.onUpClick(a)});$("#SelectedCellDown").bind("click",function(a){Ami.Grid.SelectedCell.onDownClick(a)});$("#SelectedCellUp").bind("dblclick",function(a){Ami.Grid.SelectedCell.onUpDownDblClick(a)});$("#SelectedCellDown").bind("dblclick",function(a){Ami.Grid.SelectedCell.onUpDownDblClick(a)});$("#row_selector div").bind("mousedown",function(a){return Ami.Grid.RowSelect.onMouseDown(a)});$(".rsi").bind("mouseup",function(a){return Ami.Grid.RowSelect.onMouseUp(a)});$(".rsi").bind("mouseenter",function(a){return Ami.Grid.RowSelect.onMouseEnter(a)});$(".rsr").bind("mouseup",function(a){return Ami.Grid.RowSelect.onMouseUp(a)});$("#row_selector div").add("#SelectedCell").add("#grid_table td").contextMenu("ContextMenuGrid",{bindings:{ContextMenuGridInsertTask:function(a){Ami.Grid.insertTasksClick(a)},ContextMenuGridDeleteTask:function(a){Ami.Grid.deleteTasksClick(a)}},shadow:false});$(".left_header_col").contextMenu("ContextMenuGridColumn",{bindings:{ContextMenuGridColumnInsert:function(a){Ami.Grid.columnInsertClick(a)},ContextMenuGridColumnHide:function(a){Ami.Grid.columnHideClick(a)},ContextMenuGridColumnSettings:function(a){Ami.Grid.columnSettingsClick(a)}},shadow:false});$("#FlagComboboxList li").hover(function(){$(this).css("background-color","#b6bdd2").css("border","1px solid #0a246a")},function(){$(this).css("background-color","transparent").css("border-style","none")}).unbind("click").click(Ami.Grid.SelectedCell.onFlagListValueClick)};Ami.Grid.globalKeyDown=function(a){if(($("input:focus").length==0||$("#SelectedCellText:focus").length==1)&&$(".ui-dialog:visible").length==0){return Ami.Grid.SelectedCell.onKeyDown(a)}};Ami.Grid.globalKeyPress=function(a){if(($("input:focus").length==0||$("#SelectedCellText:focus").length==1)&&$(".ui-dialog:visible").length==0){Ami.Grid.SelectedCell.onKeyPress(a)}};Ami.Grid.onCellClick=function(a){Ami.Grid.SelectedCell.setByClick(a)};Ami.Grid.onCellDblClick=function(c){var d=($(c.target).parents().filter("tr").attr("id")).substring(2);if(d!=""){var a=new Ami.Dialogs.TaskInfo;a.showCommand({event:c,tabIndex:-1})}};Ami.Grid.selectFristCell=function(){if($("#tr0").is(":visible")){$("#grid_table td:first").next().addClass("grid_table_td_selected")}else{$("#tr1 td:first").next().addClass("grid_table_td_selected")}Ami.Grid.SelectedCell.show()};Ami.Grid.toggleSubtaskVisibility=function(a){var c=".p"+$(a).parents("tr").attr("id");var d;if($(a).attr("src")=="/apImg/grid/expanded.png"){Ami.Grid.hideSubTasks(c);d=false}else{Ami.Grid.showSubTasks(c);d=true}UpdateVScrollHeight();Ami.Grid.SelectedCell.show();Ami.Grid.NotifyExpandCollapse(c,d)};Ami.Grid.NotifyExpandCollapse=function(c,d){if(!Ami.IsReadOnly()){var a={Row:parseInt(c.substring(4)),Expand:d};Ami.Grid.SelectedCell.pendingCommand="stay";Ami.Utils.runCommand3("ExpandCollapseTask",function(){},a)}};Ami.Grid.showSubTasks=function(a){if($("#"+a.substring(2)+" .expander").attr("src")=="/apImg/grid/expanded.png"){return}$("#"+a.substring(2)+" .expander").attr("src","/apImg/grid/expanded.png");$(a).each(function(c){$(this).data("collapsed",$(this).data("collapsed")-1)}).filter(function(){return $(this).data("collapsed")==0}).show()};Ami.Grid.hideSubTasks=function(a){if($("#"+a.substring(2)+" .expander").attr("src")=="/apImg/grid/collapsed.png"){return}$("#"+a.substring(2)+" .expander").attr("src","/apImg/grid/collapsed.png");$(a).hide().each(function(c){$(this).data("collapsed",$(this).data("collapsed")+1)})};Ami.Grid.showSubTasksClick=function(){Ami.Grid.showSubTasks(".ptr"+Ami.Grid.getSelTaskID());return false};Ami.Grid.hideSubTasksClick=function(){Ami.Grid.hideSubTasks(".ptr"+Ami.Grid.getSelTaskID());return false};Ami.Grid.getSelTaskID=function(){var a=($(".grid_table_td_selected").parents().filter("tr").attr("id")).substring(2);return a};Ami.Grid.update=function(a){$("#SelectedCell").hide();$("#SelectedCell").appendTo($("#hidden_div"));$("#CheckBoxComboboxList").appendTo($("#hidden_div"));$("#FlagComboboxList").appendTo($("#hidden_div"));var c=$("#left").width();$("#grid_selector").remove();$("#left_header").remove();$("#left").remove();$("#row_selector").remove();$(a).insertAfter("#vscroll");$("#row_selector").height($(window).height()-132-40);$("#left").width(c);$("#left_header").width(c);Ami.Grid.init();Ami.LeftPanel.HScroll.onScroll();Ami.Grid.applyClassesToGanttChart();Ami.Grid.SelectedCell.processPendingCommand()};Ami.Grid.applyClassesToGanttChart=function(){$("#grid_table tr").each(function(){var a=$(this).attr("id").substring(2);$("#gr"+a).attr("class",$(this).attr("class"))})};Ami.Grid.columnDragStop=function(a,e){var h=$(e.helper).prev().width();var g=parseInt($(e.helper).css("left"))-parseInt($(e.helper).prev().css("left"));if(g<0){g=0;$(e.helper).css("left",parseInt($(e.helper).prev().css("left"),0))}$(e.helper).prev().width(g);var f=$(e.helper).prev().width()-h;var c=$(e.helper).prevAll().length/2-1;$(e.helper).nextAll().each(function(){$(this).css("left",parseInt($(this).css("left"),0)+f)});$("#grid_table").css("width",parseInt($("#grid_table").css("width"),0)+f);$("#left_scroll_nested").width($("#grid_table").width()+33);var d=$("#grid_table col:eq("+c+")");d.attr("width",parseInt(d.attr("width"),0)+f);Ami.Grid.SelectedCell.show();Ami.Utils.runCommand3("GanttChartViewColumnResize",function(){},{ColumnIndex:c,Width:g})};Ami.Grid.rowsPerPage=function(){return Math.floor($("#left").height()/20)};function RowsCount(){return $("#grid_table tr").length}Ami.Grid.setCollapsedData=function(){$(".grid_table tr").data("collapsed",0);$(".rsi").data("collapsed",0);$(".rsr").data("collapsed",0);$(".gantt_rendering div").data("collapsed",0);var c=eval("("+$("#grid_table_collapses").val()+")");for(var j=0;j<c.c.length;j++){$("#tr"+c.c[j].i).data("collapsed",c.c[j].c);$("#rsi"+c.c[j].i).data("collapsed",c.c[j].c);$("#rsr"+c.c[j].i).data("collapsed",c.c[j].c);$("#gr"+c.c[j].i).data("collapsed",c.c[j].c)}};Ami.Grid.indentTasksClick=function(a){if(!Ami.IsReadOnly()){var c=Ami.Grid.getSelTaskID();if(c==null){return}var d={Rows:Ami.Grid.RangeSelect.Rows};Ami.Utils.runCommand3("IndentTasks",Ami.Grid.SelectedCell.onAfterSendChangeRequest,d)}};Ami.Grid.outdentTasksClick=function(a){if(!Ami.IsReadOnly()){var c=Ami.Grid.getSelTaskID();if(c==null){return}var d={Rows:Ami.Grid.RangeSelect.Rows};Ami.Utils.runCommand3("OutdentTasks",Ami.Grid.SelectedCell.onAfterSendChangeRequest,d)}};Ami.Grid.onMouseDown=function(d){if(d.button==2&&($(d.target).parents().add(d.target).hasClass("grid_row_selected")||$(d.target).parents().add(d.target).hasClass("grid_table_td_range_selected"))){return true}if(!d.ctrlKey){Ami.Grid.cancelSelection()}else{var c=$(".grid_table_td_selected").parents().filter("tr");var a=parseInt((c).attr("id").substring(2));Ami.Grid.RangeSelect.addRow(a);$(".grid_table_td_selected").addClass("grid_table_td_range_selected")}Ami.Grid.RangeSelect.started=true;var e=$(d.target).parents().add(d.target);Ami.Grid.RangeSelect.FirstCellRow=$("#grid_table tr").index($(e).filter("tr"));Ami.Grid.RangeSelect.FirstCellColumn=$(e).filter("tr").children().index($(e).filter("td"));Ami.Grid.RangeSelect.addRow(Ami.Grid.RangeSelect.FirstCellRow);return false};Ami.Grid.onMouseUp=function(a){$(".grid_table_td_range_selected_tmp").addClass("grid_table_td_range_selected");$(".grid_table_td_range_selected_tmp").removeClass("grid_table_td_range_selected_tmp");Ami.Grid.RangeSelect.started=false;Ami.Grid.RowSelect.started=false};Ami.Grid.onMouseEnter=function(a){if(Ami.Grid.RangeSelect.started){var c=$(a.target).parents().add(a.target);Ami.Grid.RangeSelect.LastCellRow=$("#grid_table tr").index($(c).filter("tr"));Ami.Grid.RangeSelect.LastCellColumn=$(c).filter("tr").children().index($(c).filter("td"));Ami.Grid.RangeSelect.setSelection();Ami.Grid.scroll(a.target)}if(Ami.Grid.RowSelect.started){Ami.Grid.scroll(a.target)}};Ami.Grid.onMouseEnterRow=function(d){if(Ami.Grid.RangeSelect.started){Ami.Grid.RangeSelect.addRow(Ami.Grid.RangeSelect.FirstCellRow);var c=$(d.target).parents().add(d.target).filter("tr");var a=parseInt((c).attr("id").substring(2));Ami.Grid.RangeSelect.addRow(a)}if(Ami.Grid.RowSelect.started){var c=$(d.target).parents().add(d.target).filter("tr");var a=parseInt((c).attr("id").substring(2));Ami.Grid.RowSelect.select(a)}};Ami.Grid.RangeSelect.addRow=function(a){if(typeof Ami.Grid.RangeSelect.Rows=="undefined"){Ami.Grid.RangeSelect.Rows=[]}for(var c=0;c<Ami.Grid.RangeSelect.Rows.length;c++){if(Ami.Grid.RangeSelect.Rows[c]==a){return}}Ami.Grid.RangeSelect.Rows[Ami.Grid.RangeSelect.Rows.length]=a};Ami.Grid.RangeSelect.setSelection=function(){var g=0,d=0,e=0,a=0;if(Ami.Grid.RangeSelect.LastCellColumn>Ami.Grid.RangeSelect.FirstCellColumn){g=Ami.Grid.RangeSelect.FirstCellColumn-1;d=Ami.Grid.RangeSelect.LastCellColumn}else{g=Ami.Grid.RangeSelect.LastCellColumn-1;d=Ami.Grid.RangeSelect.FirstCellColumn}if(Ami.Grid.RangeSelect.LastCellRow>Ami.Grid.RangeSelect.FirstCellRow){e=Ami.Grid.RangeSelect.FirstCellRow-1;a=Ami.Grid.RangeSelect.LastCellRow}else{e=Ami.Grid.RangeSelect.LastCellRow-1;a=Ami.Grid.RangeSelect.FirstCellRow}$(".grid_table_td_range_selected_tmp").removeClass("grid_table_td_range_selected_tmp");var c="",f="";if(e>=0){c="#grid_table tr:gt("+e+"):lt("+(a-e)+")"}else{c="#grid_table tr:lt("+(a-e)+")"}if(g>=0){f="td:gt("+g+"):lt("+(d-g)+")"}else{f="td:lt("+(d-g)+")"}$(c).each(function(){$(this).children().filter(f).addClass("grid_table_td_range_selected_tmp")})};Ami.Grid.scroll=function(a){var d=$(a).parents().add(a).filter("td");var c=$(d).width()+parseInt($(d).css("padding-left"));var e=$(d).offset().left+c-$("#sep").position().left;if(e>-20){Ami.LeftPanel.HScroll.scrollDelta(e+20)}e=$("#left").position().left-$(d).offset().left+2;if(e>-20){Ami.LeftPanel.HScroll.scrollDelta(-e-20)}e=$(d).offset().top-$("#left_scroll").position().top+20;if(e>-20){scrollVerticalDelta(20)}e=$("#left").position().top-$(d).offset().top+2;if(e>-20){scrollVerticalDelta(-20)}};Ami.Grid.linkTasksTasksClick=function(){if(!Ami.IsReadOnly()){if(Ami.Grid.RangeSelect.Rows.length<2){return}var a={Rows:Ami.Grid.RangeSelect.Rows};Ami.Utils.runCommand3("LinkTasks",Ami.Grid.SelectedCell.onAfterSendChangeRequest,a)}};Ami.Grid.unlinkTasksTasksClick=function(){if(!Ami.IsReadOnly()){if(Ami.Grid.RangeSelect.Rows.length<2){return}var a={Rows:Ami.Grid.RangeSelect.Rows};Ami.Utils.runCommand3("UnlinkTasks",Ami.Grid.SelectedCell.onAfterSendChangeRequest,a)}};Ami.Grid.RowSelect.onMouseDown=function(c){if(c.button==2&&$(c.target).parents().add(c.target).hasClass("grid_row_selected")){return true}Ami.Grid.cancelSelection();var a=parseInt($(c.target).attr("id").substring(3));Ami.Grid.RowSelect.FirstRow=a;Ami.Grid.RowSelect.select(a);Ami.Grid.RowSelect.started=true;return false};Ami.Grid.RowSelect.select=function(a){var d=Ami.Grid.RowSelect.FirstRow;var e=a;if(e<d){d=a;e=Ami.Grid.RowSelect.FirstRow}Ami.Grid.RowSelect.cancelSelection();for(var c=d;c<=e;c++){$("#rsi"+c).addClass("grid_row_selected");$("#tr"+c).addClass("grid_row_selected");$("#rsr"+(c-1)).addClass("rsr_selected").removeClass("rsr")}};Ami.Grid.RowSelect.onMouseUp=function(a){Ami.Grid.RowSelect.started=false;return false};Ami.Grid.RowSelect.onMouseEnter=function(c){if(Ami.Grid.RowSelect.started){var a=$(c.target).attr("id").substring(3);Ami.Grid.RowSelect.select(a);Ami.Grid.scroll($("#tr"+a+" td"));return false}};Ami.Grid.RowSelect.cancelSelection=function(){if($(".grid_row_selected").length>0){$(".grid_row_selected").removeClass("grid_row_selected");$(".rsr_selected").removeClass("rsr_selected").addClass("rsr")}};Ami.Grid.RangeSelect.cancelSelection=function(){Ami.Grid.RangeSelect.Rows=[];Ami.Grid.RangeSelect.started=false;$(".grid_table_td_range_selected").removeClass("grid_table_td_range_selected")};Ami.Grid.cancelSelection=function(){Ami.Grid.RangeSelect.cancelSelection();Ami.Grid.RowSelect.cancelSelection()};Ami.Grid.insertTasksClick=function(c){if(!Ami.IsReadOnly()){var a={Rows:Ami.Grid.getSelectedRows()};Ami.Grid.SelectedCell.pendingCommand="stay";Ami.Utils.runCommand3("InsertTasks",Ami.Grid.SelectedCell.onAfterSendChangeRequest,a)}};Ami.Grid.deleteTasksClick=function(c){if(!Ami.IsReadOnly()){var a={Rows:Ami.Grid.getSelectedRows()};Ami.Grid.SelectedCell.pendingCommand="stay";Ami.Utils.runCommand3("DeleteTasks",Ami.Grid.SelectedCell.onAfterSendChangeRequest,a)}};Ami.Grid.getSelectedRows=function(){var a=[];$(".grid_row_selected").filter("tr").each(function(c){a[a.length]=parseInt($(this).attr("id").substring(2))});return a.length>0?a:Ami.Grid.RangeSelect.Rows};Ami.Grid.columnInsertClick=function(a){Ami.Grid.columnCmdClick(a,"insert")};Ami.Grid.columnSettingsClick=function(a){Ami.Grid.columnCmdClick(a,"update")};Ami.Grid.columnCmdClick=function(a,c){if(!Ami.IsReadOnly()){var d={command:c,doNotLoad:true,columnPosition:Ami.Grid.getColumnPosition(a)};d.columnID=Ami.Grid.getColumnID(d.columnPosition);b=new Ami.Dialogs.FieldSettings;b.showCommand(d)}};Ami.Grid.columnHideClick=function(c){if(!Ami.IsReadOnly()){var a={columnPosition:Ami.Grid.getColumnPosition(c)};a.columnID=Ami.Grid.getColumnID(a.columnPosition);a.Columns=[];a.Columns[0]=a.columnID;Ami.Grid.SelectedCell.pendingCommand="stay";Ami.Utils.runCommand3("Grid_ColumnsHide",Ami.Grid.update,a)}};Ami.Grid.getColumnPosition=function(a){return 2+(($("#left_header div").index(a)-1)/2)};Ami.Grid.getColumnID=function(a){return jQuery.grep($("#grid_table col:eq("+(a-2)+")").attr("class").split(" "),function(c){return c[0]=="c"})[0].substring(1)};Ami.Grid.SelectedCell={};Ami.Grid.SelectedCell.onKeyDown=function(a){if(!a.ctrlKey){Ami.Grid.cancelSelection()}if($(".ui-datepicker-calendar").is(":visible")){return true}if(a.keyCode==13){if($("#SelectedCellText:visible").length==0){Ami.Grid.SelectedCell.startEdit()}else{Ami.Grid.SelectedCell.finishEdit("move",AmiConst.DOWN)}return false}if(a.keyCode==113){if($("#SelectedCellText:visible").length==0){Ami.Grid.SelectedCell.startEdit(1);return false}}if(a.keyCode==27){if($("#SelectedCellText:visible").length==1){Ami.Grid.SelectedCell.cancelEdit()}return false}if(a.shiftKey&&a.keyCode==9){Ami.Grid.SelectedCell.finishEdit("move",AmiConst.LEFT);return false}if(a.keyCode==37){if($("#SelectedCellText").is(":hidden")){Ami.Grid.SelectedCell.finishEdit("move",AmiConst.LEFT)}return false}if(a.keyCode==38){Ami.Grid.SelectedCell.finishEdit("move",AmiConst.UP);return false}if(a.keyCode==40){Ami.Grid.SelectedCell.finishEdit("move",AmiConst.DOWN);return false}if(a.keyCode==39){if($("#SelectedCellText").is(":hidden")){Ami.Grid.SelectedCell.finishEdit("move",AmiConst.RIGHT)}return false}if(a.keyCode==9){Ami.Grid.SelectedCell.finishEdit("move",AmiConst.RIGHT);return false}if(a.keyCode==34){Ami.Grid.SelectedCell.finishEdit("move",AmiConst.PGDOWN);return false}if(a.keyCode==33){Ami.Grid.SelectedCell.finishEdit("move",AmiConst.PGUP);return false}if(a.keyCode==36){Ami.Grid.SelectedCell.finishEdit("move",AmiConst.HOME);return false}if(a.keyCode==35){Ami.Grid.SelectedCell.finishEdit("move",AmiConst.END);return false}if(!a.ctrlKey&&$("#SelectedCellText:visible").length==0){Ami.Grid.SelectedCell.startEdit()}};Ami.Grid.SelectedCell.onKeyPress=function(a){};Ami.Grid.SelectedCell.setByDirection=function(a){var b=Ami.Grid.SelectedCell.getNextCell(a);if(b.length==0){return}Ami.Grid.SelectedCell.setByCell(b)};Ami.Grid.SelectedCell.isValid=function(){switch(Ami.Grid.SelectedCell.FieldType){case"tu":Ami.Grid.SelectedCell.AsDuration=Ami.Duration.parse($("#SelectedCellText").val());if(Ami.Grid.SelectedCell.AsDuration==null){return false}$("#SelectedCellText").val(Ami.Grid.SelectedCell.AsDuration.toString2());return true;case"td":Ami.Grid.SelectedCell.AsDate=$("#SelectedCellText").datepicker("getDate");return Ami.Grid.SelectedCell.AsDate!=null;case"tf":Ami.Grid.SelectedCell.AsFlag=Ami.Flag.parse($("#SelectedCellText").val());if(Ami.Grid.SelectedCell.AsFlag==null){return false}$("#SelectedCellText").val(Ami.Flag.Label[Ami.Grid.SelectedCell.AsFlag]);return true;case"tn":Ami.Grid.SelectedCell.AsNumber=parseFloat($("#SelectedCellText").val());if(isNaN(Ami.Grid.SelectedCell.AsNumber)){Ami.Grid.SelectedCell.AsNumber=null;return false}return Ami.Grid.SelectedCell.AsNumber!=null;case"tm":Ami.Grid.SelectedCell.AsCurrency=Ami.Currency.parse($("#SelectedCellText").val());if(Ami.Grid.SelectedCell.AsCurrency==null){return false}$("#SelectedCellText").val(Ami.Currency.toString2(Ami.Grid.SelectedCell.AsCurrency));return true;default:return true}};Ami.Grid.SelectedCell.isChanged=function(){return $("#SelectedCellText").val()!=Ami.Grid.SelectedCell.InitialText};Ami.Grid.SelectedCell.getNextCell=function(d){var e=null,b=Ami.Grid.SelectedCell.RowIndex,c=Ami.Grid.SelectedCell.ColumnIndex;switch(d){case AmiConst.UP:e=$("#tr"+Ami.Grid.SelectedCell.getVisibleRow(b,false,0)+" td:nth-child("+c+")");break;case AmiConst.DOWN:e=$("#tr"+Ami.Grid.SelectedCell.getVisibleRow(b,true,0)+" td:nth-child("+c+")");break;case AmiConst.RIGHT:e=$("#tr"+b+" td")[c];c++;if($(e).length==0){b=Ami.Grid.SelectedCell.getVisibleRow(b,true,0);e=$("#tr"+b+" td")[0];c=1}break;case AmiConst.LEFT:if(c>1){e=$(".grid_table_td_selected").prev();c--}else{if(b>0){b=Ami.Grid.SelectedCell.getVisibleRow(b,false,0);e=$("#tr"+b+" td");c=$(e).length;e=$("#tr"+b+" td:nth-child("+c+")")}else{e=$(".grid_table_td_selected")}}break;case AmiConst.HOME:e=$("#tr"+b+" td")[0];break;case AmiConst.END:e=$("#tr"+b+" td");e=$(e)[$(e).length-1];break;case AmiConst.PGUP:b=Ami.Grid.SelectedCell.getVisibleRow(b,false,Ami.Grid.rowsPerPage());var a=parseInt($($("#grid_table tr")[0]).attr("id").substring(2));if(b<a){b=a}var e=$("#tr"+b+" td:nth-child("+$("#SelectedCellCP").val()+")");break;case AmiConst.PGDOWN:b=Ami.Grid.SelectedCell.getVisibleRow(b,true,Ami.Grid.rowsPerPage());var f=RowsCount();var a=parseInt($($("#grid_table tr")[0]).attr("id").substring(2));if(b>(f-1+a)){b=f-1+a}var e=$("#tr"+b+" td:nth-child("+$("#SelectedCellCP").val()+")");break;default:}Ami.Grid.SelectedCell.nextCellRow=b;Ami.Grid.SelectedCell.nextCellColumn=c;return e};Ami.Grid.SelectedCell.getVisibleRow=function(a,c,b){var d=null;if(c){d=$("#tr"+a).nextAll("tr:visible")}else{d=$("#tr"+a).prevAll("tr:visible")}if(d.length==0){return a}else{if(b>d.length){b=d.length-1}return parseInt($(d[b]).attr("id").substring(2))}};Ami.Grid.SelectedCell.show=function(){if($(".grid_table_td_selected").length==0){return}Ami.ContextMenu.hide();$("#SelectedCellText").hide();$("#SelectedCell").hide();$("#CheckBoxComboboxList").hide();$("#FlagComboboxList").hide();var a=$("#grid_table").height();var i=$("#grid_table").width();var f=$(".grid_table_td_selected");var e=$(f).position();var b=$get("left_scroll").scrollLeft;var c=$get("vscroll").scrollTop;var g=$(f).width()+parseInt($(f).css("padding-left"));Ami.Grid.SelectedCell.RowIndex=parseInt(($(f).parents().filter("tr").attr("id")).substring(2));Ami.Grid.SelectedCell.ColumnIndex=parseInt($(f).parent().children().index($(f)))+1;Ami.Grid.SelectedCell.setFieldIDandType();Ami.Grid.RangeSelect.addRow(Ami.Grid.SelectedCell.RowIndex);$("#SelectedCell").css("margin-left",e.left-2+b);$("#SelectedCell").css("margin-top",-(a-e.top+3-c));$("#SelectedCell").width(g);if(!Ami.IsReadOnly()){switch(Ami.Grid.SelectedCell.FieldType){case"td":$("#SelectedCellExpFlag").hide();$("#SelectedCellUpDown").hide();$("#SelectedCellExpRes").hide();$("#SelectedCellExp").show();$("#SelectedCellExp").css("margin-left",""+(g-19)+"px");$("#SelectedCellText").width(g-19-6);break;case"tu":$("#SelectedCellUpDown").show();$("#SelectedCellExpFlag").hide();$("#SelectedCellExp").hide();$("#SelectedCellExpRes").hide();$("#SelectedCellUpDown").css("margin-left",""+(g-19)+"px");$("#SelectedCellText").width(g-19-6);break;case"tf":$("#SelectedCellExpFlag").show();$("#SelectedCellExp").hide();$("#SelectedCellExpRes").hide();$("#SelectedCellUpDown").hide();$("#SelectedCellExpFlag").css("margin-left",""+(g-19)+"px");$("#FlagComboboxList").width(g+2);$("#SelectedCellText").width(g-19-6);break;case"tt":default:if(Ami.Grid.SelectedCell.FieldID==49){$("#SelectedCellExpFlag").hide();$("#SelectedCellUpDown").hide();$("#SelectedCellExp").hide();$("#SelectedCellExpRes").css("margin-left",""+(g-19)+"px");$("#SelectedCellExpRes").show();$("#SelectedCellText").width(g-19-6)}else{$("#SelectedCellUpDown").hide();$("#SelectedCellExpFlag").hide();$("#SelectedCellExp").hide();$("#SelectedCellExpRes").hide();$("#SelectedCellText").width(g)}}}else{$("#SelectedCellUpDown").hide();$("#SelectedCellExpRes").hide();$("#SelectedCellExp").hide()}var d=$(".grid_table_td_selected");if($(d).length!=0){t=d.text()}else{t=""}$("#EntryBar").val(t);$("#SelectedCellText").val(t);Ami.Grid.SelectedCell.InitialText=t;Ami.Grid.SelectedCell.scrollForFullVisibility(f,g);$("#SelectedCell").show()};Ami.Grid.SelectedCell.scrollForFullVisibility=function(b,a){var c=$(b).offset().left+a-$("#sep").position().left;if(c>0){Ami.LeftPanel.HScroll.scrollDelta(c)}c=$("#left").position().left-$(b).offset().left+2;if(c>0){Ami.LeftPanel.HScroll.scrollDelta(-c)}c=$(b).offset().top-$("#left_scroll").position().top+20;if(c>0){scrollVerticalDelta(c)}c=$("#left").position().top-$(b).offset().top+2;if(c>0){scrollVerticalDelta(-c)}};Ami.Grid.SelectedCell.setByIndex=function(){if(Ami.Grid.SelectedCell.RowIndex==-1||Ami.Grid.SelectedCell.ColumnIndex==-1){return}var a=$("#tr"+Ami.Grid.SelectedCell.RowIndex+" td:nth-child("+Ami.Grid.SelectedCell.ColumnIndex+")");Ami.Grid.SelectedCell.setByCell(a)};Ami.Grid.SelectedCell.setByClickIndex=function(){if(Ami.Grid.SelectedCell.ClickRowIndex==-1||Ami.Grid.SelectedCell.ClickColumnIndex==-1){return}var a=$("#tr"+Ami.Grid.SelectedCell.ClickRowIndex+" td:nth-child("+Ami.Grid.SelectedCell.ClickColumnIndex+")");Ami.Grid.SelectedCell.setByCell(a)};Ami.Grid.SelectedCell.setByCell=function(a){if($(a).length!=0){$(".grid_table_td_selected span span").show();$(".grid_table_td_selected").removeClass("grid_table_td_selected");$(a).addClass("grid_table_td_selected");Ami.Grid.SelectedCell.show()}};Ami.Grid.SelectedCell.setFieldIDandType=function(){var a=$("#grid_table col:nth-child("+Ami.Grid.SelectedCell.ColumnIndex+")").attr("class");Ami.Grid.SelectedCell.FieldID=parseInt(a.match(/[0-9]{1,6}/)[0]);Ami.Grid.SelectedCell.FieldType=a.match(/\bt{1}[a-z]{1}/)[0]};Ami.Grid.SelectedCell.startEdit=function(a){$("#SelectedCellText").css("font-weight",$(".grid_table_td_selected").css("font-weight"));$("#SelectedCellExp").css("margin-left","0px");$("#SelectedCellExpRes").css("margin-left","0px");$("#SelectedCellExpFlag").css("margin-left","0px");if(Ami.Grid.SelectedCell.FieldType=="td"){$("#SelectedCellText").datepicker();$(".grid_table_td_selected span span").hide();$("#SelectedCellText").show();$("#SelectedCellText").focus();$("#ui-datepicker-div").css("z-index","10");if(a==null){$("#SelectedCellText").select()}}else{$("#SelectedCellText").datepicker("destroy");$(".grid_table_td_selected span span").hide();$("#SelectedCellText").show();$("#SelectedCellText").focus();if(a==null){$("#SelectedCellText").select()}else{Ami.Utils.setCursorToEnd("SelectedCellText")}}};Ami.Grid.SelectedCell.checkAndSendRequest=function(){if(Ami.Grid.SelectedCell.isChanged()){if(Ami.Grid.SelectedCell.isValid()){if(Ami.Grid.SelectedCell.isChanged()){$(".grid_table_td_selected span span").text($("#SelectedCellText").val());Ami.Grid.SelectedCell.sendChangeRequest()}}else{Ami.Dialogs.MsgBox.showCellError("Invalid entry")}return true}return false};Ami.Grid.SelectedCell.finishEdit=function(b,a){Ami.Grid.SelectedCell.pendingCommand=b;Ami.Grid.SelectedCell.pendingCommandParam=a;if(!Ami.Grid.SelectedCell.checkAndSendRequest()){Ami.Grid.SelectedCell.processPendingCommand()}};Ami.Grid.SelectedCell.setByClick=function(a){var b=$(a.target).parents().add(a.target).filter("td");Ami.Grid.SelectedCell.ClickRowIndex=parseInt(($(b).parent().attr("id")).substring(2));Ami.Grid.SelectedCell.ClickColumnIndex=parseInt($(b).parent().children().index(b))+1;Ami.Grid.SelectedCell.pendingCommand="click";if(!Ami.Grid.SelectedCell.checkAndSendRequest()){$("#SelectedCell").delay(300).hide();Ami.Grid.SelectedCell.setByCell(b)}};Ami.Grid.SelectedCell.cancelEdit=function(){$(".grid_table_td_selected span span").show();Ami.Grid.SelectedCell.show()};Ami.Grid.SelectedCell.sendChangeRequest=function(){var a={RowIndex:Ami.Grid.SelectedCell.RowIndex,ColumnIndex:Ami.Grid.SelectedCell.ColumnIndex,FieldID:Ami.Grid.SelectedCell.FieldID};var b;switch(Ami.Grid.SelectedCell.FieldType){case"tt":b="Grid_DataChangeText";a.Text=$("#SelectedCellText").val();break;case"td":b="Grid_DataChangeDate";a.Date=Ami.Grid.SelectedCell.AsDate;break;case"tu":b="Grid_DataChangeDuration";a.DurationValue=Ami.Grid.SelectedCell.AsDuration.value;a.DurationUnits=Ami.Grid.SelectedCell.AsDuration.units.value;break;case"tf":b="Grid_DataChangeFlag";a.Flag=Ami.Grid.SelectedCell.AsFlag;break;case"tm":b="Grid_DataChangeCurrency";a.Currency=Ami.Grid.SelectedCell.AsCurrency;break;case"tn":b="Grid_DataChangeNumber";a.Number=Ami.Grid.SelectedCell.AsNumber;break;default:b="Grid_DataChangeText"}Ami.Utils.runCommand3(b,Ami.Grid.SelectedCell.onAfterSendChangeRequest,a)};Ami.Grid.SelectedCell.onAfterSendChangeRequest=function(a){$("#hidden_div").trigger("Ami.Grid.SelectedCell.AfterSendChangeRequest",a);Ami.Grid.SelectedCell.processPendingCommand()};Ami.Grid.SelectedCell.processPendingCommand=function(){$("#grid_table").focus();switch(Ami.Grid.SelectedCell.pendingCommand){case"move":Ami.Grid.SelectedCell.setByDirection(Ami.Grid.SelectedCell.pendingCommandParam);break;case"click":Ami.Grid.SelectedCell.setByClickIndex();break;case"stay":Ami.Grid.SelectedCell.setByIndex();Ami.Grid.SelectedCell.show();break}Ami.Grid.SelectedCell.pendingCommand=null;Ami.Grid.SelectedCell.pendingCommandParams=null;if($(".grid_table_td_selected").length>0){$("#SelectedCell").css("margin-left",$(".grid_table_td_selected").position().left-2)}};Ami.Grid.SelectedCell.setNewText=function(b){var a=$("#SelectedCellText").val();Ami.Grid.SelectedCell.InitialText=a;var c=$(".grid_table_td_selected span span");if($(c).length==0){if(Ami.Grid.SelectedCell.FieldID=="14"){$(".grid_table_td_selected").html('<span><img class="expander" src="/apImg/grid/empty.png" alt="" width="9px" height="9px"><span>'+a+"</span></span>")}else{$(".grid_table_td_selected").html("<span>"+a+"</span>")}}else{$(c).text(a)}};Ami.Grid.SelectedCell.onExpClick=function(a){Ami.Grid.SelectedCell.startEdit()};Ami.Grid.SelectedCell.onExpResClick=function(a){if($("#CheckBoxComboboxList").is(":visible")){$("#CheckBoxComboboxList").hide()}else{Ami.Grid.SelectedCell.refreshResourceList()}};Ami.Grid.SelectedCell.onExpFlagClick=function(a){if($("#FlagComboboxList").is(":visible")){$("#FlagComboboxList").hide()}else{$("#FlagComboboxList").css("left",$("#SelectedCell").css("margin-left")).css("top",-1*$("#SelectedCell").css("margin-top")+20).show()}};Ami.Grid.SelectedCell.refreshResourceList=function(){Ami.Utils.runCommand2("GetResources",Ami.Grid.SelectedCell.onAfterGetResource)};Ami.Grid.SelectedCell.onAfterGetResource=function(msg){Ami.Data.Resources=eval("("+msg+")");Ami.Grid.SelectedCell.refreshResourceList2();$("#CheckBoxComboboxList").css("left",$("#SelectedCell").css("margin-left"));$("#CheckBoxComboboxList").css("top",-1*$("#SelectedCell").css("margin-top")+20);if($("#SelectedCell").width()>$("#CheckBoxComboboxList").width()){$("#CheckBoxComboboxList").width($("#SelectedCell").width()+2)}$("#CheckBoxComboboxList").show();Ami.Grid.SelectedCell.startEdit()};Ami.Grid.SelectedCell.refreshResourceList2=function(){if($("#CheckBoxComboboxList").length>0){$("#CheckBoxComboboxList")[0].innerHTML=""}var d=$("#SelectedCellText").val().split(","),c="";for(var a=0;a<Ami.Data.Resources.length;a++){for(var b=0;b<d.length;b++){c="";if(d[b]==Ami.Data.Resources[a].name){c="checked";break}}$('<nobr><input type="checkbox" '+c+"/><span>"+Ami.Data.Resources[a].name+"</span></nobr><br>").appendTo("#CheckBoxComboboxList")}$("#CheckBoxComboboxList input").unbind("click");$("#CheckBoxComboboxList input").bind("click",Ami.Grid.SelectedCell.onCheckBoxComboboxListClick);$("#CheckBoxComboboxList").height(20*Ami.Data.Resources.length);if(Ami.Data.Resources.length==0){$("<br><br><br>").appendTo("#CheckBoxComboboxList");$("#CheckBoxComboboxList").height(60)}};Ami.Grid.SelectedCell.onCheckBoxComboboxListClick=function(a){var b="";$("#CheckBoxComboboxList input:checked").each(function(c){b+=$(this).next().html()+","});if(b.length>0){b=b.substring(0,b.length-1)}$("#SelectedCellText").val(b)};Ami.Grid.SelectedCell.onUpDownClick=function(a){Ami.Grid.SelectedCell.startEdit();var c=$("#SelectedCellText").val();if(c==""){$("#SelectedCellText").val("1 day");return false}var b=Ami.Duration.parse(c);b.value+=a;$("#SelectedCellText").val(b.toString2())};Ami.Grid.SelectedCell.onUpClick=function(a){Ami.Grid.SelectedCell.onUpDownClick(1);return false};Ami.Grid.SelectedCell.onDownClick=function(a){Ami.Grid.SelectedCell.onUpDownClick(-1);return false};Ami.Grid.SelectedCell.onUpDownDblClick=function(a){return false};Ami.Grid.SelectedCell.onFlagListValueClick=function(a){Ami.Grid.SelectedCell.AsFlag=$(a.target).attr("id")=="FlagComboboxListYes";$("#FlagComboboxList").hide();if($(".grid_table_td_selected span span").text()!=$(a.target).html()){$(".grid_table_td_selected span span").text($(a.target).html());Ami.Grid.SelectedCell.sendChangeRequest()}return false};Ami.Presenter={};Ami.Presenter.init=function(){$("#hidden_div").bind("Ami.Dialogs.ProjectInfo.AfterSetData",function(b,a){Ami.Presenter.ProcessUpdateMsg(a)});$("#hidden_div").bind("Ami.Dialogs.Timescale.AfterSetData",function(b,a){Ami.Presenter.ProcessUpdateMsg(a)});$("#hidden_div").bind("Ami.Dialogs.TaskInfo.AfterSetData",function(b,a){Ami.Presenter.ProcessUpdateMsg(a)});$("#hidden_div").bind("Ami.Dialogs.FieldSettings.AfterSetData",function(b,a){Ami.Presenter.ProcessUpdateMsg(a)});$("#hidden_div").bind("Ami.Grid.SelectedCell.AfterSendChangeRequest",function(b,a){Ami.Presenter.ProcessUpdateMsg(a)});$("#hidden_div").bind("Ami.GanttChart.AfterZoom",function(b,a){Ami.Presenter.ProcessUpdateMsg(a)})};Ami.Presenter.ProcessUpdateMsg=function(msg){if(msg=="noupdate"){return}if(msg.substring(0,7)=='{"msg":'){var msgObj=eval("("+msg+")");Ami.Dialogs.MsgBox.show2(msgObj.msg,"ok",msgObj.icon);return}var msgParts=msg.split("@#$");for(var i=0;i<msgParts.length;i++){if(msgParts[i].substr(0,4)=="grid"){Ami.Grid.update(msgParts[i].substr(4))}if(msgParts[i].substr(0,5)=="chart"){Ami.GanttChart.refreshImage(msgParts[i].substr(5))}if(msgParts[i].substr(0,9)=="timescale"){Ami.GanttChart.refreshTimescale(msgParts[i].substr(9))}}};Ami.ContextMenu={};Ami.ContextMenu.hide=function(){$("#jqContextMenu").hide()};(function(f){var i,b,d,h,e,c;var j={menuStyle:{listStyle:"none",padding:"1px",margin:"0px",backgroundColor:"#fff",border:"1px solid #999",width:"100px"},itemStyle:{margin:"0px",color:"#000",display:"block",cursor:"default",padding:"3px",border:"1px solid #fff",backgroundColor:"transparent"},itemHoverStyle:{border:"1px solid #0a246a",backgroundColor:"#b6bdd2"},eventPosX:"pageX",eventPosY:"pageY",shadow:true,onContextMenu:null,onShowMenu:null};f.fn.contextMenu=function(k,m){if(!i){i=f('<div id="jqContextMenu"></div>').hide().css({position:"absolute",zIndex:"500"}).appendTo("body").bind("click",function(n){n.stopPropagation()})}if(!b){b=f("<div></div>").css({backgroundColor:"#000",position:"absolute",opacity:0.2,zIndex:499}).appendTo("body").hide()}e=e||[];e.push({id:k,menuStyle:f.extend({},j.menuStyle,m.menuStyle||{}),itemStyle:f.extend({},j.itemStyle,m.itemStyle||{}),itemHoverStyle:f.extend({},j.itemHoverStyle,m.itemHoverStyle||{}),bindings:m.bindings||{},shadow:m.shadow||m.shadow===false?m.shadow:j.shadow,onContextMenu:m.onContextMenu||j.onContextMenu,onShowMenu:m.onShowMenu||j.onShowMenu,eventPosX:m.eventPosX||j.eventPosX,eventPosY:m.eventPosY||j.eventPosY});var l=e.length-1;f(this).bind("contextmenu",function(n){var o=(!!e[l].onContextMenu)?e[l].onContextMenu(n):true;if(o){g(l,this,n,m)}return false});return this};function g(k,m,o,n){var l=e[k];h=f("#"+l.id).find("ul:first").clone(true);h.css(l.menuStyle).find("li").css(l.itemStyle).hover(function(){f(this).css(l.itemHoverStyle)},function(){f(this).css(l.itemStyle)}).find("img").css({verticalAlign:"middle",paddingRight:"2px"});i.html(h);if(!!l.onShowMenu){i=l.onShowMenu(o,i)}f.each(l.bindings,function(p,q){f("#"+p,i).bind("click",function(r){a();q(m,c)})});i.css({left:o[l.eventPosX],top:o[l.eventPosY]}).show();if(l.shadow){b.css({width:i.width(),height:i.height(),left:o.pageX+2,top:o.pageY+2}).show()}f(document).one("click",a)}function a(){i.hide();b.hide()}f.contextMenu={defaults:function(k){f.each(k,function(m,l){if(typeof l=="object"&&j[m]){f.extend(j[m],l)}else{j[m]=l}})}}})(jQuery);$(function(){$("div.contextMenu").hide()});function MouseWheelScroll(b,a){$("#vscroll").stop().scrollTo((a>0?"-":"+")+"=20px")}function ShowUploadIndicator(){$("#FileUpload1").hide();$("#UploadingImg").show();$("#BrowseOpenFilePanel").data("title.dialog","Uploading... Please wait");__doPostBack("","")}function SeparatorDragStop(g,d){var i=$("#sep").position().left;var c;if($("#rp").length){c=parseInt($("#rp").width(),0)}else{c=0}var h=17;var f=17,a=7,e=34;var j=$(window).width()-i-a-c-f;var b=0;if(!$.browser.mozilla){b=17}$("#right").css("left",i);$("#right").width(j);$(".right_header").css("left",i);$(".right_header").width(j);$("#right_scroll").css("left",i);$("#right_scroll").width(j);$("#right_scroll_nested1").width(j);$("#left_header").width(i-f-e);$("#left").width(i-f-e);$("#left_scroll").width(i-f+b);if(d){Ami.Utils.runCommand3("GanttChartViewSeparatorMoved",function(){},{Position:i})}}function SetHeights(){$("#vscroll").height($.browser.mozilla?$(window).height()-100-40:$(window).height()-100-40+17);$("#row_selector").height($(window).height()-132-40);$("#left").height($(window).height()-132-40);$("#right").height($(window).height()-132-40);$("#rp").height($(window).height()-132-40);$("#view_bar").height($(window).height()-100);$("#sep").height($(window).height()-100);if($("#rp").length){$("#rp").height($(window).height()-100)}}function ResizeListner(b){var a;if($("#rp").length){a=parseInt($("#rp").width(),0)}else{a=0}SeparatorDragStop(b,true);SetHeights()}function SetSizes(b){var a;if($("#rp").length){a=parseInt($("#rp").width(),0)}else{a=0}$("#left_scroll").width($.browser.mozilla?$("#head").width()*0.4-17:$("#head").width()*0.4);$("#left_scroll_nested").width($("#grid_table").width()+33);$("#left_header").width($("#head").width()*0.4-49);$("#left").width($("#head").width()*0.4-49);$("#right_scroll").width($.browser.mozilla?$("#head").width()*0.6-a-6-17:$("#head").width()*0.6-a-6);$("#right_scroll_nested1").width($("#right_scroll").width());$(".right_header").width($("#right_scroll").width());$("#right").width($.browser.mozilla?$("#head").width()*0.6-a-6-17:$("#head").width()*0.6-a-6);SetHeights()}function Hacks(){if($.browser.msie&&$.browser.version!="8.0"){$(".grid_table col").attr("width",function(){return $(this).attr("width")-1+"px"})}if($.browser.msie&&$.browser.version!="8.0"){$("#timescale3 col").attr("width",function(){return $(this).attr("width")-1});$("#timescale2 col").attr("width",function(){return $(this).attr("width")-1});$("#timescale1 col").attr("width",function(){return $(this).attr("width")-1})}if($.browser.msie&&$.browser.version=="8.0"){$(".grid_table td").css("height","19px")}if($.browser.msie&&($.browser.version=="7.0"||$.browser.version=="6.0")){$.each($.grep($(".grid_table td"),function(a){return a.innerHTML.length>0}),function(){$(this).css("height","19px")})}if($.browser.safari){$(".grid_table td").css("height","19px")}}function ganttChartImgLoaded(){$("#GanttRendering2").css("display","none");if($("#GanttChartImg2").width()==0){Ami.Dialogs.MsgBox.show2("Gantt Chart drawing error. This error has been logged and we try to resolve it.","ok","error");return}$("#right_scroll_nested2").width($("#GanttChartImg2").width());$("#vscroll_nested").height($("#GanttChartImg2").height()+30);$(".gantt_rendering div").width($("#GanttChartImg2").width())}function scrollRight(a){$.scrollTo.defaults.axis="x";var b=$get("right_scroll_nested1").scrollLeft;$(".right_header").stop().scrollTo(b);$("#right").stop().scrollTo(b)}function scrollRightDelta(a){$.scrollTo.defaults.axis="x";var b=$get("right_scroll_nested1").scrollLeft+a;$("#right_scroll_nested1").stop().scrollTo(b);$(".right_header").stop().scrollTo(b);$("#right").stop().scrollTo(b)}function scrollVertical(b){$.scrollTo.defaults.axis="y";var a=$get("vscroll").scrollTop;$("#left").stop().scrollTo(a);$("#right").stop().scrollTo(a);$("#row_selector").stop().scrollTo(a)}function scrollVerticalDelta(a){$.scrollTo.defaults.axis="y";var b=$get("vscroll").scrollTop+a;$("#vscroll").stop().scrollTo(b);$("#left").stop().scrollTo(b);$("#right").stop().scrollTo(b);$("#row_selector").stop().scrollTo(b)}function FileReadingErrorMsgBoxOkClicked(){if($("[name=FileReadingErrorMsgBox1$ctl03]").val().length>0){AmiProject.WebService.SetEmail4ReadingFailure($("[name=FileReadingErrorMsgBox1$ctl05]").val(),$("[name=FileReadingErrorMsgBox1$ctl03]").val(),OnRequestComplete)}}function OnRequestComplete(a){}function toggleRPanel(a){if($("#rp:visible").length>0){HideRPanel()}else{ShowRPanel()}}function HideRPanel(){$("#rp").animate({width:0},"normal",function(){HideRPanelFinish()});$(".right_header").animate({width:parseInt($(".right_header").width(),0)+160});$("#right").animate({width:parseInt($("#right").width(),0)+160});$("#vscroll").animate({right:0});$("#right_scroll_nested1").animate({width:parseInt($("#right_scroll_nested1").width(),0)+160});$("#empty_box").animate({right:0})}function HideRPanelFinish(){$("#rp").hide();$("#sep").draggable("option","containment",[51,0,$("#vscroll").position().left,100])}function ShowRPanel(){$("#rp").show();$("#rp").animate({width:160},"normal",function(){ShowRPanelFinish()});$(".right_header").animate({width:parseInt($(".right_header").width(),0)-160});$("#right").animate({width:parseInt($("#right").width(),0)-160});$("#vscroll").animate({right:160});$("#right_scroll_nested1").animate({width:parseInt($("#right_scroll_nested1").width(),0)-160});$("#empty_box").animate({right:160})}function HideRPanelNA(){$("#rp").width(0);$("#rp").hide();$(".right_header").width(parseInt($(".right_header").width(),0)+160);$("#right").width(parseInt($("#right").width(),0)+160);$("#vscroll").css("right",0);$("#right_scroll_nested1").width(parseInt($("#right_scroll_nested1").width(),0)+160);$("#empty_box").css("right",0)}function ShowRPanelFinish(){$("#sep").draggable("option","containment",[51,0,$("#vscroll").position().left,100])}function OpenBrowseTemplateDialog(){$("#templates").dialog("open")}function UpdateVScrollHeight(){$("#vscroll_nested").height($(".gantt_rendering div:visible").length*20+30)};(function(a){var b=a.scrollTo=function(e,f,d){a(window).scrollTo(e,f,d)};b.defaults={axis:"y",duration:1};b.window=function(d){return a(window).scrollable()};a.fn.scrollable=function(){return this.map(function(){var e=this.parentWindow||this.defaultView,f=this.nodeName=="#document"?e.frameElement||e:this,d=f.contentDocument||(f.contentWindow||f).document,h=f.setInterval;return f.nodeName=="IFRAME"||h&&a.browser.safari?d.body:h?d.documentElement:this})};a.fn.scrollTo=function(e,f,d){if(typeof f=="object"){d=f;f=0}if(typeof d=="function"){d={onAfter:d}}d=a.extend({},b.defaults,d);f=f||d.speed||d.duration;d.queue=d.queue&&d.axis.length>1;if(d.queue){f/=2}d.offset=c(d.offset);d.over=c(d.over);return this.scrollable().each(function(){var g=this,i=a(g),n=e,h,r={},j=i.is("html,body");switch(typeof n){case"number":case"string":if(/^([+-]=)?\d+(px)?$/.test(n)){n=c(n);break}n=a(n,this);case"object":if(n.is||n.style){h=(n=a(n)).offset()}}a.each(d.axis.split(""),function(l,o){var w=o=="x"?"Left":"Top",k=w.toLowerCase(),u="scroll"+w,p=g[u],q=o=="x"?"Width":"Height",x=q.toLowerCase();if(h){r[u]=h[k]+(j?0:p-i.offset()[k]);if(d.margin){r[u]-=parseInt(n.css("margin"+w))||0;r[u]-=parseInt(n.css("border"+w+"Width"))||0}r[u]+=d.offset[k]||0;if(d.over[k]){r[u]+=n[x]()*d.over[k]}}else{r[u]=n[k]}if(/^\d+$/.test(r[u])){r[u]=r[u]<=0?0:Math.min(r[u],s(q))}if(!l&&d.queue){if(p!=r[u]){m(d.onAfterFirst)}delete r[u]}});m(d.onAfter);function m(k){i.animate(r,f,d.easing,k&&function(){k.call(this,e,d)})}function s(l){var o="scroll"+l,k=g.ownerDocument;return j?Math.max(k.documentElement[o],k.body[o]):g[o]}}).end()};function c(d){return typeof d=="object"?d:{top:d,left:d}}})(jQuery);(function(a){a.fn.hoverIntent=function(m,n){var l={sensitivity:7,interval:100,timeout:0};l=a.extend(l,n?{over:m,out:n}:m);var j,k,h,i;var b=function(f){j=f.pageX;k=f.pageY};var e=function(f,g){g.hoverIntent_t=clearTimeout(g.hoverIntent_t);if((Math.abs(h-j)+Math.abs(i-k))<l.sensitivity){a(g).unbind("mousemove",b);g.hoverIntent_s=1;return l.over.apply(g,[f])}else{h=j;i=k;g.hoverIntent_t=setTimeout(function(){e(f,g)},l.interval)}};var c=function(f,g){g.hoverIntent_t=clearTimeout(g.hoverIntent_t);g.hoverIntent_s=0;return l.out.apply(g,[f])};var d=function(o){var q=(o.type=="mouseover"?o.fromElement:o.toElement)||o.relatedTarget;while(q&&q!=this){try{q=q.parentNode}catch(o){q=this}}if(q==this){return false}var g=jQuery.extend({},o);var f=this;if(f.hoverIntent_t){f.hoverIntent_t=clearTimeout(f.hoverIntent_t)}if(o.type=="mouseover"){h=g.pageX;i=g.pageY;a(f).bind("mousemove",b);if(f.hoverIntent_s!=1){f.hoverIntent_t=setTimeout(function(){e(g,f)},l.interval)}}else{a(f).unbind("mousemove",b);if(f.hoverIntent_s==1){f.hoverIntent_t=setTimeout(function(){c(g,f)},l.timeout)}}};return this.mouseover(d).mouseout(d)}})(jQuery);(function(a){a.fn.bgIframe=a.fn.bgiframe=function(c){if(a.browser.msie&&parseInt(a.browser.version)<=6){c=a.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:true,src:"javascript:false;"},c||{});var b=function(e){return e&&e.constructor==Number?e+"px":e},d='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+c.src+'"style="display:block;position:absolute;z-index:-1;'+(c.opacity!==false?"filter:Alpha(Opacity='0');":"")+"top:"+(c.top=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":b(c.top))+";left:"+(c.left=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":b(c.left))+";width:"+(c.width=="auto"?"expression(this.parentNode.offsetWidth+'px')":b(c.width))+";height:"+(c.height=="auto"?"expression(this.parentNode.offsetHeight+'px')":b(c.height))+';"/>';return this.each(function(){if(a("> iframe.bgiframe",this).length==0){this.insertBefore(document.createElement(d),this.firstChild)}})}return this};if(!a.browser.version){a.browser.version=navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1]}})(jQuery);(function(a){a.fn.superfish=function(i){var e=a.fn.superfish,j=e.c,k=a([""].join("")),h=function(){var c=a(this),l=g(c);clearTimeout(l.sfTimer);c.showSuperfishUl().siblings().hideSuperfishUl()},f=function(){var l=a(this),m=g(l),c=e.op;clearTimeout(m.sfTimer);m.sfTimer=setTimeout(function(){c.retainPath=(a.inArray(l[0],c.$path)>-1);l.hideSuperfishUl();if(c.$path.length&&l.parents(["li.",c.hoverClass].join("")).length<1){h.call(c.$path)}},c.delay)},g=function(c){var l=c.parents(["ul.",j.menuClass,":first"].join(""))[0];e.op=e.o[l.serial];return l},d=function(c){c.addClass(j.anchorClass).append(k.clone())};return this.each(function(){var l=this.serial=e.o.length;var c=a.extend({},e.defaults,i);c.$path=a("li."+c.pathClass,this).slice(0,c.pathLevels).each(function(){a(this).addClass([c.hoverClass,j.bcClass].join(" ")).filter("li:has(ul)").removeClass(c.pathClass)});e.o[l]=e.op=c;a("li:has(ul)",this)[(a.fn.hoverIntent&&!c.disableHI)?"hoverIntent":"hover"](h,f).each(function(){if(c.autoArrows){d(a(">a:first-child",this))}}).not("."+j.bcClass).hideSuperfishUl();var m=a("a",this);m.each(function(n){var o=m.eq(n).parents("li");m.eq(n).focus(function(){h.call(o)}).blur(function(){f.call(o)})});c.onInit.call(this)}).each(function(){var c=[j.menuClass];if(e.op.dropShadows&&!(a.browser.msie&&a.browser.version<7)){c.push(j.shadowClass)}a(this).addClass(c.join(" "))})};var b=a.fn.superfish;b.o=[];b.op={};b.IE7fix=function(){var c=b.op;if(a.browser.msie&&a.browser.version>6&&c.dropShadows&&c.animation.opacity!=undefined){this.toggleClass(b.c.shadowClass+"-off")}};b.c={bcClass:"sf-breadcrumb",menuClass:"sf-js-enabled",anchorClass:"sf-with-ul",arrowClass:"sf-sub-indicator",shadowClass:"sf-shadow"};b.defaults={hoverClass:"sfHover",pathClass:"overideThisToUse",pathLevels:1,delay:800,animation:{opacity:"show"},speed:"normal",autoArrows:true,dropShadows:true,disableHI:false,onInit:function(){},onBeforeShow:function(){},onShow:function(){},onHide:function(){}};a.fn.extend({hideSuperfishUl:function(){var c=b.op,e=(c.retainPath===true)?c.$path:"";c.retainPath=false;var d=a(["li.",c.hoverClass].join(""),this).add(this).not(e).removeClass(c.hoverClass).find(">ul").hide().css("visibility","hidden");c.onHide.call(d);return this},showSuperfishUl:function(){var c=b.op,e=b.c.shadowClass+"-off",d=this.addClass(c.hoverClass).find(">ul:hidden").css("visibility","visible");b.IE7fix.call(d);c.onBeforeShow.call(d);d.animate(c.animation,c.speed,function(){b.IE7fix.call(d);c.onShow.call(d)});return this}})})(jQuery);(function(a){a.fn.supersubs=function(b){var c=a.extend({},a.fn.supersubs.defaults,b);return this.each(function(){var e=a(this);var d=a.meta?a.extend({},c,e.data()):c;var f=a('<li id="menu-fontsize">&#8212;</li>').css({padding:0,position:"absolute",top:"-999em",width:"auto"}).appendTo(e).width();a("#menu-fontsize").remove();$ULs=e.find("ul");$ULs.each(function(g){var h=$ULs.eq(g);var l=h.children();var k=l.children("a");var m=l.css("white-space","nowrap").css("float");var j=h.add(l).add(k).css({"float":"none",width:"auto"}).end().end()[0].clientWidth/f;j+=d.extraWidth;if(j>d.maxWidth){j=d.maxWidth}else{if(j<d.minWidth){j=d.minWidth}}j+="em";h.css("width",j);l.css({"float":m,width:"100%","white-space":"normal"}).each(function(){var n=a(">ul",this);var i=n.css("left")!==undefined?"left":"right";n.css(i,j)})})})};a.fn.supersubs.defaults={minWidth:9,maxWidth:25,extraWidth:0}})(jQuery);(function(f){var d=["DOMMouseScroll","mousewheel"];f.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var a=d.length;a;){this.addEventListener(d[--a],e,false)}}else{this.onmousewheel=e}},teardown:function(){if(this.removeEventListener){for(var a=d.length;a;){this.removeEventListener(d[--a],e,false)}}else{this.onmousewheel=null}}};f.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}});function e(a){var c=[].slice.call(arguments,1),b=0,h=true;a=f.event.fix(a||window.event);a.type="mousewheel";if(a.wheelDelta){b=a.wheelDelta/120}if(a.detail){b=-a.detail/3}c.unshift(a,b);return f.event.handle.apply(this,c)}})(jQuery);(function($){$.toJSON=function(o){if(typeof(JSON)=="object"&&JSON.stringify){return JSON.stringify(o)}var type=typeof(o);if(o===null){return"null"}if(type=="undefined"){return undefined}if(type=="number"||type=="boolean"){return o+""}if(type=="string"){return $.quoteString(o)}if(type=="object"){if(typeof o.toJSON=="function"){return $.toJSON(o.toJSON())}if(o.constructor===Date){var month=o.getUTCMonth()+1;if(month<10){month="0"+month}var day=o.getUTCDate();if(day<10){day="0"+day}var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10){hours="0"+hours}var minutes=o.getUTCMinutes();if(minutes<10){minutes="0"+minutes}var seconds=o.getUTCSeconds();if(seconds<10){seconds="0"+seconds}var milli=o.getUTCMilliseconds();if(milli<100){milli="0"+milli}if(milli<10){milli="0"+milli}return'"'+year+"-"+month+"-"+day+"T"+hours+":"+minutes+":"+seconds+"."+milli+'Z"'}if(o.constructor===Array){var ret=[];for(var i=0;i<o.length;i++){ret.push($.toJSON(o[i])||"null")}return"["+ret.join(",")+"]"}var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number"){name='"'+k+'"'}else{if(type=="string"){name=$.quoteString(k)}else{continue}}if(typeof o[k]=="function"){continue}var val=$.toJSON(o[k]);pairs.push(name+":"+val)}return"{"+pairs.join(", ")+"}"}};$.evalJSON=function(src){if(typeof(JSON)=="object"&&JSON.parse){return JSON.parse(src)}return eval("("+src+")")};$.secureEvalJSON=function(src){if(typeof(JSON)=="object"&&JSON.parse){return JSON.parse(src)}var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,"@");filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,"");if(/^[\],:{}\s]*$/.test(filtered)){return eval("("+src+")")}else{throw new SyntaxError("Error parsing JSON, source is not valid.")}};$.quoteString=function(string){if(string.match(_escapeable)){return'"'+string.replace(_escapeable,function(a){var c=_meta[a];if(typeof c==="string"){return c}c=a.charCodeAt();return"\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16)})+'"'}return'"'+string+'"'};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"}})(jQuery);
