function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}
function testWindowCreation(w) {
	if (w == undefined) {

		alert(
"WARNING: ActivityAlert has attempted to create a second browser window and has failed.\n"+
"This may be the result of a popup blocker or a very high security setting on your browser.\n"+
"\n"+
"	- If you are running a third party popup blocker please enable popup's for www.activityalert.com.\n"+
"    - If you are running the browser popup blocker or at a high security.\n"+
"        Internet Explorer  \n"+
"                - select Tools - Internet Options - Privacy\n"+
"                - select the Edit button, add www.activityalert.com and select allow\n"+
"        Netscape\n"+
"                - select Edit - Preference - Privacy & Security\n"+
"                - allow popup's for www.activityalert.com\n"+
"                - select Tools - Cookie Manager - Unblock\n"+
"        FireFox\n"+
"                - select Tools - Web features - Allowed Sites, add www.activityalert.com\n"+
"                - select Tools - Privacy - Cookies - Exceptions, allow www.activityalert.com\n");

	}
}
function popWindow(url) {

	var w = window.open(url, "_blank", "height=400,width=400,location=no,scrollbars,menubars=no,toolbars=no,resizable=yes,left=25,top=25");
//	testWindowCreation(w);
}

function hiddenWindow(url, field) {

	var w = window.open(url, "_blank", "height=100,width=100,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=no,left=2500,top=2500");
//	if ((w == undefined) && (field != ''))
//		testWindowCreation(w);
	return w;
}

function helperWindow(url) {
    var frame = document.getElementById("aa_helper_frame");
    frame.src = url;
}

function win(url,width,height,target,xoff,yoff){

	if (target === undefined) target = "_blank";
	if (xoff === undefined) xoff = 0;
	if (yoff === undefined) yoff = 0;

	var x = (screen.availWidth - width)/2 + xoff;
	var y = (screen.availHeight - height)/2 + yoff;
	var w = window.open(
		url,
		target,
		('toolbar=no,scrollbars=yes,resizable=no,menubar=no,status=no,directories=no,location=no,width='+width+
		',height='+height+',screenX='+x+',screenY='+y+',left='+x+',top='+y)
	);
//	testWindowCreation(w);
	w.focus();
	return w;
}	

function showHelp(url){

	var helpWin;

	var width = 640;
	var height = 650;
	var x = (screen.availWidth - width)/2;
	var y = (screen.availHeight - height)/2;

	helpWin = window.open(
		url,
		'AAHelpWindow',
		('toolbar=no,scrollbars=yes,resizable=yes,menubar=no,status=no,directories=no,location=no,width='+width+
		',height='+height+',screenX='+x+',screenY='+y+',left='+x+',top='+y)
	);
//	testWindowCreation(helpWin);
	helpWin.focus();
	return helpWin;
}	


function close_refresh(){
	window.opener.location.reload();
	window.close();
}


function disableButton(theButton){
 theButton.value="Processing...";
 theButton.disabled = true;
 theButton.form.submit();
}