﻿function zoom(elementName){

	var zoomFactor=6;
	
	screenwidth=screen.availWidth;
	screenheight=screen.availHeight; 
	
	//retrieve the info we need from the DOM, 
	
	img = document.getElementById(elementName);
	
	var imgSrc = img.src;
	var imgAlt = img.alt;
	var imgWidth = img.width;
	var imgHeight = img.height;
	var imgAspectRatio=(imgHeight/imgWidth);
	
	var zoomWidth=imgWidth + (imgWidth*zoomFactor);
	var zoomHeight=zoomWidth*imgAspectRatio;
	
	var top = (screenheight/2) - (zoomHeight/2);
	var left = (screenwidth/2) - (zoomHeight/2);
	
	
	//Going to to determine the window title from the ALT text
	
    winTitle  = imgAlt;
	newWindow = window.open("","Oldsea","width="+(zoomWidth+40)+", height="+(zoomHeight+40)+", scrollbars=no, top="+top+", left=" + left);
	newWindow.document.write("<html><head><title>"+winTitle+"</title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><meta http-equiv='imagetoolbar' content='no'></head>");
	newWindow.document.write("<link href='Seafordian/css/popup.css' rel='stylesheet' type='text/css'>");
	newWindow.document.write("<body onBlur='self.close()'>");
	newWindow.document.write("<div class='img'><img src='"+imgSrc+"'width="+(zoomWidth)+" height="+zoomHeight+" alt='"+imgAlt+"' title='"+imgAlt+"'></div>");
	newWindow.document.write("");
	newWindow.document.write("<div style='text-align:center;' ><a href='javascript:window.close();'>Close this window</a></div></body></html>");
	}
