function getObject(theObjectID)
{
	if (document.all && !document.getElementById){
		return(document.all(theObjectID));
	} else {
		return(document.getElementById(theObjectID));
	}
}

var currPic = 1;
function setPicture(picId){
	if(!getObject("pic"+picId)){ picId = 1; }
	var thunbnail = getObject("pic"+currPic);
	thunbnail.src="images/alpha.png";
	currPic = picId;
	var thunbnail = getObject("pic"+picId);
	thunbnail.src = "images/blank.gif";
	var picFilename = thunbnail.style.background;
	picFilename = picFilename.replace(/&amp;/g,"&");
	picFilename = picFilename.substring(picFilename.indexOf("?path=")+6,picFilename.length);
	picFilename = picFilename.replace("&maxheight=85)","");			
	getObject("bigPic").src = "imageSendBinary.asp?path="+picFilename+"&maxwidth=400&maxheight=268";	
}

function thumbnailOver(picId){
	var thumbnail = getObject("pic"+picId);
	if(thumbnail.src.indexOf("alpha")>-1){
		thumbnail.src = "images/blank.gif";
	}
}

function thumbnailOut(picId){
	if(picId!=currPic){
		var thumbnail = getObject("pic"+picId);
		thumbnail.src = "images/alpha.png";
	}
}

function stopScroll(){
	window.clearInterval(scrollInt);
}

var scrollInt;
function startScroll(direction){
	if(navigator.userAgent.indexOf("AppleWebKit")>-1){
		var jump = 1;
		var interval = 10;
	}else{
		var jump = 3;
		var interval = 1;
	}
	if(direction=="up"){ jump = jump * -1; }
	scrollInt = window.setInterval(function(){
		var obj = getObject("pictures");
		obj.scrollTop = obj.scrollTop + jump;
	},interval);
}

var notWhitespace = /\S/;
function cleanWhitespace(node){
	for (var x = 0; x < node.childNodes.length; x++){
		var childNode = node.childNodes[x];
		if ((childNode.nodeType == 3)&&(!notWhitespace.test(childNode.nodeValue))){
			// that is, if it's a whitespace text node
			node.removeChild(node.childNodes[x]);
			x--;
		}
		if (childNode.nodeType == 1){
			// elements can have text child nodes of their own
			cleanWhitespace(childNode);
		}
	}
}
