// JavaScript Document
// Pop-Up Embedder by David Battino, www.batmosphere.com
// DigiTokyo Black Version

var UniqueID = 314 // Identify pop-ups so subsequent ones don't replace current one; increment each time function runs
var newWinOffset = 0 // Position of first pop-up
var now = new Date
function PopImage(filedesc,filepath,origwidth,origheight,wincolor) {

var winBG=wincolor;
var winTXT="white"; // Consider toggling white/black based on numerical value of wincolor. E.g., if R, G, or B > FF/2, make text black.
// alert("wincolor="+parseInt(wincolor,16));
if (!wincolor || wincolor=="white"){
      winBG="white";
      winTXT="black";
   }


 
PictureWin = window.open('',UniqueID,'top=' + newWinOffset +',left=' + newWinOffset + ',position=' + newWinOffset +',width='+screen.availWidth+',height='+screen.availHeight+',resizable=1,scrollbars=1'); 
PictureWin.document.write("<HTML><HEAD><TITLE>" + filedesc + "</TITLE></HEAD>");
PictureWin.document.write("<BODY bgcolor='"+ winBG +"' text='"+ winTXT +"' link='red' vlink='red'>");
PictureWin.document.write("<DIV align='center'><FORM>");
PictureWin.document.write("<INPUT type='button' value='Close this window' onClick='javascript:window.close()'><BR><BR>");
PictureWin.document.write("<IMG SRC='" + filepath + "' title='" + filedesc + "' alt='" + filedesc + "' width='" + origwidth + "' height='" + origheight + "'>");
PictureWin.document.write("<BR><BR><INPUT type='button' value='Close this window' onClick='javascript:window.close()'>");
PictureWin.document.write("<BR><BR>Copyright &copy;" + now.getFullYear() + " <a href='http://www.digitokyomap.com' target='_blank'>DigiTokyo Joint Venture</a><BR><BR>");
PictureWin.document.write("</FORM></DIV>");
PictureWin.document.write("</BODY></HTML>");
PictureWin.document.close(); // "Finalizes" new window
UniqueID = UniqueID + 1 // gives subsequent pop-ups new ID
// newWinOffset = newWinOffset + 24 // subsequent pop-ups will be this many pixels lower and to the right.
}