﻿// JScript File

var moMenu;

var moAbt;
var moPEO;
  
function buildMenus(){
  moAbt = new sciMenu( 'sciAboutSCI', 175, 111, 65);
  moPEO = new sciMenu( 'sciPEOabc', 200, 111, 65);
  
  var aTxt = new Array();
  var aLnks = new Array();
 
  //SETUP THE ABOUT SCI MENU 
  aTxt[0] = "Vision, Mission & Values";
  aTxt[1] = "Leadership Team";
  aTxt[2] = "Technology";
  aTxt[3] = "Milestones";
  aTxt[4] = "Careers";
  aTxt[5] = "Alliances";
  aTxt[6] = "Community Involvement";
  
  aLnks[0] = "/AboutUs/vision.aspx";
  aLnks[1] = "/AboutUs/ManagementTeam/HenryHardin.aspx";
  aLnks[2] = "/AboutUs/Technology.aspx";
  aLnks[3] = "/AboutUs/Milestones.aspx";
  aLnks[4] = "/AboutUs/Careers.aspx";
  aLnks[5] = "/AboutUs/Alliances.aspx";
  aLnks[6] = "/AboutUs/CommunityInvolvement.aspx";
 
  moAbt.loadItems(aTxt, aLnks);
  
  //SETUP THE PEO & CO-EMPLOYMENT MENU
  aTxt[0] = "Login";
  aTxt[1] = "What is a PEO?";
  aTxt[2] = "Client Testimonials";
  aTxt[3] = "HR Resource Center";
  aTxt[4] = "FAQs";
  aTxt[5] = "SCI:  The Industry Leader";
  aTxt[6] = "Human Capital Development";
  aTxt[7] = "HR Administration";
  aTxt[8] = "Employment Practices Liability Insurance";
  aTxt[9] = "Employee Benefits";
  aTxt[10] = "Workers' Compensation";
  aTxt[11] = "Payroll Administration";
  aTxt[12] = "SCI Flex Benefit";
  aTxt[13] = "News & Events";
  
  aLnks[0] = "https://www.scionesource.com";
  aLnks[1] = "http://peo.scicompanies.com/WhatIsPEO/WhatIsPEO.aspx";
  aLnks[2] = "http://peo.scicompanies.com/Testimonials/letters.aspx";
  aLnks[3] = "http://peo.scicompanies.com/HRResCtr/Welcome.aspx";
  aLnks[4] = "http://peo.scicompanies.com/FAQ/FAQs.aspx";
  aLnks[5] = "http://peo.scicompanies.com/Misc/IndustryLeader.aspx";
  aLnks[6] = "http://peo.scicompanies.com/Misc/HmnCptlDvlpmnt.aspx";
  aLnks[7] = "http://peo.scicompanies.com/Misc/HRAdmnstrtn.aspx";
  aLnks[8] = "http://peo.scicompanies.com/Misc/EPLI.aspx";
  aLnks[9] = "http://peo.scicompanies.com/Misc/EmplyBnfts.aspx";
  aLnks[10] = "http://peo.scicompanies.com/Misc/WrkrsCmpnstn.aspx";
  aLnks[11] = "http://peo.scicompanies.com/Misc/PyrllAdmnstrtn.aspx";
  aLnks[12] = "http://peo.scicompanies.com/eflexgroup/flxgrpbnfts.aspx";
  aLnks[13] = "http://www.scicompanies.com/NewsEvents/NwsEvnts.aspx";
  
  moPEO.loadItems(aTxt, aLnks);
  
}
  
  
  function ShowMenu(MenuType, pObj){
    /*
try{
      moMenu.runtimeStyle.display = "none";
    }catch(err){
      //do nothing this error is expected the first time
    }
    try{
      var aPos;
      aPos = findPos(pObj);
      switch(MenuType){
        case 'AboutSCI':
          moMenu = moAbt.Menu;
          moMenu.runtimeStyle.left = (aPos[0] + 1) + 'px';
          moAbt.show();
          //alert(2);
          break;
        case 'PEOEmployment':
          moMenu = moPEO.Menu
          moMenu.runtimeStyle.left = (aPos[0] - 25) + 'px';
          moPEO.show();
          break;
        default:
          return false;
          break;
      }
    }catch(err){
      //do nothing if we cannot show the menu it is no big deal
    }
*/
  }
  
  function HideMenu(){
    var oTmp;
    try{
      moMenu.runtimeStyle.display = "none";
    }catch(err){
      //do nothing this error is expected the first time
    }
  }
  
  function Menu_OnMouseOver(pObj, ObjTId){
    try{
      pObj.runtimeStyle.padding = "0px";
      pObj.runtimeStyle.border = "solid 1px #F6E1CE";
      document.getElementById(ObjTId).runtimeStyle.color = "#004485";
      pObj.runtimeStyle.backgroundColor = "#F6E1CE";
    }catch(err){
      alert('Menu_OnMouseOver::' + err.description);
    }
  }
  
  function Menu_OnMouseOut(pObj, ObjTId){
    try{
      pObj.runtimeStyle.padding = "1px";
      pObj.runtimeStyle.border = "none";
      document.getElementById(ObjTId).runtimeStyle.color = "white";
      //pObj.runtimeStyle.border = "solid 1px transparent";
      pObj.runtimeStyle.backgroundColor = "";
    }catch(err){
      alert('Menu_OnMouseOut::' + err.description);
    }
  }
  
function sciMenu(ID, Width, Top, Left){
  this.Menu = document.createElement('<div id="' + ID + '" style="z-index:150;" onmouseover="JavaScript:window.event.cancelBubble = true;">');
  this.id = ID;
  this.width = Width;
  
  document.body.appendChild(this.Menu);
  
  try{
    this.Menu.runtimeStyle.paddingTop = "1px";
    this.Menu.runtimeStyle.display = "none";
    this.Menu.runtimeStyle.position = "absolute";
    this.Menu.runtimeStyle.top = (Top + 'px') ;
    this.Menu.runtimeStyle.left = (Left + 'px');
  }catch(err){
    alert(err.description);
  }
    
  this.getItem = function(Index){
    return Index;
  }
    
  this.loadItems = function(saText, saLinks){
    var sMenu;
    var iIndex;
    var sLink;
    var sMOvr;
    var sMOut;
    
    sMenu = '<table cellpadding="0" cellspacing="0" border="0" class="SCISubMenus"><tr><td style="padding:1px;">';
    sMenu = sMenu + '<table cellpadding="0" cellspacing="0" border="0" style="width:' + this.width + 'px;">';
    
   for (iIndex in saText){
      sMenu = sMenu + '<tr>';
      sLink = "JavaScript:document.location.href='" + saLinks[iIndex] + "';";
      sMOvr = "JavaScript:Menu_OnMouseOver(this, 'mnu" + this.id + iIndex + "');";
      sMOut = "JavaScript:Menu_OnMouseOut(this, 'mnu" + this.id + iIndex + "');";
      sMenu = sMenu + '<td style="height:22px;cursor:pointer;padding:1px;" onmouseover="' + sMOvr + '" onmouseout="' + sMOut + '" onclick="' + sLink + '" >';
      sMenu = sMenu + '<table cellpadding="0" cellspacing="0" border="0" style="height:22px;" class="SiteText">';
      sMenu = sMenu + '<tr>';
      sMenu = sMenu + '<td style="width:14px;"></td>';
      sMenu = sMenu + '<td id="mnu' + this.id + iIndex + '" class="FntMnu">' + saText[iIndex] + '</td>';
      sMenu = sMenu + '</tr>';
      sMenu = sMenu + '</table>';
      sMenu = sMenu + '</td>';
      sMenu = sMenu + '</tr>';
    }

    sMenu = sMenu + '</table></td></tr></table>';
    this.Menu.innerHTML = sMenu;
  }
 
  this.show = function(){
    //alert(this.Menu.outerHTML);
    this.Menu.runtimeStyle.display = "block";
  }
}  

function findPos(obj) {
  var curleft = curtop = 0;
  if (obj.offsetParent){
    do {
      curleft += obj.offsetLeft;
      curtop += obj.offsetTop;
    } while (obj = obj.offsetParent);
  }
  return [curleft,curtop];
}