var titulopordefecto = "EnergyWatch Espaņa"; 
var ventana=null;
var cont=0;

function abrir(url,nombre,tam_x,tam_y) {
    if (document.all) {var xMax = screen.width, yMax = screen.height;
    var xOffset = (xMax - tam_x)/2, yOffset = (yMax - tam_y)/2;}
    else
    if (document.layers) {var xMax = window.outerWidth, yMax = window.outerHeight;
    var xOffset = (xMax - tam_x)/2, yOffset = (yMax - tam_y)/2;}
	
	ventana=window.open(url,nombre,'width='+ tam_x +',height='+ tam_y +',screenX='+xOffset+',screenY='+yOffset+',  top='+yOffset+',left='+xOffset+'',resizable='yes');
	
}

	
function imagen(url,titulo){

	if(cont==1){
		ventana.close();
		ventana=null;
		cont=0;
	}
	if(titulo==null){
		titulo=titulopordefecto
	}
	
	abrir('','ventana','5','5')
	ventana.blur();

	ventana.document.write('<html><head><title>' + titulo + '</title><script languaje="javascript">self.blur()</script></head><body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no" onUnload="opener.cont=0"><img src="' + url + '" onLoad="opener.redimensionar(this.width, this.height)">');
	
	ventana.opener.document.close();
	cont++;

}
function redimensionar(ancho, alto){
	ventana.resizeTo(ancho+10,alto+25);
	ventana.moveTo((screen.width-ancho)/2,(screen.height-alto)/2);
	ventana.focus();
	return(ventana)
}

function cerrar(){
	if(cont==1){
		ventana.close();
		ventana=null;
	}
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}