//this file controls the menus and submenus on each page of your website.
//if you make changes to these settings, they will be reflected on each page

Menu = new Array();
subMenu = new Array();
subSubMenu = new Array();

//== Menu Items
    addMenu("#000099", "#800000", "#FFFFFF", "#FFFFFF", "Home", "index.htm", "_top", 76, 45, "images/home_2.jpg")

    addMenu("#000099", "#800000", "#FFFFFF", "#FFFFFF", "Worship", "worship.htm", "_top", 79, 45, "images/worship.jpg")
      addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "I'm New", "i-am-new.htm", "_top")
      addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "Worship Ministry", "worship-ministry.htm", "_top")
      addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "Children's Choir", "childrens-choir.htm", "_top")

    addMenu("#000099", "#800000", "#FFFFFF", "#FFFFFF", "Connect", "connect.htm", "_top", 76, 45, "images/connect.jpg")
      addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "Preschool", "preschool.htm", "_top")
      addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "Kids", "kids.htm", "_top")
      addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "Students", "students.htm", "_top")
      addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "Singles", "singles.htm", "_top")
      addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "Adults", "adults.htm", "_top")
      addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "Softball", "softball.htm", "_top")

    addMenu("#000099", "#800000", "#FFFFFF", "#FFFFFF", "Believe", "believe.htm", "_top", 76, 45, "images/believe.jpg")
    	
    addMenu("#000099", "#800000", "#FFFFFF", "#FFFFFF", "Belong", "belong.htm", "_top", 71, 45, "images/belong.jpg")

    addMenu("#000099", "#800000", "#FFFFFF", "#FFFFFF", "About", "about.htm", "_top", 81, 45, "images/about3.jpg")
      addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "Photo Selections", "photos.htm", "_top")
      addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "Newsletter", "newsletter.htm", "_top")
      addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "Contact Us", "contact-us.htm", "_top")
      //addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "Announcements", "announcements.htm", "_top")
      addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "Calendar", "calendar.htm", "_top")
      addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "Mid-Week Schedule", "midweek-schedule.htm", "_top")
      addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "Our Staff", "staff.htm", "_top")
      addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "Church Directory", "church-directory.htm", "_top")
      addSubMenu("#71b1bb", "#FFFFFF", "#FFFFFF", "#71b1bb", "Service Times and Directions", "directions.htm", "_top")
    
    addMenu("#000099", "#800000", "#FFFFFF", "#FFFFFF", "Blank", "", "_top", 54, 45, "images/blank.jpg")


//== Configuration
var border = "#FFFFFF";
var menuWidth = 513;         // Width of entire menu. Use 0 for default
var cellPadding = 0;         // Cell Padding  
var borderWidth = 0;         // Border width (for no border, enter 0)  THIS VALUE APPLIES TO ALL MENUS  
var subMenuDelay = .1;        // Time sub menu stays visible for (in seconds). THIS VALUE APPLIES TO ALL MENUS
var fontDecoration = "none"  // Font decoration of all menu items (none, underline, overline)

// Main menu 
var mainIndicate = "none";  // Symbol to show if a sub menu is present.  For no symbol, enter "none" 
var fontFace = "Arial";      // Font of main menu items
var fontSize = "11pt";       // Font size of main menu items
var fontWeight = "normal"    // Font Weight of main menu items

// Level 1 sub menu
var sVerticalOffset = 0;     // Vertical offset of Sub Menu. (negative values move sub menu up) 
var sHorizontalOffset = 0;   // Horizontal offset of Sub Menu. (negative values move sub menu to the left) 
var subIndicate = "none";   // Symbol to show if a sub menu is present.  For no symbol, enter "none" 
var sfontFace = "Arial";     // Font of main menu items
var sfontSize = "9pt";      // Font size of main menu items
var sfontWeight = "bold";    // Font Weight of main menu items
var sTransparency = "100"    // Opacity of sub menus. 0 - 100.  (IE Only.)

//== End Configuration - Do not edit below this line


function addMenu(back,backH,font,fontH,title,url,target,width,height,background){
i = Menu.length;
  Menu[i] = new Array(back,backH,font,fontH,title,url,target,width,height,background); 
  subMenu[i] = new Array();
  subSubMenu[i] = new Array();
}

function addSubMenu(back,backH,font,fontH,title,url,target){
j = subMenu[i].length;
  subMenu[i][j] = new Array(back,backH,font,fontH,title,url,target)
  subSubMenu[i][j] = new Array();    
}


var timer; 

function showMenu(orientation){
  if(orientation==""){orientation=="horizontal"}
  buildMenu(orientation);
  buildSubMenu();
}


function buildMenu(orientation){
  build = '<table width="'+menuWidth+'" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="'+border+'"><tr><td><table border="0" cellpadding="0" cellspacing="'+borderWidth+'" width="100%""><tr>';
  for (x=0;x<Menu.length; x++){
    build += '<td width="'+Menu[x][7]+'" height="'+Menu[x][8]+'" nowrap="nowrap" style="cursor:hand" onclick="tdMouseClick(\'MenuLink'+x+'\')">';
    build += '<div align="center" id="Menu'+x+'" style="padding:'+cellPadding+'px" onMouseOver="clearTimer(); hideAll(\'main\'); showSubMenu(\'Menu\','+x+',\''+orientation+'\'); return true;" onMouseOut="timerHide(); ">';
    build += '<a href="'+Menu[x][5]+'"><img border="0" src="'+Menu[x][9]+'"<\/a><a id="MenuLink'+x+'" href="'+Menu[x][5]+'" target="'+Menu[x][6]+'" style="font-family:'+fontFace+';font-size:'+fontSize+';font-weight:'+fontWeight+';color:'+Menu[x][2]+';text-decoration:'+fontDecoration+'">'
    if(mainIndicate.toLowerCase()!="none" && subMenu[x].length>0){build += '<span style="padding-left:3px">'+mainIndicate+'<\/span>';}    
    build += '<\/a><\/div><\/td>';
    if(orientation.toLowerCase()=="vertical" && x<(Menu.length-1)){build += "<\/tr><tr>"}
  }
  build += '<\/tr><\/table><\/td><\/tr><\/table>';  
  document.writeln(build);
}

function buildSubMenu(){
  for(y=0; y<subMenu.length; y++){   
    buildSub = '<div id="Sub'+y+'" style="position:absolute; left:0; top:0; visibility:hidden">';
    if(subMenu[y].length>0){ 
      buildSub += '<table border="0" cellpadding="0" cellspacing="0" bgcolor="'+border+'" style="padding-right:1px;filter: alpha(Opacity='+sTransparency+')"><tr><td><table border="0" cellpadding="0" cellspacing="'+borderWidth+'" width="100%" align="center">';
      for(z=0; z<subMenu[y].length; z++){  
        buildSub += '<tr><td nowrap="nowrap" onclick="tdMouseClick(\'SubLink'+y+z+'\')" onMouseOver="clearTimer(); hideAll(\'sub\'); showSubSubMenu(\'Sub\','+y+','+z+'); return true;" style="cursor:hand"><div nowrap="nowrap" id="Sub'+y+z+'" style="cursor:hand;padding:'+cellPadding+'px; background-color:'+subMenu[y][z][0]+'" onMouseOut="timerHide()">';        
        buildSub += '<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center"><tr><td nowrap="nowrap"><a id="SubLink'+y+z+'" href="'+subMenu[y][z][5]+'" target="'+subMenu[y][z][6]+'" style="font-family:'+sfontFace+';font-size:'+sfontSize+';font-weight:'+sfontWeight+';color:'+subMenu[y][z][2]+';text-decoration:'+fontDecoration+'">'+subMenu[y][z][4]+'<\/a><\/div><\/td>';
        buildSub += '<td align="center" nowrap="nowrap" onclick="tdMouseClick(\'SubLink'+y+z+'\')" onMouseOver="clearTimer(); hideAll(\'sub\'); showSubSubMenu(\'Sub\','+y+','+z+'); return true;" style="cursor:hand; padding-right:'+cellPadding+'px">';
        if(subIndicate.toLowerCase()!="none" && subSubMenu[y][z].length>0){
          buildSub += subIndicate;
        }else{
          buildSub += "&nbsp;";
        }
        buildSub += '<\/td><\/tr><\/table><\/td><\/tr>';
      }
      buildSub += '<\/table><\/td><\/tr><\/table>';
    }
    buildSub += '<\/div>';
    document.write (buildSub)
  }
}

function showSubMenu(obj,id,orientation){
  document.getElementById(obj+id).style.backgroundColor=Menu[id][1];
  document.getElementById(obj+"Link"+id).style.color=Menu[id][3];
  getOffset(eval('document.getElementById("'+obj+id+'")'),"left")
  getOffset(eval('document.getElementById("'+obj+id+'")'),"top")
  getOffset(eval('document.getElementById("'+obj+id+'")'),"height")
  getOffset(eval('document.getElementById("'+obj+id+'")'),"width")
  vOff=(orientation.toLowerCase()=="vertical")?oWidth+borderWidth:0
  hOff=(orientation.toLowerCase()=="vertical")?oHeight+borderWidth:0
  document.getElementById("Sub"+id).style.left=oLeft-borderWidth+sHorizontalOffset+vOff+"px";
  document.getElementById("Sub"+id).style.top=oTop+oHeight+sVerticalOffset-hOff+"px";
  document.getElementById("Sub"+id).style.visibility="visible";
}

function showSubSubMenu(obj,id, subid){
  document.getElementById(obj+id+subid).style.backgroundColor=subMenu[id][subid][1];
  document.getElementById(obj+"Link"+id+subid).style.color=subMenu[id][subid][3];
  getOffset(eval('document.getElementById("'+obj+id+subid+'")'),"left")
  getOffset(eval('document.getElementById("'+obj+id+subid+'")'),"top")
  getOffset(eval('document.getElementById("'+obj+id+subid+'")'),"height")
  getOffset(eval('document.getElementById("'+obj+id+subid+'")'),"width")
}

function highlightSubSubMenu(id, subid, subsubid){
  document.getElementById("SubSub"+id+subid+subsubid).style.backgroundColor=subSubMenu[id][subid][subsubid][1];
  document.getElementById("SubSubLink"+id+subid+subsubid).style.color=subSubMenu[id][subid][subsubid][3];
}

function timerHide(level,id,subid){
  timer = setTimeout("hideAll()",(subMenuDelay*1000))
}

function clearTimer(){
  if(timer){clearTimeout(timer)}
}

// Hide all sub menu items, and recolor as required.
function hideAll(level){ 
  for(x=0;x<Menu.length; x++){
    if(level!="sub"&&level!="subsub"){
      document.getElementById("Menu"+x).style.backgroundColor=Menu[x][0]
      document.getElementById("MenuLink"+x).style.color=Menu[x][2];
    }
    for(y=0;y<subMenu[x].length; y++){
      if(subSubMenu[x][y].length>0){
        if(level!="subsub"){document.getElementById("SubSub"+x+y).style.visibility="hidden";}
        for(z=0; z<subSubMenu[x][y].length; z++){
          document.getElementById("SubSub"+x+y+z).style.backgroundColor=subSubMenu[x][y][z][0]
          document.getElementById("SubSubLink"+x+y+z).style.color=subSubMenu[x][y][z][2]
        }
      }
      if(level!="subsub"){
        document.getElementById("Sub"+x+y).style.backgroundColor=subMenu[x][y][0]
        document.getElementById("SubLink"+x+y).style.color=subMenu[x][y][2]}
    }
    if(level!="sub"&&level!="subsub"){document.getElementById("Sub"+x).style.visibility="hidden";}
  }
}


// Find positioning for sub menus
function getOffset(obj, dim) {
  if(dim=="left") 
  {     
    oLeft = obj.offsetLeft;  
    while(obj.offsetParent!=null) 
    {    
      oParent = obj.offsetParent     
      oLeft += oParent.offsetLeft 
      obj = oParent 	
    }
    return oLeft
  }
  else if(dim=="top")
  {
    oTop = obj.offsetTop;
    while(obj.offsetParent!=null) 
    {
      oParent = obj.offsetParent
      oTop += oParent.offsetTop
      obj = oParent 	
    }
    return oTop
  }
  else if(dim=="width")
  {
    oWidth = obj.offsetWidth
    return oWidth
  }  
  else if(dim=="height")
  {
    oHeight = obj.offsetHeight
    return oHeight
  }    
  else
  {
    alert("Error: invalid offset dimension '" + dim + "' in getOffset()")
    return false;
  }
}


// when you click the box, perform the same function as if the user had clicked the hyperlink
function tdMouseClick(theElement)
{
  if(document.getElementById && document.all){document.getElementById(theElement).click();}
}

