<!-- HIDE FROM INCOMPATIBLE BROWSERS

/*
*	Long Beach Museum of Art JavaScript Code Snippets
*
*	By: Tammy C. Wilson
*	6/14/07
*/

/* This function is courtsey of: http://www.sitepoint.com/article/standards-compliant-world
It opens links marked external in a new Window. Use with PDF's and external websites */

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}

/* This function changes the link to the slideShow instead of the plain picture page if the visitor has JavaScript */
function slideShowSwitch() {
	var links = document.getElementsByTagName("a");
	for (var i=0; i<links.length; i++) {
		if (links[i].getAttribute("href") == "weddingPictures.html")
			links[i].setAttribute("href", "weddingSlideshow.html");
		if (links[i].getAttribute("href") == "eventsPictures.html")
			links[i].setAttribute("href", "eventsSlideshow.html");
	}
}

/* Replaced this code with the function addLoadEvent() below
window.onload = externalLinks; */

/* This function is courtsey of: http://www.sitepoint.com/blogs/2004/05/26/closures-and-executing-javascript-on-page-load/ */
/* It adds functions to the onload event, without screwing up any previous onload events */

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(externalLinks);

addLoadEvent(function() {
  /* more code to run on page load for the slideshow */ 
	var slides = document.getElementById("switchSlides");

	if (slides) { 
		slideShowSwitch();
	}
})

// STOP HIDING FROM INCOMPATIBLE BROWSERS -->