﻿function window_onload_AddEditNote() {
    if (document.forms.length > 0) {
        document.forms[0].elements["GRMK_TX"].focus();
        initChangeTracking('SubmitRemark', false, 'ChkIgnoreWarn', true);
    }
}

function processDelete() {
    Msg = 'Are you sure want to delete this note?';
    isConfirmed = isIgnoreWarningsClick ? true : confirm(Msg);
    
    if (isConfirmed) {
        isWindowCloseConfirmed = true;
        frmRemarks.DeleteRemark.value = 'Y';
        if (typeof(setPostingEventElement) == "function") setPostingEventElement();
        frmRemarks.submit();
    }
}

function processOK() {
    frmRemarks.DeleteRemark.value = 'N';
}

function window_onload_missions(view,missions) {
    if (typeof(moveTableAnchorTagUp)=="function") moveTableAnchorTagUp('timeline',12);

    if (view != '') {
        form1.cboView.selectedIndex = view;
    } else {
        form1.cboView.selectedIndex = 0;            // default to Airlift
    }
    
    if (missions != '') {
        form1.cboMissions.selectedIndex = missions;
    } else {
        form1.cboMissions.selectedIndex = 2;        // default to GDSS Only
    }
    
    window.status = "Change the selection and click Go.";
}

function checkAll(field) {
    if (field.length > 0) {
        for (i = 0; i < field.length; i++) {
            field[i].checked = true ;
            field[i].defaultChecked = field[i].checked ;
        }
    } else {
        field.checked = true ;
        field.defaultChecked = field.checked ;
    }
}

function uncheckAll(field) {
    if (field.length > 0) {
        for (i = 0; i < field.length; i++) {
            field[i].checked = false ;
            field[i].defaultChecked = field[i].checked ;
        }
    } else {
        field.checked = false ;
        field.defaultChecked = field.checked ;
    }
}

function LoadMissionDetailPopup(aor_name,aor_id,abp_id_desc,msn_key) {
    var tchar = String.fromCharCode(38)
    var turl = 'ATOC_TBMCSMissionDetail.aspx?AORNAME=' + aor_name + tchar + 'AOR=' + aor_id + tchar + 'ABPID=' + abp_id_desc + tchar + 'MSNKEY=' + msn_key;
    openWindowCentered(turl,'','scrollbars=1,status=1',800,600);
}

function LoadG2MissionDetailPopup(am_id) {
    var tchar = String.fromCharCode(38)
    var turl = '/gdss2web/mme/mmeMissionDetail.php?AM_ID=' + am_id;
    openWindowCentered(turl,'','scrollbars=1,status=1',800,600);
}

function window_refresh() {
    history.go(0);
}

function form_submit() {
    window.document.body.style.cursor = "wait";
    return true;
}

function LoadASMPopup(chkASM) {
    var tchar = String.fromCharCode(38)
    var turl = 'ATOC_ASM_Bulk.aspx?TYPE=Q' + tchar + 'VIEW=A' + tchar + 'ASM=' + chkASM;
    openWindowCentered(turl,'','scrollbars=1,status=1',600,300);
}

function window_onload_Summary(aor,daterange) {
    if (aor != '') {
        form1.cboAOR.selectedIndex = aor;
    } else {
        form1.cboAOR.selectedIndex = 0;            // default to All
    }

    if (daterange == 1) {
        document.getElementById('imgcboDtRange').style.visibility = 'visible';
        document.getElementById('cboDtRange').style.pixelWidth = document.getElementById('cboDtRange').origPixelWidth - 22;
        document.getElementById('imgcboDtRange').style.pixelWidth = 22;
    } else {
        document.getElementById('imgcboDtRange').style.visibility = 'hidden';
        document.getElementById('cboDtRange').style.pixelWidth = document.getElementById('cboDtRange').origPixelWidth;
        document.getElementById('imgcboDtRange').style.pixelWidth = 0;
    }
}

function LoadMsnSearchPopup() {
    var turl = 'ATOC_MissionSearch.aspx';
    openWindowCentered(turl,'','menubar=1,toolbar=1,scrollbars=1,status=1',700,400);
}

var menuDefs = new Array();
function rightClickMenus(libLoc) {
  /* requires the global var menuDefs */
//debugger;
  /* Common menus used on most pages */
  menuDefs['menu_0'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER');

  /* G2 Mission Detail display */
  menuDefs['menu_1'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("Mission Detail ..." , "window.parent.ProcessMenuChoice('/gdss2web/mme/mmeMissionDetail.php?AM_ID=%AM_ID%','MENU,AM_ID','mmeDashboard,mmeMissionDashboard','width=830,height=650,status,scrollbars,resizable');",libLoc + "/gph/mmeMissionDetail.ico", "true"),
  'DIVIDER');

  /* TBMCS Mission Detail display */
  menuDefs['menu_2'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("Mission Detail ..." , "window.parent.ProcessMenuChoice('%URL%/OPAGE/DisplayMSN.jsp?MSN_WWID=%WWID%','MENU,URL,WWID','mmeDashboard,mmeMissionDashboard','width=830,height=650,status,scrollbars,resizable');",libLoc + "/gph/mmeMissionDetail.ico", "true"),
  'DIVIDER');

  /* G2 ICAO display */
  menuDefs['menu_3'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("Airfield Detail" , "window.parent.ProcessMenuChoice('/gdss2web/lc/lcAirfieldDetail.php?ICAO=%ICAO%','MENU,ICAO,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=800,height=650,status,resizable,scrollbars');",libLoc + "/gph/lcAirfieldDetail.ico", "true"),
  new Array("Airfield Suitability" , "window.parent.ProcessMenuChoice('/gdss2web/lc/lcAirfieldSuitability.php?ICAO=%ICAO%','MENU,ICAO,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=800,height=650,status,resizable,scrollbars');",libLoc + "/gph/lcAirfieldDetail.ico", "false"),
  new Array("Airfield Audit" , "window.parent.ProcessMenuChoice('/gdss2web/sys/sysAudit.php?AUDIT=AIRFIELD&KEY=%ICAO%','MENU,ICAO,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=900,height=500,status,resizable,scrollbars');",libLoc + "/gph/sysAirfieldAudit.ico", "false"),
  'DIVIDER',
  new Array("View NOTAMs" , "window.parent.ProcessMenuChoice('/gdss2web/fm/fmViewNotams.php?ICAO_LIST=%ICAO%','MENU,ICAO,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=780,height=500,status,resizable,scrollbars');",libLoc + "/gph/fmViewNotams.ico", "false"),
  'DIVIDER',
  new Array("Giant Report (ICAO)" , "window.parent.ProcessMenuChoice('http://g2wpridl2.enclave.federated.com/ridl2/ridl/scheduler.php3?REPORT_NAME=GIANT+REPORT&ICAO=%ICAO%&Submit=Run','MENU,ICAO,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=740,height=450,status,resizable,scrollbars');",libLoc + "/gph/rptGiantReport.ico", "false"),
  new Array("Mission Planner's Report (ICAO)" , "window.parent.ProcessMenuChoice('http://g2wpridl2.enclave.federated.com/ridl2/ridl/scheduler.php3?REPORT_NAME=MISSION+PLANNERS+REPORT&ICAO=%ICAO%&Submit=Run','MENU,ICAO,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=740,height=450,status,resizable,scrollbars');",libLoc + "/gph/rptAirfieldPlannersReport.ico", "false"),
  'DIVIDER',
  new Array("Weather Detail" , "window.parent.ProcessMenuChoice('/gdss2web/wx/wxDetail.php?ICAO_LIST=%ICAO%','MENU,ICAO,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=830,height=650,status,scrollbars,resizable');",libLoc + "/gph/wxDetail.ico", "false"),
  'DIVIDER');

  /* ATOC_Summary.xslt menus  */
  menuDefs['menu_10'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("JFACC AOR" , "window.parent.ProcessMenuChoice('ATOC_ICAOs.aspx?AORID=%AOR_ID%','MENU,AOR_ID','mmeDashboard,mmeMissionDashboard','.8*screen.width,.6*screen.height,status,resizable,scrollbars');",libLoc + "/gph/fmViewNotams.ico", "true"),
  new Array("JFACC UNIT" , "window.parent.ProcessMenuChoice('ATOC_Unit.aspx?AORID=%AOR_ID%','MENU,AOR_ID','mmeDashboard,mmeMissionDashboard','width=800,height=400,status,resizable,scrollbars');",libLoc + "/gph/fmViewNotams.ico", "false"),
  new Array("JFACC Airspace" , "window.parent.ProcessMenuChoice('ATOC_Airspaces.aspx?AORID=%AOR_ID%','MENU,AOR_ID','mmeDashboard,mmeMissionDashboard','width=800,height=400,status,resizable,scrollbars');",libLoc + "/gph/fmViewNotams.ico", "false"),
  new Array("TAC Info" , "window.parent.ProcessMenuChoice('ATOC_TACInfo.aspx?AORID=%AOR_ID%','MENU,AOR_ID','mmeDashboard,mmeMissionDashboard','width=800,height=400,status,resizable,scrollbars');",libLoc + "/gph/fmViewNotams.ico", "false"),
  new Array("Retrieve FrOB" , "window.parent.ProcessMenuChoice('?SCRIPT=GetCMDFROBConfirmation&AOR_ID=%AOR_ID%&FROB=%FROB%','MENU,AOR_ID,FROB','mmeDashboard,mmeMissionDashboard','width=400,height=150,left=600,top=350,status,scrollbars');",libLoc + "/gph/mmeReinstateItinStop.ico", "false"),
  'DIVIDER');

  menuDefs['menu_11'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("Recorrelate" , "window.parent.ProcessMenuChoice('?SCRIPT=GetCMDFROBConfirmation&AOR_ID=%AOR_ID%&CMD=%CMD%','MENU,AOR_ID,CMD','mmeDashboard,mmeMissionDashboard','width=400,height=150,left=600,top=350,status,scrollbars');",libLoc + "/gph/SW.ico", "false"),
  'DIVIDER');

  menuDefs['menu_12'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/fmShiftNote.ico", "false"),
  'DIVIDER',
  new Array("Add New Note" , "window.parent.ProcessMenuChoice('ATOC_AddEditNote.aspx?TYPE=ADD&AOR=%AOR_ID%&ABPID=%ABP_ID_Desc%','MENU,AOR_ID,ABP_ID_Desc','0','width=750,height=400,status,scrollbars');",libLoc + "/gph/fmShiftNote.ico", "true"),
  new Array("Display Notes" , "window.parent.ProcessMenuChoice('ATOC_DisplayNotes.aspx?AOR=%AOR_ID%&ABPID=%ABP_ID_Desc%','MENU,AOR_ID,ABP_ID_Desc','mmeDashboard,mmeMissionDashboard','width=750,height=400,status,scrollbars');",libLoc + "/gph/check.gif", "false"),
  'DIVIDER');

  menuDefs['menu_13'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("Add New Note" , "window.parent.ProcessMenuChoice('ATOC_AddEditNote.aspx?TYPE=ADD&AOR=%AOR_ID%&ABPID=%ABP_ID_Desc%','MENU,AOR_ID,ABP_ID_Desc','0','width=750,height=400,status,scrollbars');",libLoc + "/gph/fmShiftNote.ico", "true"),
  'DIVIDER');

  menuDefs['menu_20'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("View Missions" , "window.parent.ProcessMenuChoice('ATOC_TankerCorr.aspx?VIEW=1&MSN=2&AOR=%AOR_ID%&ABPID=%ABP_ID_DESC%&AORNAME=%AOR_NAME%&ATOCNG=%LASTATOCHANGENUMBER%','MENU,AOR_ID,ABP_ID_DESC,AOR_NAME,LASTATOCHANGENUMBER','0','width=1000,height=550,status,scrollbars');",libLoc + "/gph/SW.ico", "true"),
  'DIVIDER');

  menuDefs['menu_21'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("View Missions" , "window.parent.ProcessMenuChoice('ATOC_AirCorr.aspx?VIEW=0&MSN=2&AOR=%AOR_ID%&ABPID=%ABP_ID_DESC%&AORNAME=%AOR_NAME%&ATOCNG=%LASTATOCHANGENUMBER%','MENU,AOR_ID,ABP_ID_DESC,AOR_NAME,LASTATOCHANGENUMBER','0','width=1000,height=550,status,scrollbars');",libLoc + "/gph/SW.ico", "true"),
  'DIVIDER');

  menuDefs['menu_22'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("View Missions" , "window.parent.ProcessMenuChoice('ATOC_TankerMissions.aspx?GDSS=1&MSN=0&AOR=%AOR_ID%&ABPID=%ABP_ID_DESC%&AORNAME=%AOR_NAME%&ATOCNG=%LASTATOCHANGENUMBER%','MENU,AOR_ID,ABP_ID_DESC,AOR_NAME,LASTATOCHANGENUMBER','0','width=1000,height=550,status,scrollbars');",libLoc + "/gph/SW.ico", "true"),
  'DIVIDER');

  menuDefs['menu_23'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("View Missions" , "window.parent.ProcessMenuChoice('ATOC_AirliftMissions.aspx?GDSS=1&MSN=0&AOR=%AOR_ID%&ABPID=%ABP_ID_DESC%&AORNAME=%AOR_NAME%&ATOCNG=%LASTATOCHANGENUMBER%','MENU,AOR_ID,ABP_ID_DESC,AOR_NAME,LASTATOCHANGENUMBER','0','width=1000,height=550,status,scrollbars');",libLoc + "/gph/SW.ico", "true"),
  'DIVIDER');

  menuDefs['menu_24'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("View Missions" , "window.parent.ProcessMenuChoice('ATOC_TankerMissions.aspx?GDSS=0&MSN=1&AOR=%AOR_ID%&ABPID=%ABP_ID_DESC%&AORNAME=%AOR_NAME%&ATOCNG=%LASTATOCHANGENUMBER%','MENU,AOR_ID,ABP_ID_DESC,AOR_NAME,LASTATOCHANGENUMBER','0','width=1000,height=550,status,scrollbars');",libLoc + "/gph/SW.ico", "true"),
  'DIVIDER');

  menuDefs['menu_25'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("View Missions" , "window.parent.ProcessMenuChoice('ATOC_AirliftMissions.aspx?GDSS=0&MSN=1&AOR=%AOR_ID%&ABPID=%ABP_ID_DESC%&AORNAME=%AOR_NAME%&ATOCNG=%LASTATOCHANGENUMBER%','MENU,AOR_ID,ABP_ID_DESC,AOR_NAME,LASTATOCHANGENUMBER','0','width=1000,height=550,status,scrollbars');",libLoc + "/gph/SW.ico", "true"),
  'DIVIDER');

  /* Tanker correlated missions from Mission Search*/
  menuDefs['menu_30'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("Display Mission" , "window.parent.ProcessMenuChoice('ATOC_TankerCorr.aspx?MSN=2&AOR=%AOR_ID%&ABPID=%ABP_ID_DESC%&AORNAME=%AOR_NAME%&ATOCNG=%LASTATOCHANGENUMBER%&QF=%MSNNUMBER%','MENU,AOR_ID,ABP_ID_DESC,AOR_NAME,LASTATOCHANGENUMBER,MSNNUMBER','mmeDashboard,mmeMissionDashboard','width=1000,height=550,status,scrollbars');",libLoc + "/gph/mmeMissionDetail.ico", "true"),
  'DIVIDER');

  /* Airlift correlated missions from Mission Search*/
  menuDefs['menu_31'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("Display Mission" , "window.parent.ProcessMenuChoice('ATOC_AirCorr.aspx?MSN=2&AOR=%AOR_ID%&ABPID=%ABP_ID_DESC%&AORNAME=%AOR_NAME%&ATOCNG=%LASTATOCHANGENUMBER%&QF=%MSNNUMBER%','MENU,AOR_ID,ABP_ID_DESC,AOR_NAME,LASTATOCHANGENUMBER,MSNNUMBER','mmeDashboard,mmeMissionDashboard','width=1000,height=550,status,scrollbars');",libLoc + "/gph/mmeMissionDetail.ico", "true"),
  'DIVIDER');

  /* Tanker G2 only missions from Mission Search*/
  menuDefs['menu_32'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("Display Mission" , "window.parent.ProcessMenuChoice('ATOC_TankerMissions.aspx?MSN=0&AOR=%AOR_ID%&ABPID=%ABP_ID_DESC%&AORNAME=%AOR_NAME%&ATOCNG=%LASTATOCHANGENUMBER%&QF=%MSNNUMBER%','MENU,AOR_ID,ABP_ID_DESC,AOR_NAME,LASTATOCHANGENUMBER,MSNNUMBER','mmeDashboard,mmeMissionDashboard','width=1000,height=550,status,scrollbars');",libLoc + "/gph/mmeMissionDetail.ico", "true"),
  'DIVIDER');

  /* Airlift G2 only missions from Mission Search*/
  menuDefs['menu_33'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("Display Mission" , "window.parent.ProcessMenuChoice('ATOC_AirliftMissions.aspx?MSN=0&AOR=%AOR_ID%&ABPID=%ABP_ID_DESC%&AORNAME=%AOR_NAME%&ATOCNG=%LASTATOCHANGENUMBER%&QF=%MSNNUMBER%','MENU,AOR_ID,ABP_ID_DESC,AOR_NAME,LASTATOCHANGENUMBER,MSNNUMBER','mmeDashboard,mmeMissionDashboard','width=1000,height=550,status,scrollbars');",libLoc + "/gph/mmeMissionDetail.ico", "true"),
  'DIVIDER');

  /* Tanker TBM only missions from Mission Search*/
  menuDefs['menu_34'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("Display Mission" , "window.parent.ProcessMenuChoice('ATOC_TankerMissions.aspx?MSN=1&AOR=%AOR_ID%&ABPID=%ABP_ID_DESC%&AORNAME=%AOR_NAME%&ATOCNG=%LASTATOCHANGENUMBER%&QF=%MSNNUMBER%','MENU,AOR_ID,ABP_ID_DESC,AOR_NAME,LASTATOCHANGENUMBER,MSNNUMBER','mmeDashboard,mmeMissionDashboard','width=1000,height=550,status,scrollbars');",libLoc + "/gph/mmeMissionDetail.ico", "true"),
  'DIVIDER');

  /* Airlift TBM only missions from Mission Search*/
  menuDefs['menu_35'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("Display Mission" , "window.parent.ProcessMenuChoice('ATOC_AirliftMissions.aspx?MSN=1&AOR=%AOR_ID%&ABPID=%ABP_ID_DESC%&AORNAME=%AOR_NAME%&ATOCNG=%LASTATOCHANGENUMBER%&QF=%MSNNUMBER%','MENU,AOR_ID,ABP_ID_DESC,AOR_NAME,LASTATOCHANGENUMBER,MSNNUMBER','mmeDashboard,mmeMissionDashboard','width=1000,height=550,status,scrollbars');",libLoc + "/gph/mmeMissionDetail.ico", "true"),
  'DIVIDER');


/* Airspace Mission Detail display */
  menuDefs['menu_40'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("Airspace Detail ..." , "window.parent.ProcessMenuChoice('%URL%%ACMID%','MENU,URL,ACMID','mmeDashboard,mmeMissionDashboard','width=830,height=650,status,scrollbars,resizable');",libLoc + "/gph/mmeMissionDetail.ico", "true"),
  'DIVIDER');
 
  
  /* ATOC_ICAOs.xslt menus */
  menuDefs['menu_50'] = new Array(
  new Array("Copy" , "window.parent.ProcessMenuChoice('?SCRIPT=sysCopySelected','MENU,GRD_NM,PAGE_NM','mmeDashboard,mmeMissionDashboard','width=570,height=390,status,resizable');",libLoc + "/gph/EditCopy.ico", "false"),
  'DIVIDER',
  new Array("JFACC AOR" , "window.parent.ProcessMenuChoice('ATOC_ICAO_test.aspx?AORID=%AOR_ID%','MENU,AOR_ID,ICAO','mmeDashboard,mmeMissionDashboard','width=350,height=400,status,resizable,scrollbars');",libLoc + "/gph/fmViewNotams.ico", "true"),
  'DIVIDER');
}

function DoColSort(c,prefix) {
//debugger;
   if (!prefix) prefix = '';
   sd = document.getElementById(prefix+"sortDir");
   if (!sd) return;
   
   if (sd.value=="ascending") 
      sd.value = "descending";
   else
      sd.value = "ascending";
   sc = document.getElementById(prefix+"sortCol");
   if (sc.value != c) sd.value = "ascending";
   sc.value = c;
   if (document.forms[0].pgScrPos)
   	  document.forms[0].pgScrPos.value = '';
   if (c.replace(/^[\s]+/g,"") != '') {
   	// save grid expansion state
//   	saveGridExpansionState();
      document.forms[0].submit();
   }
}

/*  The following functions are used to create a Wait page                             */
/*  For Sending CMDs to G2 and TBM, the following functions are used                   */
/*    1. SendCMDConfirmation  called from an HTML input button                         */
/*    2. BeginPageWait        called from body/onLoad of aspx's XSLT                   */
/*    3. UpdateWaitProgress   called by BeginPageWait                                  */
/*    4. buildASM             called from body/onLoad of aspx's XSLT; sends form info  */
/*    5. closeResults         called from an input button of the XSLT                  */
/*  For Retrieving CMDs and FROBs, the following functions are used                    */
/*    1. GetCMDFROBConfirmation  called from a right click menu of ATOC_Functions.js   */
/*    2. BeginPageWait           called from body/onLoad of aspx's XSLT                */
/*    3. UpdateWaitProgress      called by BeginPageWait                               */
/*    4. buildCMDFrob            called from body/onLoad of aspx's XSLT                */
/*    5. closeResults            called from an input button of the XSLT               */

function SendCMDConfirmation(confirmQuestion,form,target) {
  response = confirm(confirmQuestion);
  if (response == true) {
    var topPx = .1*screen.height;
    var leftPx = screen.width - 320;
    var windowPosition = "width=300,height=50,left=" + leftPx + ",top=" + topPx;    

    var winName = form.name + "_win";
    var newURL = 'ATOC_ASM_Bulk.aspx?TARGET=' + target;
    window.open(newURL, winName, windowPosition);    
  } 
}

function GetCMDFROBConfirmation(aor_id,target) {
//debugger;
  var confirmQuestion;
  var topPx;
  var leftPx;
  if (target == 'CMD') {
    confirmQuestion = 'Are you sure you want to recorrelate?';
    topPx = .4*screen.height;
    leftPx = screen.width - 320;
  } else {
    confirmQuestion = 'Are you sure you want to retreive a Frob?';
    topPx = .7*screen.height;
    leftPx = screen.width - 320;
  }      

  response = confirm(confirmQuestion);
  if (response == true) {
    var winName = target + "_win";
    var newURL = 'ATOC_GetCMDFrob.aspx?AOR=' + aor_id + '&TARGET=' + target;
    var windowPosition = "width=300,height=50,left=" + leftPx + ",top=" + topPx;    
    window.open(newURL, winName, windowPosition);    
  } 
}

var iLoopCounter = 1;
var iMaxLoop = 5;
var iIntervalId;
function BeginPageWait() {
  iIntervalId = window.setInterval('iLoopCounter=UpdateWaitProgress(iLoopCounter, iMaxLoop)', 500);
}

function UpdateWaitProgress(iCurrentLoopCounter, iMaximumLoops) {
  iCurrentLoopCounter += 1;

  if (iCurrentLoopCounter <= iMaximumLoops) {
    Progress.innerText += ".";
    return iCurrentLoopCounter;
  } else {
    Progress.innerText = "";
    return 1;
  }
}

function buildASM() {
  var AMIDvalues = "";
  for (var i=0; i < opener.form2.chkASM.length; i++) {
    if (opener.form2.chkASM[i].checked && opener.form2.chkASM[i].value.length > 0) {
      document.frmASM.requestedAMIDs.value += opener.form2.chkASM[i].value + ",";
    }
  }
  //Remove the last comma
  document.frmASM.requestedAMIDs.value = document.frmASM.requestedAMIDs.value.replace(/,$/, "");
  document.frmASM.passThrough.value = 2;
  document.frmASM.submit();
}

function buildCMDFrob() {
  document.frmCMDFrob.passThrough.value = 2;
  document.frmCMDFrob.submit();
}

function closeResults() {
  if (window.opener && !window.opener.closed) {
    window.close()
    window.opener.location.reload()
  }
}