function roll(id) {
	new_img = "url('images/bg_nav1.gif')";
	document.getElementById(id).style.backgroundImage=new_img;
}


function unroll(id) {
	new_img = "url('images/bg_nav0.gif')";
	document.getElementById(id).style.backgroundImage=new_img;
}

function openPopWin(winURL, winWidth, winHeight, winFeatures, winLeft, winTop) {
	var popWin = null    // use this when referring to pop-up window
	var winCount = 0
	var winName = "popWin"
	var d_winLeft = 0  // default, pixels from screen left to window left
	var d_winTop = 0   // default, pixels from screen top to window top
	winName = "popWin"// + winCount++ // unique name for each pop-up window
	// close any previously opened pop-up window
	if (navigator.appName != "Microsoft Internet Explorer" || parseInt(navigator.appVersion) >=4) //do not close if early IE
	if(popWin != null) if(!popWin.closed) popWin.close() 
	
	if (openPopWin.arguments.length >= 4)  // any additional features? 
		winFeatures = "," + winFeatures
	else 
		winFeatures = "" 
	if (openPopWin.arguments.length == 6)  // location specified
		winFeatures += getLocation(winWidth, winHeight, winLeft, winTop)
	else
		winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop)
		popWin = window.open(winURL, winName, "width=" + winWidth  + ",height=" + winHeight + winFeatures)
		
	if (popWin.focus) {popWin.focus()}
}


function getLocation(winWidth, winHeight, winLeft, winTop){
	var winLocation = ""
	if (winLeft < 0)
		winLeft = screen.width - winWidth + winLeft
	if (winTop < 0)
		winTop = screen.height - winHeight + winTop
	if (winTop == "cen")
		winTop = (screen.height - winHeight)/2 - 20
	if (winLeft == "cen")
		winLeft = (screen.width - winWidth)/2
	if (winLeft>0 & winTop>0)
		winLocation =  ",screenX=" + winLeft + ",left=" + winLeft     
				+ ",screenY=" + winTop + ",top=" + winTop
	else
		winLocation = ""
	return winLocation
} 


function trim(inputString) {
		// Removes leading and trailing spaces from the passed string. Also removes
		// consecutive spaces and replaces it with one space. If something besides
		// a string is passed in (null, custom object, etc.) then return the input.
		if (typeof inputString != 'string') { return inputString; }
			var retValue = inputString;
			var ch = retValue.substring(0, 1);
			while (ch == ' ') { // Check for spaces at the beginning of the string
			retValue = retValue.substring(1, retValue.length);
			ch = retValue.substring(0, 1);
		}
		ch = retValue.substring(retValue.length-1, retValue.length);
		while (ch == ' ') { // Check for spaces at the end of the string
			retValue = retValue.substring(0, retValue.length-1);
			ch = retValue.substring(retValue.length-1, retValue.length);
		}
		while (retValue.indexOf('  ') != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
			retValue = retValue.substring(0, retValue.indexOf('  ')) + retValue.substring(retValue.indexOf('  ')+1, retValue.length); // Again, there are two spaces in each of the strings
		}
		return retValue; // Return the trimmed string back to the user
	} 
	
	
function enlarge(item) {
	winURL = "enlarge.html?item="+item;
	openPopWin(winURL, 500, 500, "", "cen", "cen");
}	