  //
  // CSS Photo Shuffler v1.0 by
  //   Carl Camera
  //   http://iamacamera.org 
  //
  // SetOpacity Function and inpiration from Photo Fade by
  //   Richard Rutter
  //   http://clagnut.com
  //
  // License: Creative Commons Attribution 2.5  License
  //   http://creativecommons.org/licenses/by/2.5/
  //
  
  // Customize your photo shuffle settings
  // 
  // * Surround the target <img /> with a <div>. specify id= in both
  // * The first and final photo displayed is in the html <img> tag
  // * The array contains paths to photos you want in the rotation. 
  //   If you want the first photo in the rotation, then it's best to
  //   put it as the final array image.  All photos must be same dimension
  // * The rotations variable specifies how many times to repeat array.
  //   images. zero is a valid rotation value.

  var gblPhotoShufflerDivId3 = "shufflediv3";
  var gblPhotoShufflerImgId3 = "photoshuffle3"; 
  var gblImg3 = new Array(
      "/images/shell/photos/img3_2.jpg",
      "/images/shell/photos/img3_3.jpg",
      "/images/shell/photos/img3_4.jpg",
	  "/images/shell/photos/img3_5.jpg",
	  "/images/shell/photos/img3_6.jpg",
	  "/images/shell/photos/img3_1.jpg");
  var gblPauseSeconds3 = 16;
  var gblFadeSeconds3 = .85;
  var gblRotations3 = 50;

  // End Customization section
  
  var gblDeckSize3 = gblImg3.length;
  var gblOpacity3 = 100;
  var gblOnDeck3 = 0;
  var gblStartImg3;
  var gblImageRotations3 = gblDeckSize3 * (gblRotations3+1);

  //window.onload = photoShufflerLaunch3;
  
  function photoShufflerLaunch3()
  {
  	var theimg3 = document.getElementById(gblPhotoShufflerImgId3);
        gblStartImg3 = theimg3.src; // save away to show as final image

	document.getElementById(gblPhotoShufflerDivId3).style.backgroundImage='url(' + gblImg3[gblOnDeck3] + ')';
	setTimeout("photoShufflerFade3()",gblPauseSeconds3*1000);
  }

  function photoShufflerFade3()
  {
  	var theimg3 = document.getElementById(gblPhotoShufflerImgId3);
	
  	// determine delta based on number of fade seconds
	// the slower the fade the more increments needed
        var fadeDelta3 = 100 / (30 * gblFadeSeconds3);

	// fade top out to reveal bottom image
	if (gblOpacity3 < 2*fadeDelta3 ) 
	{
	  gblOpacity3 = 100;
	  // stop the rotation if we're done
	  if (gblImageRotations3 < 1) return;
	  photoShufflerShuffle3();
	  // pause before next fade
          setTimeout("photoShufflerFade3()",gblPauseSeconds3*1000);
	}
	else
	{
	  gblOpacity3 -= fadeDelta3;
	  setOpacity3(theimg3,gblOpacity3);
	  setTimeout("photoShufflerFade3()",30);  // 1/30th of a second
	}
  }

  function photoShufflerShuffle3()
  {
	var thediv3 = document.getElementById(gblPhotoShufflerDivId3);
	var theimg3 = document.getElementById(gblPhotoShufflerImgId3);
	
	// copy div background-image to img.src
	theimg3.src = gblImg3[gblOnDeck3];
	// set img opacity to 100
	setOpacity3(theimg3,100);

        // shuffle the deck
	gblOnDeck3 = ++gblOnDeck3 % gblDeckSize3;
	// decrement rotation counter
	if (--gblImageRotations3 < 1)
	{
	  // insert start/final image if we're done
	  gblImg3[gblOnDeck3] = gblStartImg3;
	}

	// slide next image underneath
	thediv3.style.backgroundImage='url(' + gblImg3[gblOnDeck3] + ')';
  }

function setOpacity3(obj3, opacity3) {
  opacity3 = (opacity3 == 100)?99.999:opacity3;
  
  // IE/Win
  obj3.style.filter = "alpha(opacity:"+opacity3+")";
  
  // Safari<1.2, Konqueror
  obj3.style.KHTMLOpacity = opacity3/100;
  
  // Older Mozilla and Firefox
  obj3.style.MozOpacity = opacity3/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj3.style.opacity = opacity3/100;
}


