/************************************************************
 *
 *	This file contains all the Javascript utilized by
 *	the JeaneneScottPhotography website 
 *	http://www.jeanenescott.com .
 *	All code authored by Richard Esmonde Web Design.
 *	
 ************************************************************/


/*  Name of Gallery the user wants to view
 *  Code caters to three DOM types
*/


function galleryChoice(text,id)
{
	if (document.getElementById) // Nav6+ and IE 5+ DOM
	{
		x = document.getElementById(id);
		x.innerHTML = '';
		x.innerHTML = text;
	}
	else if (document.all) // IE4 DOM
	{
		x = document.all[id];
		x.innerHTML = text;
	}
	else if (document.layers) //Nav4.x DOM
	{
		x = document.container.layers[id];
		replacementtext = '<P CLASS="wds">' + text + '</P>';
		x.document.open();
		x.document.write(replacementtext);
		x.document.close();
	}
}




/*  Yellow side gallery navigationary links */
function fetchgallery(m) {
switch(m) {
case 1:
	parent.photospanel.location="photosbwht.html";
	break;
case 2:
	parent.photospanel.location="photosflowers.html";
	break;
case 3:
	parent.photospanel.location="photoslifestyle.html";
	break;
case 4:
	parent.photospanel.location="photosnwrk.html";
	break;
case 5:
	parent.photospanel.location="photosprod.html";
	break;
case 6:
	parent.photospanel.location="photospubl.html";
	break;
case 7:
	parent.photospanel.location="photosstill.html";
	break;	
	}
}


/*  Which gallery as listed in the navigation strip is being viewed */

function whichgallery(galleryname, linkIndexNumber) {

// turn all links to grey initially
// there are twelve links or anchors in the anchor array

lnk = top.parent.galleriespanel.document.anchors.length;
pathway = top.parent.galleriespanel.document;
for (i = 0; i < lnk; i++) {
	pathway.anchors[i].style.color = "#666666";
	}
// Now turn on the appropriate link	
switch(galleryname) {
case 'blkwht':
	pathway.anchors[linkIndexNumber].style.color = "#FFFFFF";
 	break;
case 'flowers':
	pathway.anchors[linkIndexNumber].style.color = "#FFFFFF"; 	
 	break;
case 'lifestyle':
	pathway.anchors[linkIndexNumber].style.color = "#FFFFFF";  	
 	break;
case 'newwork':
	pathway.anchors[linkIndexNumber].style.color = "#FFFFFF"; 	
 	break;
case 'products':
	pathway.anchors[linkIndexNumber].style.color = "#FFFFFF"; 	
 	break;
case 'published':
	pathway.anchors[linkIndexNumber].style.color = "#FFFFFF"; 	
 	break;
case 'stilllife':
	pathway.anchors[linkIndexNumber].style.color = "#FFFFFF";	
 	break;
 	}
}



/*  Open up a Pop Up Window for Copyright Infringement/Buy Cards..etc */

function pwin(winurl, wd, ht) {
var featureset = "width="+wd+",height="+ht+",scrollbars=no,resizable=yes,menubar=no";
var popupwindow = window.open(winurl,"", featureset);
}



/*  Change Nav Button text and Backgnd color *
 *					     *
 *  Uses the anchors array to identify       *
 *  which link to target for DHTML           *
 *					     */
function ChgTD(whichTD, linkIndexNumber, bkgndclr, txtcolor) {
	whichTD.style.backgroundColor = bkgndclr;	// for the background
	document.anchors[linkIndexNumber].style.color = txtcolor;			// for the text, works in IE, Netscape and Opera browsers
}



/* The Current Year for Copyright displays throughout site */
var now = new Date();
var presentyear = now.getFullYear();
var currentyear = presentyear.toString();

/* And as a function for call within HTML */
function perAnnum() {
 document.write(currentyear);
 }



/*  Navigation via the thumbnails */

function display(num) {
top.parent.photospanel.document.graphic.src = image[num-1].src;			
} 
