/**
* pops up a new window
*
* @param    url     string  the url
* @param    name    string  the window's new name
* @param    width   integer the width
* @param    height  integer the height
**/
function popup(url,name,width,height) {
  width = width + 80;
  height = height + 50;
  var today = new Date();
  var todayTime = today.getTime();
  var scrollbars = 'yes';
  name = name.match(/^\w+/)[0] + todayTime;
  px = (screen.availWidth - 10 - width) / 2;
  py = (screen.availHeight - 20 - height) / 2;
  settings="toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars="+scrollbars+",resizable=yes,left="+px+",top="+py+",width="+width+",height="+height;
  var popupWindow=window.open(url,name,settings);
  return popupWindow;
}

/* Adds an onload event without overwriting the previous one
   Please use THIS function for all onloads */
function addCvOnLoadEvent(func)
  {
  if (typeof window.onload != 'function')
    {
    window.onload = func;
    }
  else
    {
    var oldcvonload = window.onload;
    window.onload = function() {
                      oldcvonload();
                      func();
                      }
    }
  }

function setIframeHeight(iframeName) {
  var iframeWin = window.frames[iframeName];
  var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
  if ( iframeEl && iframeWin ) {
    iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous  
    var docHt = getDocHeight(iframeWin.document);
    // need to add to height to be sure it will all show
    if (docHt) iframeEl.style.height = docHt + 40 + "px";
  }
}

function selectorHideShowPages(curpage, prefix, numpages, prefix2 )
    {
    for(n=0; n < numpages ; n++)
        {
        document.getElementById(prefix + n).style.display = 'none';
        document.getElementById(prefix2 + n).className = '';
        document.getElementById(prefix2 + n).style.backgroundColor = '';
        }
        n = curpage;
        document.getElementById(prefix + n).style.display = 'block';
        document.getElementById(prefix2 + n).className = 'selectedWizardPage';
        document.getElementById(prefix2 + n).style.color = '#6699CC';
        document.getElementById(prefix2 + n).style.backgroundColor = '#CCCCFF';
    }
