/* A few browser sniffs to circumvent some known bugs. */
var sUserAgent = navigator.userAgent.toLowerCase();
var isOp = (sUserAgent.indexOf('opera')!=-1)?true:false;

/****************************************************************
Make a new popup window...
Parameters:
  oAnchor: required object reference to the anchor (link)
  sWindow: optional string for the window name if wanting to reuse window or null to use the default.
  sProps: optional string of window properties ('width=300,height=200') or null to use the defaults defined here.
Notes:
  Notice in the example that the 'href' value maintains URL
  (not "#" or "javascript:") and the 'title' attribute indicates
  this will be a pop-up window. These things are required for
  accessibility reasons.
Example use:
  <a href="/home.jsp" onclick="return pop(this,'survey');" title="Survey opens a new window.">Take our survey!</a>
****************************************************************/
function pop(oAnchor,sWindow,sProps){
	var sUrl = '';
	if(oAnchor.getAttribute) sUrl = oAnchor.getAttribute('href');
	else if(sUrl=='') sUrl = oAnchor.href;
	var oPopup = false;
	if(sUrl && sWindow && sProps) oPopup = window.open(sUrl,sWindow,sProps);
	else if(sUrl && sWindow) oPopup = window.open(sUrl,sWindow);
	else if(sUrl) oPopup = window.open(sUrl);
	/* An Opera bug returns too early if you focus the window, so we don't focus it in that browser. */
	/* Only a noticable defect if a window is already open and hidden. */
	if(oPopup && !isOp) oPopup.focus();
	/* If popup was created successfully, cancel link in calling window. */
	/* Acts as regular link in browser that has pop-up blocking enabled or JavaScript disabled. */
	return (oPopup)?false:true;
}