/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  folk2.js
  site-specific functions
  
  Original written by:
  Michael Foster, December 8, 2000
  mfoster@cybrtyme.com
  http://lineoflight.com/

  originally mikefoster.f2s.com
*/


// window.onload = init;

// Global CrossBrowserElement Objects:
 var slideMenu;
 var slideTitle;

//-----------------------------------------------------------------------------
// onLoad event handler.

function init()
{
  slideMenu = new CrossBrowserElement('slideMenu');
  slideTitle = new CrossBrowserElement('slideTitle');
  
  if (is.nav4) {          // exclude Moz
    slideMenu.setLeft(20);
    slideTitle.setTop(12);
    window.onresize = regen;
  }
  else {
    slideMenu.setLeft(12);
    slideTitle.setTop(4);
    window.onscroll = controlSlideMenu;
  }

  slideTitle.setLeft(2000);
  slideTitle.show();
  slideTitle.xSpeed = .3;
  slideTitle.slideToX(0);

  
  slideMenu.setTop(6000);
  slideMenu.show();
  slideMenu.ySpeed = .4;
  controlSlideMenu();

  if (window.demoInit) {
    demoInit();
  }

  window.defaultStatus = "Thanks For Visiting the Folklore Program!";
}

//-----------------------------------------------------------------------------
// 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;
  }
}

function createNavMenu()
{
  document.write(
     "<div class='w3aBody'>                                             "
    +"  <form name='navForm'>                                           "
    +"    <select name='navMenu' size='1'>                              "
    +"      <option selected>Navigation Menu</option>                   "
    +"      <option value='index.html'>  Home</option>                    "
    +"      <option value='links.html'>  Links</option>                   "
    +"      <option value='downloads.html'>  Files</option>                   "
    +"      <option value='demos.html'>  Demos</option>                   "
    +"      <option value='mouse_position.html'>    Mouse Position</option> "
    +"      <option value='dyn_bkgnd.html'>    Dynamic Backgrounds</option> "
    +"      <option value='keyboard.html'>    Keyboard Events</option>      "
    +"      <option value='random_banners.html'>    Random Banners</option> "
    +"      <option value='popup_menu.html'>    Popup Menu</option>         "
    +"      <option value='listbox_menu.html'>    Listbox Menu</option>     "
    +"      <option value='sniffer_jr.html'>    Client Sniffer Jr.</option> "
    +"      <option value='positioned_layers.html'>    Positioned Layers</option> "
    +"      <option value='sliding_menu.html'>    Sliding Menu</option> "
    +"      <option value='sliding_objects.html'>    Sliding Objects</option> "
    +"      <option value='cbe.html'>    CrossBrowserElement</option> "
    +"      <option value='status_onmouseover.html'>    StatusBar OnMouseOver</option> "
    +"      <option value='simulated_border.html'>    Border OnMouseOver</option> "
    +"    </select>                                                     "
    +"    <input type='button' value='Go' onclick='navMenuGo();'>       "
    +"  </form>                                                         "
    +"</div>                                                            "
  );
}

//-----------------------------------------------------------------------------

function createSlideTitle()
{
   var m = "<div id='slideTitle'>"
   m += "<table width='100%' border='0' cellpadding='0' cellspacing='0'>"
    +"<tr align='right'>"
    +"<td height='34' bgcolor='#000000'><a href='index.htm' target='_self'><img src='folk-word.gif' border='0' width='157' height='22' align='left'></a></td>"
    +"<td width='42%' bgcolor='#000000' height='34'><a name='head'></a>&nbsp;</td>"
    +"<td width='33%' height='34' bgcolor='#000000'><a href='http://www.wisc.edu' target='new'><img src='uw-word.gif' border='0' width='256' height='22'></a></td>"
    +"</tr></table><br><br>";
   m += "</div>";
   document.write(m);
}

function createSlideMenu(thisPage)
{
  var m = "<div id='slideMenu' class='text0'>";
  if (thisPage == 'Home') m += "w3a<br><br>";
  else m += "<img src='menu.gif' width='172' height='185' border='0' usemap='#Menumap'>";
    m += "<br><a href='#head' target='_self'><img src='Top.gif' border='0'></a>";
    m += "<map name='Menumap'>";
    m += "<area shape='rect' coords='0,1,166,21' href='About.htm' target='_self'alt='About the Program'>";
    m += "<area shape='rect' coords='2,24,137,45' href='News_Events.htm' target='_self' alt='News and Events'>";
    m += "<area shape='rect' coords='1,46,133,71' href='Faculty.htm' target='_self' alt='Faculty and Staff'>";
    m += "<area shape='rect' coords='2,73,117,94' href='Partnerships.htm' target='_self' alt='Partnerships'>";
    m += "<area shape='rect' coords='3,95,103,118' href='Contactus.htm' target='_self' alt='Contact Us'>";
    m += "<area shape='rect' coords='2,119,102,143' href='Collections.htm' target='_self' alt='Collections'>";
    m += "<area shape='rect' coords='1,144,81,167' href='Courses.htm' target='_self' alt='Courses'>";
    m += "<area shape='rect' coords='2,168,49,184' href='Links.htm' target='_self' alt='Links'>";
    m += "</map>";
    m += "</div>";
  
 document.write( m );
}
//-----------------------------------------------------------------------------
// This function is the onScroll event handler (in IE). It calculates the 
// slide target and calls the object's slide method.

var slideMenuOffsetTop=60;

function controlSlideMenu()
{
  var topOfClientArea = getScrollY();

  slideMenu.slideToY(topOfClientArea + slideMenuOffsetTop);

  if (is.nav4up || is.opera) {
    setTimeout("controlSlideMenu()",250);
  }
}

 function createFooter(updateDate)
 {
   document.write ("<div id='footer'>"
     +"<table width='800' border='0' align='center' cellpadding='0' cellspacing='0' bgcolor='#000000'>"
     +"<tr><td width='33%'><a href='mailto:sjziemen@wisc.edu' class='aSmall'>Accessibility questions</a></td>"
    +"<td width='33%' align='middle' class='small'>Last updated " + updateDate + " </td>"
    +"<td align='right' class='small'><a href='mailto:sjziemen@wisc.edu' class='aSmall'>Contact Webmaster</a></td></tr></table>"
    +"</div>"
 );  

 }

// End folk2.js
