//String Trims (http://www.somacon.com/p355.php) Public Domain
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

//http://www.thescripts.com/forum/thread89672.html
String.prototype.isNumeric = function() {
	return typeof this != "boolean" && this !== null && !isNaN(+ this); //why not regex?  Scientific notation, pi, e, etc...
}
String.prototype.isInteger = function() {
	if (this.isNumeric()) {
		if (Math.round(this) == this) return true;
	}
	return false;
}

function gid(id) {
	return document.getElementById(id);
}

function fraction_popup(url) {
	var ratio = 0.75;
	var def_x = 800;
	vardef_y = 600;
	parent_x = document.documentElement.clientWidth;
	if (!parent_x) parent_x = document.body.clientWidth;
	if (!parent_x) parent_x = window.innerWidth;
	if (!parent_x) parent_x = def_x;
	parent_y = document.documentElement.clientHeight;
	if (!parent_y) parent_y = document.body.clientHeight;
	if (!parent_y) parent_y = window.innerHeight;
	if (!parent_y) parent_y = def_y;
	var child_x = ratio * parent_x;
	var child_y = ratio * parent_y;
	window.open(url, "pop_window", "status=1, scrollbars=1, width="+child_x+", height="+child_y);
	return false;
}

function colHeightBalance() {
	var height = 0;
	var col;
	var index;
	for (index = 0; index < arguments.length; index++) {
		col = gid(arguments[index]);
		height = Math.max(height, col.offsetHeight);
  }
	for (index = 0; index < arguments.length; index++) {
		col = gid(arguments[index]);
		col.style.height = height+'px';
	}
}