//  Malton Show Popups
//  malton-popup.js
//
//  Version: 3.86 :: 08-Sep-2011

var newWindow=null
var pop_html='' +
	'<html><head><title>JavaScript.popup</title>' +
'\n<link rel="stylesheet" type="text/css" href="./malton-popup.css">' +
'\n<script type="text/javascript">function wc(){window.close()}</script>' +
'\n</head>\n<body onclick="wc()">' +
	'\n<table class="tbl" cellpadding="0" cellspacing="0">' +
	'\n<tr><td class="cell" height="%IH" colspan="2">%IMG</td></tr>' +
	'\n<tr><td class="bar"><b>Malton</b>Show<b> %YR</b></td><td class="bar right">%S</td>' +
	'\n<tr><td class="bar-lwr" colspan="2">&nbsp;</td></tr>' +
	'\n</table>\n</body>\n</html>\n'

var pop_opts='' +
	'left=%L,top=%T,height=%H,width=%W,' +
	'menubar=no,resizable=no,titlebar=no,' +
	'scrollbars=no,directories=no,status=no,fullscreen=no'
	
function ic(i) {pop_it(i.src,'')}
function pop_it(i,s) {

	var N=i;if (N.indexOf('/')>=0) N=N.substr(N.lastIndexOf('/')+1)

	var t=s?s:'The Malton Show %YR'

	var o='',r='',n=i,l=i.indexOf('_long')>0,y=2012;
	var w=l?340:570,h=l?450:400
	var img='<div class="cell" style="height:%IHpx;width:%IWpx"><img src="%N" width="%IW" alt=""></div>'
	n+=lcase(n).indexOf('.jpg')>0?'':'.jpg'
	n=(n.indexOf('/')>=0?'':imgs)+n;

	r=pop_html;
	h-=40;
	r=r.replace(/JavaScript.popup/g,t)
	r=r.replace(/%IMG/g,img)
	r=r.replace(/%N/g,n)
	r=r.replace(/%S/g,s)
	r=r.replace(/%IW/g,w)
	r=r.replace(/%IH/g,h)
	r=r.replace(/%YR/g,y)
	
	h+=40
	var l=parseInt((screen.width/2)-(w/2))
	var t=parseInt((screen.height/2)-(h/2))

	o=pop_opts
	o=o.replace(/%L/,l)
	o=o.replace(/%T/,t)
	o=o.replace(/%W/,w)
	o=o.replace(/%H/,h)
	o=o.replace(/NO/,0)

	if (newWindow) newWindow.close()
	newWindow=window.open('','newWindow',o)
	newWindow.document.close()
	newWindow.document.writeln(r)
	newWindow.zorder
	newWindow.focus()

//	alert(r)
}
