
var ns = (navigator.appName.indexOf('Netscape')>-1);
var ie = (navigator.appName.indexOf('Microsoft Internet Explorer')>-1);
var scapeMenuItems = new Array(
   ["Beautiful Landscape", "arizona_afternoon.html", "Arizona Afternoon"],
   ["Utah", "canyon_lake.html", "Dark Canyon Lake"],
   ["Grand Canyon", "looking_north.html", "Looking North"],
   ["Grand Canyon", "canyon_snow.html", "Grand Canyon Tree"],
   ["Beautiful Landscape", "the_road.html", "The Road"],
   ["Utah", "the_arch.html", "The Arch"],   
   ["Beautiful Landscape", "the_look_out.html", "The Lookout"],
   ["Utah", "the_rock.html", "The Rock"],
   ["Beautiful Landscape", "three_sisters.html", "Three Sisters Utah"],
   ["Beautiful Landscape", "monument_valley.html", "Monument Valley"],
   ["Grand Canyon", "winter_day.html", "Winter Day at the Grand Canyon"],
   ["Beautiful Landscape", "california_sunset.html", "California Sunset"],
   ["Beautiful Landscape", "phoenix_sunset.html", "Phoenix Sunset"],
   ["Beautiful Landscape", "a_peaceful_place.html", "A Peaceful Place"],
   ["Beautiful Landscape", "deerinsnow.html", "Deer in the Canyon"]);
var miscMenuItems = new Array(
   ["Potrait", "portrait_at_arch.html", "Self Portrait at the Arch"],
   ["Portrait", "the_girlfriend.html", "The Girlfriend"],
   ["Beautiful Landscape", "fort_ord.html", "Fort Ord"],
   ["Beautiful Landscape","california_street.html","California Street"],
   ["Beautiful Landscape", "a_day_in_may.html", "A Day In May"],
   ["Portrait", "contemplation.html", "Contemplation"],
   ["Portrait", "nicola.html", "Nicola"],
   ["Portrait", "the_artist.html", "The Artist"],
   ["Beautiful Landscape", "utah_day.html", "Utah Day"],
   ["Portrait", "mask_lady.html", "Mask Lady"],
   ["Nude", "dreaming.html", "Dreaming in the Nude"],
   ["Portrait", "nude_at_the_canal.html", "Nude at the Canal"],
   ["Portrait", "the_player.html", "The Player"]);
var DrawMenuItems = new Array(
   ["Portrait", "man_of_the_sea.html", "Man of the Sea"],   
   ["Nude", "nude_in_moon_light.html", "Nude in Moon Light"],
   ["Portait", "wise_women.html", "Wise Woman"],   
   ["Portrait", "lady_in_waiting.html", "Lady in Waiting"],
   ["Nude", "nude_in_arch.html", "Nude in Arch"],
   ["Portrait", "the_artist_drawing.html", "The Artist Drawing"]);
var folkMenuItems = new Array(
	["Folk", "goose_girl.html", "Goose Girl"],
	["Folk", "alfred.html", "Alfred"],
	["Folk", "the_imp.html", "The Imp"],
	["Folk", "the_maiden.html", "The Maiden"],
	["Folk", "the_patriarch.html", "The Patriarch"],
	["Folk", "time.html", "Time"],
	["Elf", "greenguy.html", "Olwe the Elf"],
	["Folk", "leaving_home.html", "Leaving Home"]);
	
function createMenu(menuName, menuItems)
{
   var divHTML = '<DIV ID="' + menuName + 'MenuDiv" CLASS="DivMenu"';
   divHTML = divHTML + 'onmouseout="return hideMenu(this, ' + menuName.length + ',event)">';
   var tableHTML = '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1 ID="' + 
      menuName + 'Table"><TBODY ID="' + menuName + 'TableBody">';
   var tableRowHTML = "";
   var rowCount;
   var totalNoRows = menuItems.length;
   for (rowCount = 0; rowCount < totalNoRows; rowCount++)
   {
      tableRowHTML = tableRowHTML + '<TR ID="' + menuName + 
         menuItems[rowCount][0] +  'TR"><TD ID="' + menuName + 
         menuItems[rowCount][0];
      tableRowHTML = tableRowHTML + '" onclick="goPage(\'' + 
         menuItems[rowCount][1] + '\')"';
      tableRowHTML = tableRowHTML + 'CLASS="TDMenu">' + menuItems[rowCount][2] +
         '</TD></TR>';
   }
  
   return divHTML + tableHTML + tableRowHTML + '</TBODY></TABLE></DIV>';
}
function showMenu(menuToShow, e)
{
   if (ns)
   {
      var srcElement = e.target;
   } 
 
   else
   {
      var srcElement = event.srcElement; 
   }
   var xPos = parseInt(srcElement.style.left);
   var yPos = parseInt(srcElement.style.top); 
   menuToShow.style.left = xPos + (srcElement.width)
   menuToShow.style.top = yPos;
}
function hideMenu(menuToHide, menuIDLength, e)
{   
   var toElementID;
   if (ns)
   {
      var mouseLastIn = e.relatedTarget;       
   }
   else
   {
      var mouseLastIn =  event.toElement; 
   }
   if (mouseLastIn != null)
   {
      if (mouseLastIn.nodeType == 3)
      {
         mouseLastIn = mouseLastIn.parentNode; 
      }
      toElementID = mouseLastIn.id;
   }
   else 
   {  
       return false;
   }
   if (typeof(toElementID) == "undefined")
   {
      toElementID = "UNDEF";
   }
   toElementID = toElementID.substr(0,menuIDLength);
   var divMenuID = menuToHide.id;
   divMenuID = divMenuID.substr(0,menuIDLength);
   if (toElementID != divMenuID)
   {
      menuToHide.style.left = -200 + 'px';
      menuToHide.style.top = -1000 + 'px';
   }
}
function document_onmouseover(e) 
{
   if (ns)
   {
      var srcElement = e.target;
   } 
   else
   {
      var srcElement = event.srcElement;
   }
 
   if (srcElement.nodeType == 3)
   {
       srcElement = srcElement.parentNode; 
   }
   if (srcElement.tagName=="TD")
   {
      srcElement.style.color = "black";
      srcElement.style.backgroundColor = "#ece9bc"
   }
}
function document_onmouseout(e) 
{
    if (ns)
   {
      var srcElement = e.target;
   } 
   else
   {
      var srcElement = event.srcElement;
   }
   if (srcElement.nodeType == 3)
   {
      srcElement = srcElement.parentNode; 
   }
   if (srcElement.tagName == "TD")
   {
      srcElement.style.color ="darkblue";
      srcElement.style.backgroundColor = "#d7aacc";
   }
}
function goPage(src)
{
   window.location.href = src;
}
