/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  w3a.js
  site-specific functions

  Michael Foster, December 8, 2000
  mfoster@cybrtyme.com
  http://lineoflight.com/

  originally mikefoster.f2s.com
*/


window.onload = init;

// Global CrossBrowserElement Objects:
var slideMenu;

//-----------------------------------------------------------------------------
// onLoad event handler.

function init()
{
  slideMenu = new CrossBrowserElement('slideMenu');
  
  if (is.nav4) {          // exclude Moz
    slideMenu.setLeft(18);
    window.onresize = regen;
  }
  else {
    slideMenu.setLeft(10);
    window.onscroll = controlSlideMenu;
  }

  
  slideMenu.setTop(276);
  slideMenu.show();
  slideMenu.ySpeed = .2;
  controlSlideMenu();

  if (window.demoInit) {
    demoInit();
  }

  window.defaultStatus = "Commencement 2007";
}

//-----------------------------------------------------------------------------
// onResize event handler for NN4.
// I added regen() to solve the NN4 crashing problem. This has something to do
// with what NN4 does after a window resize... still unsure about this.

function regen()
{
  window.location.reload();
}

//-----------------------------------------------------------------------------
// Functions for the creation and operation of the listbox navigation menu.

function navMenuGo()
{
  var _url = document.forms.navForm.navMenu.options[document.forms.navForm.navMenu.selectedIndex].value;
  if ( _url != "") {
    document.location.href = _url;
  }
}



//-----------------------------------------------------------------------------
// This function is the onScroll event handler (in IE). It calculates the 
// slide target and calls the object's slide method.



function controlSlideMenu()
{
  var topOfClientArea = getScrollY();
  
  var maxheight = document.getElementById("sidecol").clientHeight;
  var menuheight = document.getElementById("slideMenu").clientHeight;
  var footerheight = document.getElementById("footerside").clientHeight;
  
  
  if (is.nav4up || is.opera) {
  	if (topOfClientArea > 255 && topOfClientArea<maxheight-menuheight-footerheight-40){
  	slideMenu.slideToY(topOfClientArea);
	}
	if (topOfClientArea > (maxheight-menuheight-40)){
	slideMenu.slideToY(maxheight-menuheight-60);
  	}
  }else {
  if (topOfClientArea > 255 && topOfClientArea<maxheight-menuheight-footerheight-20){
  	slideMenu.slideToY(topOfClientArea );
  }
  }
  
  if (topOfClientArea < 256){
  slideMenu.slideToY(255);
  }

  if (is.nav4up || is.opera) {
    setTimeout("controlSlideMenu()",250);
  }
}



// End w3a.js
