function normRoll(imgname, imgsrc) {
	imgsrc = "img/" + imgsrc;
	document.images[imgname].src = imgsrc;
	return true;
}

// DIV fade functionality. 

//Original code from brainerror.net 
//modified 07.09.20 by T.E.D. Andrick for multiple, stacked DIVs with internal links.
//it should be noted that this is one of those things that takes five minutes is Flash and five hours in JavaScript.

//set the opacities across the board to zero from embedded array; embed function on page
function opacityOff() {
	for (var i = 0; i <= thismany; i++) {
		var object = document.getElementById(whichdivs[i]).style; 
		object.opacity = (0);
		object.MozOpacity = (0);
		object.KhtmlOpacity = (0);
		object.filter = "alpha(opacity=" + 0 + ")";
	}
}


function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;
	document.getElementById(id).style.display = 'block';

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec) {
	//if an element is invisible, make it visible, else make it ivisible
	if(document.getElementById(id).style.opacity == 0) {
		opacity(id, 0, 100, millisec);
	} else {
		opacity(id, 100, 0, millisec);
	}
}

function shiftMultiple(id, millisec) {
	//if an element is invisible, make it visible, else make it ivisible
	//we'll do this for the array defined on the page
	for (var i = 0; i <= thismany; i++) {
		thisdiv = whichdivs[i];
		if((document.getElementById(thisdiv).style.opacity != 0) && (thisdiv != id)) {
			opacity(thisdiv, 100, 0, millisec);
			
			//call routine to 'none' the div, so we can overlay with links
			activediv = thisdiv;
			setTimeout("hideStack(activediv)", millisec);
		} 
		if((document.getElementById(thisdiv).style.opacity != 1) && (thisdiv == id)) {
			opacity(thisdiv, 0, 100, millisec);
		}
	}
}

//simple function to set to 'none' for multiple access
function hideStack(closethis) {
	document.getElementById(closethis).style.display = 'none';
}

//function for 'close' button on page; have to change that variable name or you get an error.
function closeStack(closeit, millisec) {
	opacity(closeit, 100, 0, millisec);
	closethis = closeit;
	setTimeout("hideStack(closethis)", millisec);
}


// DIV fade end.

// Form Validation

function emailvalidation(entered, alertbox) {
	with (entered) {
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		lastpos=value.length-1;
		if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) {
			if (alertbox) {
				alert(alertbox);
			} 
			return false;
		} else {
			return true;
		}
	}
}

function emptyvalidation(entered, alertbox) {
	with (entered) {
		if (value==null || value=="" || value==0) {
			if (alertbox!="") {
				alert(alertbox);
			} return false;
		} else {
			return true;
		}
	}
}


function filevalidation(entered, alertbox) {
	docmarker = 0;
//	alert(whichmany);
	with (entered) {
		if (value == "") {
			value = none;
		}
//		alert(value);
		for (var i = 0; i <= whichmany; i++) {
			oppos=value.lastIndexOf(whichdocs[i]);
			xpos = value.length;
			markpos = xpos - 4;
//			alert(markpos + " " + oppos);
			if (markpos == oppos) {
				docmarker = 1;
			}
		}
		
		if (docmarker != 1) {
			if (alertbox) {
				alert(alertbox);
			}
			return false;
		} else {
			return true;
		}

	}
}

// End Form Validation
