var popUpWin=0;

function popUpWindow(URLStr, width, height, scrollbars)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  
  // Obtiene la posición correcta para centrar el popup
  xpos=(screen.width/2)-(width/2);
  ypos=(screen.height/2)-(height/2);
//'+scrollbars+'
  popUpWin = window.open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + scrollbars + ',resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+xpos+', top='+ypos+',screenX='+xpos+',screenY='+ypos+'');
  return popUpWin;
}

function redimensionar(ancho, alto)
{
	popUpWin.resizeTo(ancho,alto);
	
	//centra la ventana
	popUpWin.moveTo((screen.width-ancho)/2,(screen.height-alto)/2);
}

function abrir_ventana(url,width,height,scrollbars) {
    var izq = (screen.width - width) / 2;
    var arr = (screen.height - height) / 2;
    return window.open(url,'ven1','toolbar=no,location=no,status=no,menubar=no,scrollbars=' + scrollbars + ',resizable=yes,width=' + width + ',height=' + height + ',left=' + izq + ',top=' + arr + '\'');
}
