/*  Copyright © 2001, 2002 OGMA Consulting Corp. */
// this array contains the names of all the menus
var _context_menus_      = [
                           "programHome",
                           "logon",
                           "register",
                           "browseOpp",
                           "contactUs",
                           "catalogueBrowse",
                           "sourcing",
                           "selfRegister",
                           "companyInfo",
                           "openTenders",
                           "bidResults",
                           "extPersMaint",
                           "userInfo",
                           "reporting",
                           "administration",
                           "doc",
                           "todo",
                           "rqn",
                           "tender",
                           "notice",
                           "po",
                           "document",
                           "contactInfo",
                           "commentClause",
                           "amend"
                           ];
var _context_menu_items_ = [
                           "tableMaint", "helpMaint", "onlineManualMaint", "orgMaint", "personMaint", "projectMaint", "IECResend", "export", "export2OPS", "import", "catalogueMaint", "clauseMaint", "placeMaint", "zoneMaint", "cacheMaint", "systemMaint", "sysObjMaint", "vendorMaint", "vendorBatch", "broadcastEmail", "emailInfo", "emailDocLog", "eventLog", "importInterested", "superUser",
                           "initReports", "searchReports",
                           "draftBid", "currentBid", "historicalBid", "emailNotices", "watchList",
                           "docSearch", "toDo", "awardMaint",
                           "rqnPurch", "rqnStores", "rqnPrint",
                           "noticeStd", "tenderItq", "tenderItt",
                           "poStd", "poService", "poSO", "poMasterSO", "poDD",
                           "userMaint", "productInfo", "locationInfo", "eServices",
                           "vendorSearch", "productSearch", "locationSearch", "bidDetailsSearch", "reviewList",
                           "DocNumber", "NoticeType", "DocDates", "AdmAddr", "DelAddr", "Invited_Interested", "Print", "Download", "InternalDownload",
                           "DownloadHistory", "Comment_Usr", "Comment_Hdr", "Clauses", "Items", "ClausesTrailer", "Comment_Tlr", "SugSourceSupply",
                           "TenderResults", "MultipleCommodity", "Location", "FinData", "ToContact", "Charges", "Password",
                           "priorAmend","nextAmend","doAmend",
                           "officeInfo", "mgmtFin", "bidDetails", "labourRel", "qualMgmt", "corpHead", "parentCo", "affiliates", "salesRep", "plantQA", "projectList"
                           ];

function showContextMenu(frameName, menuName, defaultMenuItem, imagePath) {

  for (var i = 0; i < _context_menus_.length; i++) {
    var img  = getImgByName(_context_menus_[i] + "Img");
    var elem = document.getElementById(_context_menus_[i] + "Link");

    if (_context_menus_[i] != menuName) {

      if (img == null) {

        //

      } else {

        img.src = "../images/spacer.gif";

        if (elem == null) {

          //

        } else {

          elem.className = "navSub";
        }
      }

      hide(_context_menus_[i]);

    } else {

      if (img == null) {
        //

      } else {

        img.src = "../" + imagePath + "nav_current.gif";

        if (elem == null) {

          //

        } else {

          elem.className = "navSubOn";
        }
      }

      show(_context_menus_[i]);
    }
  }

  contextMenuUnSelectAll();
  contextMenuSelect(defaultMenuItem, imagePath);
}

function showRemoteContextMenu(frame, menuName, defaultMenuItem, imagePath) {

  for (var i = 0; i < _context_menus_.length; i++) {

    var img  = getRemoteImgByName(frame, _context_menus_[i] + "Img");
    var elem = frame.document.getElementById(_context_menus_[i] + "Link");

    if (_context_menus_[i] != menuName) {

      if (img == null) {

        //

      } else {

        img.src = "../images/spacer.gif";

        if (elem == null) {

          //

        } else {

          elem.className = "navSub";
        }
      }

      hideRemote("parent." + frame.name, _context_menus_[i]);

    } else {

      if (img == null) {

        //

      } else {

        img.src = "../" + imagePath + "nav_current.gif";

        if (elem == null) {

          //

        } else {

          elem.className = "navSubOn";
        }
      }

      showRemote("parent." + frame.name, _context_menus_[i]);
    }
  }

  //contextMenuUnSelectAll();
  //contextMenuSelect(defaultMenuItem);
}

function hideAllContextMenus() {

  for (var i = 0; i < _context_menus_.length; i++) {

    hide(_context_menus_[i]);
  }
}

function showContextMenuSelect(menuItemName, imagePath) {

  for (var i = 0; i < _context_menu_items_.length; i++) {

    var img = getImgByName(_context_menu_items_[i] + "Img");

    if (img == null) {

      //

    } else {

      if (_context_menu_items_[i] != menuItemName) {

        img.src = "../images/spacer.gif";

      } else {

        img.src = "../" + imagePath + "context_menu_select.gif";
      }
    }
  }
}

function showRemoteContextMenuSelect(frame, menuItemId, imagePath) {

  for (var i = 0; i < _context_menu_items_.length; i++) {

    var img = getRemoteImgByName(frame, _context_menu_items_[i] + "Img");

    if (img == null) {

      //

    } else {

      if (_context_menu_items_[i] != menuItemId) {

        img.src = "../images/spacer.gif";

      } else {

        img.src = "../" + imagePath + "context_menu_select.gif";
      }
    }
  }
}



function contextMenuUnSelectAll() {

  for (var i = 0; i < _context_menu_items_.length; i++) {

    var img = getImgByName(_context_menu_items_[i] + "Img");

    if (img == null) {

      //

    } else {

      img.src = "../images/spacer.gif";
    }
  }
}

function contextMenuSelect(menuItemName, imagePath) {

  var img = getImgByName(menuItemName + "Img");

  if (img == null) {

    //

  } else {

    img.src = "../" + imagePath + "nLeft_blue_arrow.gif";
  }
}
