/*************************************************************************************
	Office of Communication's JavaScript Library

    Remember to add the following command to the <HEAD> of your HTML/ASP page:
    [script language=javascript src="/NWCM/WireFrame/js/OC.js"[/script]

	Author: John Nguyen
	Created 02/12/2004
 *************************************************************************************/

// removes any erroneous whitespaces
function Trim(str) {
	var left = /^\s+/;
	var right = /\s+$/;
	return str.replace(right,"").replace(left,"");
}

// checks for empty string
function isEmpty(str) {
	return (Trim(str)=="");
}

// checks for valid syntax email adresses - one or more
function verifyEmail(str) {
	//one email patern
	var reg = /^[0-9a-zA-Z_\.\-]+@[0-9a-zA-Z\-\._]+\.[0-9a-zA-Z]+$/;
	//multiple email patern
	var reg1 = /^([0-9a-zA-Z_\.\-]+@[0-9a-zA-Z\-\._]+\.[0-9a-zA-Z]+[\,\;\s]*)+$/;
	return reg1.test(Trim(str));
}

// pop up a new window with the required URL parameter, winName & features are optional 
function popWindow(theURL,winName,features) {
  		
	var height = screen.availHeight/2;
	var width = screen.availWidth/2;
	var options = "width="+width+",height="+height+",toolbar=yes,location=yes,directories=yes,menubar=yes,scrollbars=yes,resizable=yes";
	
	if(winName==null){
		winName = "NIMHPopUpWindow";
	}
	
	if(features==null){
		features=options;
	}
	
	popWin = window.open(theURL,winName,features);
	popWin.focus();
}