/*Viewimage.js javascript used to bring up images in a popup window using unobtrusive javascript
Written by William Green, CNYAviation.com*/

window.onload = prepareLinks;



function prepareLinks() 
{
	function makeNewWindow()
	{
	newWindow = window.open("","", "status=no, menubar=no, location=no, toolbar=no, resizeable=no, top=200, left=100, height=600, width=680");
	}
	
	var gallery = document.getElementById("gallery");
	var photoLinks = gallery.getElementsByTagName("a");
	for (var i=0; i<photoLinks.length; i++)
	{
			photoLinks[i].onclick = function() 
			{
				var fileName = this.getAttribute("href");
				var photoDesc = this.getAttribute("alt");
				
					if (photoDesc == null)
						{photoDesc = "Description Not Available Yet";}
					
								
				makeNewWindow();
		
				newWindow.focus();
	
				var newContent="<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"../css/screen/photostyle.css\"/><title>"+fileName+"</title></head>";
				newContent += "<body><p align=\"center\"><img src="+fileName+"></p>";
				newContent += "<p align=\"center\">"+photoDesc+"</p>";
				newContent += "<p align=\"center\"><input type=\"button\" value=\"Close\" onclick=\"window.close();\"/></p>";
				newContent += "</body></html>";
		
				newWindow.document.write(newContent);
				return false;
			}
	}
}