function trim(s) {
	lTrim = s.replace( /^\s*/, "" );
	rtrim = lTrim.replace( /\s*$/, "" );
	return rtrim;
}

function goTo(url) {
	location.href = url;
}

function showLayer(id) {
	if (document.getElementById(id).style.display == "none") {
		document.getElementById(id).style.display = "block";
	}
}

function hideLayer(id) {
	if (document.getElementById(id).style.display != "none") {
		document.getElementById(id).style.display = "none";
	}
}

function toggleLayer(id) {
	document.getElementById(id).style.display = (document.getElementById(id).style.display == "none") ? "block" : "none";
}

function popup(url,name,w,h,scroll,status,resize) {
	L = (screen.width - w) / 2;
	T = (screen.height - h) / 2;
	winProps = "width=" + w;
	winProps += ",height=" + h;
	winProps += ",scrollbars=" + scroll;
	winProps += ",status=" + status;
	winProps += ",resizable=" + resize;
	winProps += ",left=" + L;
	winProps += ",top=" + T;
	popupWindow = window.open(url,name,winProps);
}

function goTo(url) {
	window.document.location = url;
}

function expand(divPost,divLead,divText) {
	// Get the current display value of the post layer
	currDisplay = document.getElementById(divPost).style.display;
	// Figure out what we'll change things to
	if (currDisplay == "none") {
		if (divLead != "") {
			document.getElementById(divText).style.display = "none";
			document.getElementById(divLead).style.display = "block";
		} else {
			document.getElementById(divText).style.display = "block";
		}
		document.getElementById(divPost).style.display = "block";
	} else {
		if (divLead != "") {
			document.getElementById(divLead).style.display = "none";
		}
		document.getElementById(divText).style.display = "none";
		document.getElementById(divPost).style.display = "none";
	}
}
