function PopupScreenCentre(url,name,width,height,scrollbars,toolbar) {
	var titleBarHeight, windowBorderWidth
	titleBarHeight = 24
	windowBorderWidth = 4

	var screenWidth, screenHeight
	screenWidth = 800
	screenHeight = 600

	if (window.screen) {
		if (window.screen.availWidth) {
			// ok browser has the appropriate properties we need to centre it
			screenWidth = window.screen.availWidth
			screenHeight = window.screen.availHeight
		}
	}

	var windowWidth = windowBorderWidth + width + windowBorderWidth
	var windowHeight = titleBarHeight + height + windowBorderWidth

	var left = (screenWidth - windowWidth) / 2
	var top = (screenHeight - windowHeight) / 2

	window.open(url,name,'left='+left+',top='+top+',screenX='+left+',screenY='+top+',width='+width+',height='+height+',scrollbars='+scrollbars+',toolbar='+toolbar+',resizable=0,location=0,directories=0,status=0,menubar=0,copyhistory=0')
}

function PreviewFlyer(id) {
	var url = "FlyerPopup.asp?id=" + id
	PopupScreenCentre(url,"",621,550,0,0)
}

function PrintPreviewFlyer(id) {
	var url = "FlyerView.asp?format=print&id=" + id
	window.open(url,"","location=no,status=no,resizable=yes,toolbar=no,menubar=yes,width=680,scrollbars=yes")
}


function PreviewMVCFlyer(id) {
	var url = "FlyerPopupMVC.asp?id=" + id
	PopupScreenCentre(url,"",621,550,0,0)
}
function PrintPreviewMVCFlyer(id) {
	var url = "http://goflyers.gogogo.co.nz/FlyerView?format=print&id=" + id
	window.open(url,"","location=no,status=no,resizable=yes,toolbar=no,menubar=yes,width=680,scrollbars=yes")
}

function ShowHideDiv(elementID, checkbox) {
	var prop
	if (document.getElementById) 
		prop = document.getElementById(elementID).style
	else if (document.all)
		prop = document.all[elementID].style
	else if (document.layers)
		prop = document.layers[elementID]
	
	if (checkbox.checked)
		prop.display = ''
	else
		prop.display = 'none'
}

