// popup window reference, so we can ensure we only open one pop-up
var objWin = null;

// open a popup window, and format us per params
function popupWindow(pURL, pName, pWidth, pHeight, pScroll, pResize, pToolbar, pMenu){
 var strParams='';
 intLeft = (screen.width) ? (screen.width-pWidth)/2 : 0;
 intTop = (screen.height) ? (screen.height-pHeight)/2 : 0;
 strParams+='height=' + pHeight + ', ';
 strParams+='width=' + pWidth + ', ';
 strParams+='top=' + intTop + ', ';
 strParams+='left=' + intLeft;
 
 (pScroll) ? strParams+=', scrollbars=yes' : '';
 (pResize) ? strParams+=', resizable=yes' : '';
 (pToolbar) ? strParams+=', toolbar=yes' : '';
 (pMenu) ? strParams+=', menubar=yes' : '';

 if (pURL!='')
  objWin = window.open(pURL, pName, strParams);
 
 if(objWin.window.focus)
  objWin.window.focus();
}

function trim(pText){
  return pText.replace(/^\s{1,}/, "").replace(/\s{1,}$/, "");
}

function gotoURL(url){
  location.href = url;
}
