<!--

/*
Copyright © The Regents of the University of Michigan, 
College of Literature, Science, and the Arts 2002-2003, All Rights Reserved.
Site: Institute for the Humanities
http://www.lsa.umich.edu/humin
Script: Slide Show
Version: 2.0
Updated: 09/18/03
Authors: Frank Y.
*/


////////////////////////////////////////////////
//* Default Slide and Caption for Slide Show *//
////////////////////////////////////////////////

function defaultSlide() {

//fy, 100404, shit's going haywire suddenly for no reason. starting to dbug by changing code below.
//arg = eval(window.document.frmPage.hdnCurrentSlide.value) + 1;
//arg1 = window.document.frmPage.hdnCurrentSlide.value;

arg = new Number(window.document.frmPage.hdnCurrentSlide.value) + 1;
arg1 = new Number(window.document.frmPage.hdnCurrentSlide.value);

eval("window.document.slidephoto.src=newPhoto[" + arg1 + "]");
eval("window.document.slidephoto.alt=newAlt[" + arg1 + "]");

// set divs



// set left distance for prev next



// set left distance for caption

  if (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4") {
    //eval("window.document.layer" + arg + ".visibility='show'");
    eval("document.layers['layer" + arg + "'].visibility='show'");
  
    if (window.innerWidth < 858) {
    winLeftMargin = -46
    }
    else {
    winLeftMargin = (window.innerWidth-858)/2
    }

    eval("document.layers['layer" + arg + "'].left=winLeftMargin+208");
  }
  else if (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)!="4") {
    eval("window.document.getElementById('div" + arg + "').style.display=''");
  }
  else {
    eval("window.document.all.div" + arg + ".style.display=''");
  }

}

//////////////////////
//* Caption Change *//
//////////////////////

function changeCaption(photoNbr) {
        
NS = (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4");
NS6 = (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)!="4");

//fy, 100404. i made the one line change below. was getting NaN error. This error randomly
//out of the blue tonight after i edited and saved the code. Note, i made 1 minor change
//and immediatedly reversed them to the exact original code, and for some reason, randomly
//stopped working properly
//arg = eval(window.document.frmPage.hdnCurrentSlide.value) + 1;
arg = new Number(window.document.frmPage.hdnCurrentSlide.value) + 1;

var photoNbr;

// set left distance for caption
  if (NS) {
    if (window.innerWidth < 758) {
    winLeftMargin = 8
    }
    else {
    winLeftMargin = (window.innerWidth-758)/2
    }

    eval("document.layers['layer" + arg + "'].left=winLeftMargin+208");

    document.layers["layer1"].visibility="hidden";
    document.layers["layer2"].visibility="hidden";
    document.layers["layer3"].visibility="hidden";
    document.layers["layer4"].visibility="hidden";
    document.layers["layer5"].visibility="hidden";
    eval("document.layers['layer" + arg + "'].visibility='show'");
  }
  else if (NS6) {
    window.document.getElementById("div1").style.display="none";
    window.document.getElementById("div2").style.display="none";
    window.document.getElementById("div3").style.display="none";
    window.document.getElementById("div4").style.display="none";
    window.document.getElementById("div5").style.display="none";
    eval("window.document.getElementById('div" + arg + "').style.display=''");
  }
  else {
    window.document.all.div1.style.display="none";
    window.document.all.div2.style.display="none";
    window.document.all.div3.style.display="none";
    window.document.all.div4.style.display="none";
    window.document.all.div5.style.display="none";
    eval("window.document.all.div" + arg + ".style.display=''");
  }
}

////////////////////
//* Photo Change *//
////////////////////

function changePhoto(objPhoto, newPhotoNbr) {

  //alert("changePhoto block")
	oldPhotoNbr = window.document.frmPage.hdnCurrentSlide.value;

  // Set nav images to the regular

  
	// Swap the photo
  objPhoto.src = newPhoto[newPhotoNbr];

  // Swap the caption (alt tag)
  window.document.slidephoto.alt = newAlt[newPhotoNbr];

  // Change the old hidden form value to the new one
  window.document.frmPage.hdnCurrentSlide.value = newPhotoNbr;

  // Change caption
  changeCaption(newPhotoNbr);
		
  // Build Prev/Next Nav

}

//-->