// javascript and jscript source copyright (c) 2003 Thomas H. Field

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function chIm() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<chIm.arguments.length; i+=2) {
			document[chIm.arguments[i]].src = chIm.arguments[i+1];
		}
	}
}

function makeArray(len) {
	for (var i = 0; i < len; i++) this[i] = null;
	this.length = len;
}
 
var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		preloadFlag = true;
		picture = new makeArray(17);
		picture[0] = "hdr/bearrock.jpg";
		picture[1] = "hdr/bwfalls.jpg";
		picture[2] = "hdr/duskfall.jpg";
		picture[3] = "hdr/fiveflags.jpg";
		picture[4] = "hdr/foglandscape.jpg";
		picture[5] = "hdr/grassybald.jpg";
		picture[6] = "hdr/greenforest.jpg";
		picture[7] = "hdr/layers.jpg";
		picture[8] = "hdr/mistysunrise.jpg";
		picture[9] = "hdr/oldspruce.jpg";
		picture[10] = "hdr/ottercreek.jpg";
		picture[11] = "hdr/redreflection.jpg";
		picture[12] = "hdr/reflection.jpg";
		picture[13] = "hdr/roughwild.jpg";
		picture[14] = "hdr/sprucesnow.jpg";
		picture[15] = "hdr/sunrise.jpg";
		picture[16] = "hdr/windblown.jpg";
		window.setTimeout("NextImage();",100);
	}
}

var runslideshow = true;
var randimg = true;
var first = 1;
function NextImage() {
	if (runslideshow) {
		if (randimg) first = Math.round(Math.random()*(picture.length-5));
		else {
			first -= 1;
			if (first < 0) first = picture.length - 5;
		}
		// test for filter-compatible browser (IE)
		if (document.images.slide0.filters) {
			document.images.slide0.style.filter="blendTrans(duration=1)";
			document.images.slide1.style.filter="blendTrans(duration=1)";
			document.images.slide2.style.filter="blendTrans(duration=1)";
			document.images.slide3.style.filter="blendTrans(duration=1)";
			document.images.slide4.style.filter="blendTrans(duration=1)";
			document.images.slide0.filters.blendTrans.Apply();
			document.images.slide1.filters.blendTrans.Apply();
			document.images.slide2.filters.blendTrans.Apply();
			document.images.slide3.filters.blendTrans.Apply();
			document.images.slide4.filters.blendTrans.Apply();
		}
		document.slide0.src = picture[first+0];
		document.slide1.src = picture[first+1];
		document.slide2.src = picture[first+2];
		document.slide3.src = picture[first+3];
		document.slide4.src = picture[first+4];
		// if this filter supported by browser:
		if (document.images.slide0.filters) {
			document.images.slide0.filters.blendTrans.Play();
			window.setTimeout("Play1();",500);
			window.setTimeout("Play2();",1000);
			window.setTimeout("Play3();",1500);
			window.setTimeout("Play4();",2000);
		}
	}
	window.setTimeout("NextImage();",9000);
}
function Play1() {document.images.slide1.filters.blendTrans.Play();}
function Play2() {document.images.slide2.filters.blendTrans.Play();}
function Play3() {document.images.slide3.filters.blendTrans.Play();}
function Play4() {document.images.slide4.filters.blendTrans.Play();}

function stopgo() {
	if (runslideshow) runslideshow = false;
	else runslideshow = true;
}

function randset() {
	if (randimg) randimg = false;
	else randimg = true;
}



var bname = navigator.appName;
var poppic = null;
var myHeight;
var myWidth;

function enlarge(xsize, WIDTH, HEIGHT) {
myHeight = HEIGHT + 34;
myWidth = WIDTH + 24;
if (bname == "Microsoft Internet Explorer") {
	myHeight += 28;
	myWidth += 12;
}

text = "<html><head><title>Enlargement - www.WVphotographs.com</title><s" + "cript type='text/javascript' src='wvp.js'></s" + "cript></head>";
text += "<body topmargin='0' leftmargin='0' marginheight='0' marginwidth='0' bgcolor='#000000' onLoad='top.window.focus()'>";
text += "<center><img alt='www.WVphotographs.com' src='" + xsize + "L.j";
text += "pg' border=0 GALLERYIMG='no'></a></center></body></html>";
poppic = window.open("","picwin","width=100,height=100,resizable=yes,toolbar=no,menubar=no,status=no");
setTimeout("update()",50);
poppic.focus();
}

function update() {
poppic.document.open();
poppic.document.write(text);
poppic.document.close();
poppic.resizeTo(myWidth, myHeight);
}

function eradic8() {
  if (poppic != null && poppic.open) poppic.close();
}





// suppress error messages to end user when development finished
function stopError() {
  return true;
}
window.onerror = stopError;

// anti-spambot addresses

function Kent_Mason() {
  var contact1 = "Kent Mason"
  var id = "kramason"
  var host = "gmai"
	if (document.all || document.getElementsByName)
	  document.write("<a href=" + "ma" + "il" + "to:" + id + "&#64" + host + "l.com>" + contact1 + "</a>")
}

function e_mail() {
  var contact1 = "Kent Mason"
  var id = "kramason"
  var host = "gmai"
	if (document.all || document.getElementsByName)
	  document.write("<a href=" + "ma" + "il" + "to:" + id + "&#64" + host + "l.com>" + contact1 + "</a>")
}

// provide a bookmark this site function, only for IE 4+ browsers
// script from http://www.dynamicdrive.com
var bookmarkurl="http://www.WVphotographs.com"
var bookmarktitle=".WVphotographs.com West Virginia Photographs"
function addbookmark(){
	if (document.all)
		window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

function linkie4() {
	//if the user is using IE 4+
	if (document.all)
		document.write('<a href="javascript:addbookmark()">Bookmark this site!</a>')
}
