/*
Pasandole a estas dos funciones el ancho y el alto de la nueva ventana a abrir, y la ventana
respecto de la cual queremos obtener el centrado, nos devuelven las posiciones X y Y a poner en
left y top respectivamente.
*/

function obtenerObjeto(Id)                                                                 
    {                 
      var obj = null;                                                                                                       
      // Netscape 6,7 y Explorer 5                                                         
      if (document.getElementById) {                                                       
        obj = document.getElementById(Id);                                                                                                                                                                                          
      }                                                                                    
      // Explorer 4                                                                        
      else if (document.all) {                                                             
        obj = document.all[Id];                                                      
      }                                                                                    
      // Netscape 4                                                                        
      else if (document.layers) {                                                          
        obj = document.layers[Id];                                                   
      }      
	  return obj;      
    }

function centradoX(ventanaRelativa,anchoVentana){
	var ns = (document.layers)? true:false
	var offsetX;
	
	tmp = 'ns?window.'+ventanaRelativa+'.innerWidth:'+ventanaRelativa+'.document.body.offsetWidth';
	wWidth	= eval(tmp);
	
	return(Math.ceil(wWidth/2)-(parseInt(anchoVentana)/2));
}

function centradoY(ventanaRelativa,altoVentana){
	var ns = (document.layers)? true:false
	var offsetY;

	tmp = 'ns?window.'+ventanaRelativa+'.innerHeight:'+ventanaRelativa+'.document.body.offsetHeight';
	wHeight	= eval(tmp);

	return(Math.ceil(wHeight/2)-(parseInt(altoVentana)/2));
}
