// JavaScript Document

//Esta función se encargará de abrir una nueva ventana con el tamaño de la imagen pasada como parámetro

function enlargeImage(img){
	
	var src = img.src;
	src = src.replace("_P.", "_G." );
	var title = img.title;
	var newImg = new Image();
	newImg.src = src;
	var winWidth = newImg.width+50;
	var winHeight = newImg.height+50;
	var win = eval("window.open('', '','left=0, top=0, width='+winWidth+', height='+winHeight+';')");
	var doc = win.document;
	doc.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> \n ");
	doc.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">  \n");
	doc.write("<head> \n");
	doc.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" /> \n");
	doc.write("<title>"+title+"<\/title>");
	doc.write("<\/head> \n");
	doc.write("<body style='margin:5px; text-align:center;' onload='opener.resizeImageWindow(this)'> \n ");
	doc.write("<img src='"+src+"' alt='"+title+"' \/>   \n");
	doc.write("<\/body> \n <\/html>");
	doc.close();
	win.focus();
}
 
function resizeImageWindow(win){
	
	var img = win.document.images[0];
	var w;
	var h;
	if (navigator.appName == 'Netscape'){
		w = img.width+50;
		h = img.height+70;

	}else{	
		w = img.width+50;
		h = img.height+50;
	}
	win.resizeTo(w,h);

}

//Esta función se encargará de abrir una nueva ventana con el documento pasado como parámetro la anchura, altura, scrollbar indicada.

function ventana(documento, w, h, sb){
	
	window.open( documento, '','resizable=yes, scrollbars='+sb+',  left=0, top=0, width='+w+', height='+h+'');

}

function openW(documento,w,h, sb){
	
	var screenWidth 	= screen.width;
	var screenHeight 	= screen.height;
	var x = (screenWidth -  w)/2;
	var y = (screenHeight - h)/2;
	window.open( documento, '','resizable=yes, scrollbars='+sb+',  left='+ x +', top='+ y +', width='+w+', height='+h+'');

}