/* Menu */
function MenuLocation(){
/* Menu Captions - T1 is upper, largest T10 is bottom link call presented on the actual menu.
   If no text appears between the "" (quotation marks) the actual  menu doesn't display a position.
   Maximum text length is approx 23 characters. */
    T1 = "Homepage";
    T2 = "History";
    T3 = "Church Leadership";
    T4 = "Around The Parish";
    T5 = "Reflections";
    T6 = "Recommended Links";
    T7 = "Windows of St. James";
    T8 = "Our Parish Family";
				T9 = "";
				T10 = "";

/* L1  is uppermost link call, L10 is bottom link call presented on the actual menu.  
   If a menu position is unused use ## for the link call.
   Note that the url must be inside quotation marks. */
  L1 = "index.html";
  L2 = "history.html";
  L3 = "leaders.html";
  L4 = "parish.html";
  L5 = "reflct.html";
  L6 = "recLks.html";
  L7 = "window.html";
  L8 = "family.html";
		L9 = "##";
		L10 = "##";


/* Desired Presentation Size of Menu Image in pixels on a 1024 page. W is width desired on a 1024 page, H is 
   height desired on a 1024 page.  
   Note:  Size Values must be inside "". */
  W = "102";
		H = "69";



/**********************************************************************************************/
/* !!!!!!!!!!!!!!!!!!!!!!!!!   do not alter below here    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
/**********************************************************************************************/
/*  Menubutton picture size control  */
if (window.screen.width  <= 800){W=W*0.77; H=H*0.77}
if ((window.screen.width  >= 1024) && (window.screen.width  < 1280)){W=W; H=H;}
if ((window.screen.width  >= 1280) && (window.screen.width  < 1600)){W=W*1.25; H=H*1.25;}
if (window.screen.width  >= 1600){W=W*1.56; H=H*1.56;}


document.write(
'<div id="menucontainer">',
'<div id="menu">',
'<div class="menubutton"> ',
'<a href="##" class="menubutton" style="padding:0";>',
'<img src="images/SiteLoc.jpg" width='+W+' height='+H+' border="0"></a>',
'<div class="submenu">',
'<a href='+L1+' class="submenu">'+T1+'</a>',
'<a href='+L2+' class="submenu">'+T2+'</a>',
'<a href='+L3+' class="submenu">'+T3+'</a>',
'<a href='+L4+' class="submenu">'+T4+'</a>',
'<a href='+L5+' class="submenu">'+T5+'</a>',
'<a href='+L6+' class="submenu">'+T6+'</a>',
'<a href='+L7+' class="submenu">'+T7+'</a>',
'<a href='+L8+' class="submenu">'+T8+'</a>',
'<a href='+L9+' class="submenu">'+T9+'</a>',
'<a href='+L10+' class="submenu">'+T10+'</a>',
'</div>',
'</div>',
'</div>',
'</div>')

}        /* end of MenuSetUp */



/* Menu Control 2 */

var MENU_CLASS       = "menubutton";
var MENUON           = "menubuttonon";
var MENUOFF          = "menubuttonoff";
var SUBMENU_CLASS    = "submenu";

var TIMEOUT_DURATION = 300;
var hideTimeoutPtr;

var menuArray        = new Array();
var subMenuArray     = new Array();
var conMenuArray     = new Array();

/* mouseactivator   Activates menu buttons for mouse events. */
function menuactivator(){
  if(document.getElementById){
    var tmp_array;
    var parent_elem;
    var namecount = 0;

    tmp_array = document.getElementsByTagName("A");       // Get <a>'s
    for(var i=0;i<tmp_array.length;i++){                  // Get All Of The Menu Buttons
      tmp_elem = tmp_array[i];
      if(tmp_elem.className.indexOf(MENU_CLASS) != -1){   // Set An ID For The Menu Buttons
        tmp_elem               = tmp_array[i];
        tmp_elem.id            = MENU_CLASS+namecount;
        tmp_elem.onmouseover   = function(){
					                         hideMenu('all');
																	 window.clearTimeout(hideTimeoutPtr);
																	 showSubMenu(this.id);
																	 highlightMenu(this.id,'on');
																 };
        tmp_elem.onmouseout    = function(){
					                         window.clearTimeout(hideTimeoutPtr);
																	 if (conMenuArray[this.id]){
																	   hideTimeoutPtr=hideTimeout('all',TIMEOUT_DURATION);
			  													 }
				  												 else {
					  												 hideTimeoutPtr=hideTimeout('all',0); 
						  										 };
																 };
        tmp_elem.onfocus       = function(){this.onmouseover();};
        tmp_elem.onblur        = function(){this.onmouseout();};
        menuArray[menuArray.length] = tmp_elem;
        // Name The Menu Button Container
        if (tmp_elem.parentNode){   // Using for IE
		      tmp_elem.parentNode.note = MENU_CLASS+namecount;
        }
        namecount++;
      }
    }

    tmp_array = document.getElementsByTagName("DIV");  // Get DIV Tags
    namecount = 0;
    for(var i=0;i<tmp_array.length;i++){                   // Get All Sub-Menus
      if(tmp_array[i].className.indexOf(SUBMENU_CLASS) != -1){
        tmp_elem = tmp_array[i];
        if(tmp_elem){
          tmp_elem.id = SUBMENU_CLASS+namecount;
          subMenuArray[subMenuArray.length] = tmp_elem;
          tmp_elem.onmouseover=function(){
						window.clearTimeout(hideTimeoutPtr);
		 	    };
          tmp_elem.onmouseout   =  function(){
	  	                               window.clearTimeout(hideTimeoutPtr);
		  			  								       hideTimeoutPtr=hideTimeout('all',TIMEOUT_DURATION);
			  			  						       };
          tmp_elem.onfocus      =  function(){this.onmouseover();};
          tmp_elem.onblur       =  function(){this.onmouseout();};
          if (tmp_elem.parentNode){           
            if (tmp_elem.parentNode.note){
              conMenuArray[tmp_elem.parentNode.note] = SUBMENU_CLASS+namecount;
            }
          }
          namecount++;
        }
      }
    }
  }
}

/* highlight Buttons */
function highlightMenu(menuID,onOff){
  var menuHead = document.getElementById(menuID);
  if(menuHead){
    if (onOff == "on")
      menuHead.className = MENUON;
    else if (onOff == "off")
      menuHead.className = MENUOFF;
    }
}

/* show Sub Menu */
function showSubMenu(menuID){
  hideMenu('all'); // First Hide All Of The Menus
  if (conMenuArray[menuID]){
    var subMenu = document.getElementById(conMenuArray[menuID]);
    if (subMenu)
      subMenu.style.display = 'block'; // Change Menu Display To 'block'
  }
}


/* hide Sub Menu */
function hideMenu(menuID){
  if(menuID == 'all'){
    for (var i=menuArray.length-1; i>=0; i--) {
      menuHead = menuArray[i];
      if(menuHead)
        highlightMenu(menuHead.id,'off');
    }
    for (var i=subMenuArray.length-1; i>=0; i--){
      subMenu = subMenuArray[i];
      if(subMenu)
        subMenu.style.display = 'none'; // Change Menu Display To 'none'
    }
  }
  else{
    subMenu = document.getElementById(menuID);
    if(subMenu)
      subMenu.style.display = 'none'; // Change Menu Display To 'none'
  }
}


/* sets timeout delay on mouse out */
function hideTimeout(menuID,mSecs){
  var ptr;
  eval('ptr=setTimeout ("hideMenu(\'' + menuID + '\')",' + mSecs + ')');
  return ptr;
}


