
function newImage(arg) {
   if (document.images) {
      rslt = new Image();
      rslt.src = arg;
      return rslt;
   }
}

function changeImages() {
   if (document.images && (preloadFlag == true)) {
      for (var i=0; i<changeImages.arguments.length; i+=2) {
         document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
      }
   }
}

var preloadFlag = false;
function preloadImages(mode) {
    if (document.images) {
       if ( mode == null ) {
           Home_over   = newImage("/images/Home-over.jpg");
           Photos_over = newImage("/images/Photos-over.jpg");
           Info_over   = newImage("/images/Info-over.jpg");
           Hikes_over  = newImage("/images/Hikes-over.jpg");
           Brian_over  = newImage("/images/Brian-over.jpg");
           Lisa_over   = newImage("/images/Lisa-over.jpg");
           Friends___Family_over = newImage("/images/Friends-%26-Family-over.jpg");
           preloadFlag = true;
       }
       else if ( mode == "slideshow" )
       {
         prev_image_over = newImage("/images/prev-image-over.gif");
         index_over = newImage("/images/index-over.gif");
         next_image_over = newImage("/images/next-image-over.gif");
         preloadFlag = true;
       }
    }
}

function newImageWindow(url, title, arg_width, arg_height) {
   // <a href="javascript:newImageWindow(url, title, width, height)">Open Window</a>
   
   if ( arg_width == null ) {
      arg_width = screen.width * .95;
   }
   if ( arg_height == null ) {
      arg_height = screen.height * .9;
   }

   var winl = (screen.width - arg_width) / 2;
   var wint = (screen.height-55 - arg_height) / 2;
   
   // Netscape window position
   var winPos = "screenX="+winl+",screenY= ,"+wint+",";
   // IE window Position
   winPos += "left="+winl+", top="+wint+",";

   var newWindow = 
      window.open( url, '',
   'scrollbars=' + 'yes' + 
   ', menubar=no, height=' + arg_height + 
   ', width=' + arg_width + winPos +
   ', resizable=yes, toolbar=no, location=no,status=no'); 

   // if (title != "" ) {
   //    newWindow.document.title = title;
   // }

}

function slideload(url)
{
   winHeight = screen.height-80;
   winWidth = 900;
   if ( winHeight > 780 ) { winHeight = 780; }
   if ( screen.width <= 800 ) { winWidth = 700; }
   newwin = window.open(url,
               'slideshow_win',
               'height='+winHeight+
               ',width='+winWidth+',resizable=1,location=0,scrollbars=1,menubar=0,status=1,toolbar=0');
   newwin.focus();
}

//--------------------------------------------------
// A helper function to getElementById in all browsers
function getElementById(element_id)
{
  // This method returns the element corresponding to the id

  if (document.getElementById) {
    return document.getElementById(element_id);
  }
  else if (document.all) {
    return document.all[element_id];
  }
  else if (document.layers) {
    return document.layers[element_id];
  } else {
    return undefined;
  }
}

// Take an element and populate its text with content of the element with the
// same name with _text appended on the end.  (This element should be hidden
// with a width and height of 0px
function showText(element_id, textElement_id)
{
   var elem = getElementById(element_id);
   if ( textElement_id == undefined ) {
      textElement_id = element_id + "_text";
   }
   var elem_text = getElementById(textElement_id);
   elem.innerHTML = elem_text.innerHTML;
}

function hideText(element_id)
{
   getElementById(element_id).innerHTML = "";
}

