var newWindow

function makeNewWindow(n,w,h) {
  newWindow = window.open("","","height="+h+",width="+w)
}

function subWrite(WindowTitle,WindowWidth,WindowHeight,PicName,PicWidth,PicHeight)
{
// make new window if none, else close it and prepare for next try
if (newWindow){
  newWindow.close()
  newWindow = null
  makeNewWindow(WindowTitle,WindowWidth,WindowHeight)
}
else {
  makeNewWindow(WindowTitle,WindowWidth,WindowHeight)
}

var newContent = "<HTML><HEAD><TITLE>MyersStables.com presents...</TITLE></HEAD>"
newContent += "<BODY bgcolor='#ffffff' background='/images/bg/oldpaper.jpg'>"
newContent += "<CENTER><TABLE><TBODY><TR><TD align='center'><FONT face='Arial' size='+1'><B>" + WindowTitle + "</B></FONT></TD></TR><TR>"
newContent += "<TD align='center'><A href='javascript:self.close()'>"
newContent += "<IMG src='" + PicName + "' width='"+PicWidth+"' height='"+PicHeight+"' border='1' align='top' alt='" + WindowTitle + "'></a></TD>"
newContent += "</TR><TR><TD align='center' valign='middle'><A href='javascript:self.close()'>Click to Close Window</A></TD>"
newContent += "</TR></TBODY></TABLE></CENTER></BODY></HTML>"

// write HTML to new window document
newWindow.document.write(newContent)
newWindow.document.close() // close layout stream
}


