
function showElement(elemID) {
	var ref =  document.getElementById(elemID);
	ref.style.display = "block";
}

function hideElement(elemID) {
	var ref =  document.getElementById(elemID);
	ref.style.display = "none";
}

function setStatusMsg(msg) {
	window.status = msg;
	return true;
}

function changeImage(imgArray, imgRef) {
//takes the img array and the imgRef to swap
	if(document.images) {
		document.images[imgRef].src = imgArray[imgRef].src;
	}

}

function increaseText(elemID) {
	var ref =  document.getElementById(elemID);
	var sz = ref.style.fontSize;
	if(sz) {
		sz = sz.slice(0,-1); //pull off the % sign
		newSz = parseInt(sz);
		newSz += 10;
		newSz += "%"; //now cast back to a string
		ref.style.fontSize = newSz;	
	}
	else {
		ref.style.fontSize="110%";
	}
	
}

function decreaseText(elemID) {
	var ref =  document.getElementById(elemID);
	var sz = ref.style.fontSize;
	if(sz) {
		if(sz == "10%")
			;//do nothing more
		else {
			sz = sz.slice(0,-1); //pull off the % sign
			newSz = parseInt(sz);
			newSz = newSz - 10;
			newSz += "%"; //now cast back to a string
			ref.style.fontSize = newSz;
		}
	}
	else {
		ref.style.fontSize="90%";
	}
}

function normalizeText(elemID) {
	var ref =  document.getElementById(elemID);
	ref.style.fontSize="100%";
}

function randomIcon(imgID) {
	if(document.images) {
	var imgTotal = 26;//this is highest number of images currently in the directory (you have to adjust this yourself)
		var imgNo = Math.round(Math.random()*imgTotal);
		imgNo = new String(imgNo);
		imgNo=(imgNo.length < 2) ? ("0"+imgNo+"") : imgNo ; //fill it out
		document.images[imgID].src = "images/revolve"+imgNo+".jpg";
	}
}

function openImgWindow(imgID) {
	//This opens an image window depending on the height and so forth of the image
	var dimdist= 50;
		
	var bigImgSrc = document.images[imgID].src;
	bigImgSrc = bigImgSrc.slice(0, (bigImgSrc.lastIndexOf('/')+1))+"bigRevolve/big"+bigImgSrc.slice((bigImgSrc.lastIndexOf('/')+1));
	var bigImg = new Image();
	bigImg.src = bigImgSrc;
	
	var bigImgID = "bigImgID";	
	var dimwinW = 850;
	var dimwinH = 650;
	
	var dimstr = "screenX=50, screenY=50, top=50, left=50, height="+dimwinH+",width="+dimwinW+",";
	dimstr += "innerHeight="+dimwinH+",innerWidth="+dimwinW+", resizable=yes";

	var nw = window.open("", "", dimstr);
	nw.document.write("<head><title></title></head><body bgcolor=\"#FFFFFF\" style=\"padding: 0px; margin: 0px;\"><center>");
	nw.document.write("<img id="+bigImgID+" src="+bigImg.src+" alt='' border='0'/>");
		//unfortunately can't put in the width and height otherwise run into problems.
	nw.document.write("<br/><a href=\"javascript: self.close();\">Close Window</a></center></body>");
	return nw.focus();
}


/* Debug functions*/
function appendBody(elem){
	bodyRef = document.getElementsByTagName("body").item(0);
	bodyRef.appendChild(elem);
}
