
/*
	Description:
		Opens a new browser window with 
		only minimum options.
	Parameters:
		url - the url to open new browser to.
		width - the width of the new window.
		height - the height of the new browser window
*/
function openStrippedWindow(url, name, width, height){
	window.open(url,name,'width='+width+',height='+height+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
	//window.open(url,name);
}


/*
	Description:
		Give the focus to the given control.
	Parameters:
		formControl - the control that is to receive focus
*/
function giveFocus(formControl){
	formControl.focus();
}

/*
	Description:
		Builds the url string to report
		an error on a web page.  Also
		prompts for a description of the error.
	Parameters:
		reportToUrl - the url to pass the error details to.
		script - the script that generated the error 
		reporter - the email address of the reporting person
*/
function reportWebError(reportToUrl, script, reporter){
	var reportUrl = reportToUrl + "?script=" + script + "&reporter=" + reporter;
	var description = prompt("Help me help you...\nPlease enter a BREIF description of the problem:");
	reportUrl += "&description=" + description;
	if(description != null)
		window.location = reportUrl;
	else
		alert("Error not reported.");
}

/*
	Description:
		Writes a cookie.
	Parameters:
		name - the name of the cookie.
		value - the value of the cookie.
		expires - the date in which the cookie expires.
		path - the path of the server that is able to read the cookie.
		domain - the domain that is able to read the cookie.
		secure - whether the cookie is secure or not.
*/
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

/*
	Description:
		Validates an email to make sure
		it is in the correct form.
	Parameters:
		emailStr - the email address to validate
	Return:
		Returns true if the email is in valid form
		and returns false if the email if not in correct form.
*/
function validateEmail(emailStr){
	var re = new RegExp(/^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$/);
	var m = re.exec(emailStr);
	if(m == null){
		return false;
	}else{
		return true;
	}
}