function newWindow(xlink,w,h) {
	if (w == null) {
		//set default window width and height to be
		//used if not width and height provided.
		var windowWidth = 500;
		var windowHeight = 150;
	}
	else {
		var windowWidth = w;
		var windowHeight = h;
	}
	
	//position window in middle of screen
	var xTop = (screen.width/2)-(windowWidth/2)
	var xLeft = (screen.height/2)-(windowHeight/2)
	
	var newWindow =
		window.open(xlink,
		"newWindow",
		"width=" + windowWidth + ","+
		"height=" + windowHeight + ","+
		"top=" + xLeft + ","+
		"left=" + xTop + ","+
		"location=no,"+
		"status=no,"+
		"toolbar=no,"+
		"scrollbars=yes,"+
		"resizable=yes"
	);
	newWindow.focus();
}

//trim functions
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+$/,"");
}
