/**
 * The default features to pass to the window.open function
 */
var OPEN_WINDOW_DEFAULT_FEATURES = 'toolbar=no,location=no,directories=no,scrollbars=yes,status=no,menubar=no,resizable=yes,width=750,height=632,left=200';
 
/**
 * Abre una nueva ventana con la url deseada y con las opciones predeterminadas
 * @param url La URL a cargar en la nueva ventana
 * @param features The features to be passed to window.open
 * @return The new window
 */  
function openWindow (url, features) {
 if (typeof features == "undefined") {
  var features = OPEN_WINDOW_DEFAULT_FEATURES;
 }
 // url is passed directly if it's an absolute address
 protocol = url.substring(4,0);
 if (protocol.toLowerCase().indexOf("http") == -1) {
  // otherwise it's checked the <base> tag 
  var oBaseColl = document.getElementsByTagName('BASE');
  if (oBaseColl && oBaseColl.length > 0 && url.charAt(0)!='/') {
   // and if it's not empty the url is appended to it
   url = oBaseColl[0].href + url;
  }
 }
 return window.open(url, 'NuevaVentana', features);
}
 
/**
 * Llama a la función openWindow pasando como URL el atributo href del objeto src.
 * @param src Un objeto que contenga la propiedad href
 * @param features The features to be passed to window.open
 * @return The new window
 */
function openWindowLink(src, features) {
 if (typeof features == "undefined") {
  var features = OPEN_WINDOW_DEFAULT_FEATURES;
 } 
    return openWindow(src.getAttribute('href'), features);
}
 
 /**
  * Abre una nueva ventana pasando como URL el atributo href del objeto src y el nombre de la ventana.
  * Permite abrir nuevas ventanas no relacionadas con las pop-up.
  * Útil yo que en XHTML no se puede utilizar el atributo "target"
  * @param src Un objeto que contenga la propiedad href
  * @param target The name of the new window to open
  * @return The new window
  */
 function openWindowLinkBlank(src, target) {
    return window.open(src.getAttribute('href'), target);
 }

