function is_numeric(sText) {
	var ValidChars = "0123456789.";
	var Char;
	if(sText == null) return false;
	if(sText == "") return false;
	for(i=0; i<sText.length; i++) {
		Char = sText.charAt(i);
		if(ValidChars.indexOf(Char) == -1) return false;
	}
	return true;
}

var ns = (navigator.userAgent.indexOf("MSIE") < 0) ? true : false;

function nl2br(str) {
	return str.replace(/\n/gi, "<br />", str);
}

function show(e) {
	if (document.getElementById) {
		// this is the way the standards work
		if(document.getElementById(e) != null) {
			document.getElementById(e).style.visibility = "visible";
			document.getElementById(e).style.display = "";
		}
	} else if (document.all) {
		// this is the way old msie versions work
		if(document.all[e] != null ) {
			document.all[e].style.visibility = "visible";
			document.all[e].style.display = "";
		}
	} else if (document.layers) {
		// this is the way nn4 works
		if(document.layers[e] != null) document.layers[e].visibility = "visible";
	}
}

function hide(e) {

	if (document.getElementById) {
		if(document.getElementById(e) != null) {
			// this is the way the standards work
			document.getElementById(e).style.visibility = "hidden";
			document.getElementById(e).style.display = "none";
		}
	} else if (document.all) {
		// this is the way old msie versions work
		if(document.all[e] != null ) {
			document.all[e].style.visibility = "hidden";
			document.all[e].style.display = "none";
		}
	} else if (document.layers) {
		// this is the way nn4 works
		if(document.layers[e] != null) document.layers[e].visibility = "hidden";
	}
}

function toggle(e) {

	if (document.getElementById) {
		// this is the way the standards work
		if(document.getElementById(e) != null) {
			if(document.getElementById(e).style.visibility != "hidden") {
				document.getElementById(e).style.visibility = "hidden";
				document.getElementById(e).style.display = "none";
			} else {
				document.getElementById(e).style.visibility = "visible";
				document.getElementById(e).style.display = "";
			}
		}
	} else if (document.all) {
		// this is the way old msie versions work
		if(document.all[e] != null ) {
			if(document.all[e].style.visibility != "hidden") {
				document.all[e].style.visibility = "hidden";
				document.all[e].style.display = "none";
			} else {
				document.all[e].style.visibility = "visible";
				document.all[e].style.display = "";
			}
		}
	} else if (document.layers) {
		// this is the way nn4 works
		if(document.layers[e] != null) {
			if(document.layers[e].visibility != "hidden") {
				document.layers[e].visibility = "hidden";
			} else {
				document.layers[e].visibility = "visible";
			}
		}
	}
}

function getElement(e) { // Element id should be passed in as a string
	if(document.getElementById) return document.getElementById(e);
	else if(document.all) return document.all[e];
	else if(document.layers) return document.layers[e];
	return null; // couldn't find element
}

function trim(str) { // Remove leading and trailing whitespace
	if(typeof(str) != "string") return str;
	while(str.charAt(0) == " ") str = str.substr(1);
	while(str.charAt(str.length-1) == " ") str = str.substr(0, str.length-1);
	return str;
}