/* aass.js . brian@alexanderz.net . AlexanderZ.net . Last modified: 20090521 */
// Ansel Adams: February 20, 1902-April 22, 1984 American photographer

defaultStatus =  "Position cursor over link for preview. Click for larger picture in new window.";
window.status = defaultStatus; 

var i,j,k,l,s;

credit = "<h3>Photographs by Ansel Adams</h3><strong>http://www.royaltyfreeart.com/ansel/</strong>";
// credit += "<br /><strong>www.joyfulexpressions-photography-art.com/famousphotographers.html</strong>";
// credit += "http://commons.wikimedia.org/wiki/Ansel_Adams
// credit += "http://en.wikipedia.org/wiki/Ansel_Adams
thePath = "images/";
grand = 0.82; 
petite = 0.25;
onHold = false;
theImage = new Array ();
// Photo elements: [0] name, [1] .htm filespec, [2] gif, [3] width, [4] height, [5,7] scaled width, [6,8] scaled height
function Photo(place, htm, pic, w, h, wp, hp, wg, hg) {
	this.place = place;
	this.htm = htm;
	this.pic = pic;
	this.w = w;
	this.h = h;
	this.wp = wp;
	this.hp = hp;
	this.wg = wg;
	this.hg = hg;
}
var photo = new Array();
photo[0] = new Photo("", "Photographs of Ansel Adams", "spacer.gif", 1, 1);
photo[1] = new Photo("Glacier National Park", "glacier.htm", "glacierNationalPark.gif", 600, 465);
photo[2] = new Photo("Grand Canyon", "grand.htm", "grandCanyon.gif", 600, 483);
photo[3] = new Photo("Mount Sheridan", "mtsheridan.htm", "mtSheridan.gif", 600, 419);
photo[4] = new Photo("The Grand Tetons", "tetons.htm", "tetons.gif", 600, 444);
photo[5] = new Photo("Yellowstone Falls", "yellowstone.htm", "yellowstonefalls.gif", 410, 600);
photo[6] = new Photo("Zion National Park", "zion.htm", "zionNationalPark.gif", 481, 600);
/*
The Tetons and the Snake River (1942)
Evening, McDonald Lake, Glacier National Park (1942)
Ansel Adams at Big Sur, 1980.
*/
for	(l = 1; l < photo.length; l++) {
		photo[l].wp = Math.ceil(photo[l].w * petite);
		photo[l].hp = Math.ceil(photo[l].h * petite);  // scaled petite width & height
		photo[l].wg = Math.ceil(photo[l].w * grand);
		photo[l].hg = Math.ceil(photo[l].h * grand);  // scaled grand width & height
}
function menu() {
	s ="<ul>\r";
	for (k = 1; k < photo.length; k++) {
//		s += "<li><a href='" + photo[k].htm + "' onmouseover='show(" + k + ");' ";
		s += "<li><a href='photos.asp?n=" + k + "' onmouseover='show(" + k + ");' ";  
		s += "alt='" + photo[k].place + "' title='" + photo[k].place + "' target='_blank'>" + photo[k].place + "</a></li>\r";
	}
	s += "<li><a href='#' onmouseover='show(" + 0 + ");'>Credits</a></li>\r";
//<li><a href='#' onmouseover='show(0);'> Credits</a> </li>
	s += "</ul>\r";
	document.getElementById("menu").innerHTML = s;
}
function preload() {
s = "";
for (i = 1; i < photo.length; i++) { 
	theImage[i] = new Image();
	theImage[i].src = thePath + photo[i].pic;
	theImage[i].width = photo[i].wp;
	theImage[i].height = photo[i].hp;
	theImage[i].alt = photo[i].place;
	theImage[i].title = photo[i].place;
	theImage[i].wg = photo[i].wg;
	theImage[i].hg = photo[i].hg;  // scaled grand width & hieght
	theImage[i].wp = Math.ceil(photo[i].w * petite);
	theImage[i].hp = Math.ceil(photo[i].h * petite);  // scaled petite width & height
	s += "<img src='" + theImage[i].pic + "' width='" + theImage[i].w + "' height='"+ theImage[i].h + "'";
	s += " alt='" + photo[i].place + "' title='" + photo[i].place + "' />"
}
document.getElementById("preload").innerHTML = s;
}
function preView(i) {
	onHold = true;
	document.getElementById("thePlace").innerHTML = "<center>" + photo[i].place + "</center>"; // thisPlace;
	document["thumbPic"].src = theImage[i].src; 
}
function preViewEnd() { 
	onHold = false; 
}
function show(i) {
if (i == 0)	{
	document.title = "Photographs by Ansel Adams";
	document.getElementById("href").innerHTML = "";
	document.getElementById("displayHdr").innerHTML = "";
	document.getElementById("displayPlace").innerHTML = credit;
}
else {
	document.title = photo[i].place + ": Photograph by Ansel Adams";
	s = "<a href='photos.asp?n=" + i + "' target='_blank' >";
//	s = "<a href='"+ photo[i].htm + "'>";
	s += "<img src='" + theImage[i].src + "' width='" + theImage[i].wg + "' height='" + theImage[i].hg + "' ";
	s += "alt='" + photo[i].place + "' title='" + photo[i].place + "' /></a>";
	document.getElementById("href").innerHTML = s;
	document.getElementById("displayPlace").innerHTML = "<center><h4>" + photo[i].place + "</h4></center>";
	document.getElementById("displayHdr").innerHTML = ""; // place
}}
var j = 0;
function slideshow() {
	if (onHold == true) return;
	++j;
	document.getElementById("thumbPlace").innerHTML = "<center>" + photo[j].place + "</center>";
	document["thumbPic"].src = theImage[j].src;
	document["thumbPic"].width = theImage[j].wp;
	document["thumbPic"].height = theImage[j].hp;
	document["thumbPic"].alt = theImage[j].alt;
	document["thumbPic"].title = theImage[j].alt;
	if (j == photo.length-1) j = 0; // Bypass opening screen
}
function start_show() {
	setInterval("slideshow()", 3000);
}
