var width = screen.width
if(width<=800) { document.location.href="altindex.html" }

var scrollBarWidth = 25
var scaleFactor = 0.7		// scale if image would otherwise occuppy > 70% of column width
var boolScaleTW = false
var boolScaleDW = false
var boolScaleHW = false
var boolScaleSp = false

function getHomePageWidth() {

	// browser dependent width detection

	if (parent.window.Main.innerWidth){ // frame dimensions in netscape
		homeWidth = (parent.window.Main.innerWidth)
	}
	else	{ // frame dimensions in IE or Opera
		homeWidth = (top.Main.document.body.clientWidth)
	}
	homeWidth = homeWidth - scrollBarWidth

	// preload homepage images to get their dimensions
	var TWMain = new Image
	var TWinset = new Image
	var DWMain = new Image
	var DWinset = new Image
	var HWMain = new Image
	var HWinset = new Image
	var Special = new Image

	TWMain.src  = "images/photo1.jpg"
	TWinset.src = "images/photo2.jpg"
	DWMain.src  = "images/photo3.jpg"
	DWinset.src = "images/photo4.jpg"
	HWMain.src  = "images/photo5.jpg"
	HWinset.src = "images/photo6.jpg"
	Special.src  = "images/taperedgrid.jpg"

	WidthTWMain   = TWMain.width
	HeightTWMain  = TWMain.height
	WidthTWinset  = TWinset.width
	HeightTWinset = TWinset.height
	WidthDWMain   = DWMain.width
	HeightDWMain  = DWMain.height
	WidthDWinset  = DWinset.width
	HeightDWinset = DWinset.height
	WidthHWMain   = HWMain.width
	HeightHWMain  = HWMain.height
	WidthHWinset  = HWinset.width
	HeightHWinset = HWinset.height
	WidthSpecial  = Special.width
	HeightSpecial = Special.height

	// scale main & inset images if required

	boolScaleTW = ((2*WidthTWMain/homeWidth)>scaleFactor)
	boolScaleDW = ((2*WidthDWMain/homeWidth)>scaleFactor)
	boolScaleHW = ((2*WidthHWMain/homeWidth)>scaleFactor)
	boolScaleSp = ((2*WidthSpecial/homeWidth)>scaleFactor)

	var mainImageWidth = Math.floor(scaleFactor*homeWidth/2)	// scaled width of main image
	var AppliedscaleFactor = (mainImageWidth/WidthSpecial)		// Special = widest image on page


	if (boolScaleTW) {
		document.TWmain.width  = mainImageWidth
		document.TWmain.height  = Math.floor(AppliedscaleFactor*HeightTWMain)
		document.TWinset.width  = Math.floor(AppliedscaleFactor*WidthTWinset)
		document.TWinset.height = Math.floor(AppliedscaleFactor*HeightTWinset)
	}
	else {
		document.TWmain.width  = WidthTWMain
		document.TWmain.height = HeightTWMain
		document.TWinset.width  = WidthTWinset
		document.TWinset.height = HeightTWinset
	}
	if (boolScaleDW) {
		document.DWmain.width  = mainImageWidth
		document.DWmain.height = Math.floor(AppliedscaleFactor*HeightDWMain)
		document.DWinset.width  = Math.floor(AppliedscaleFactor*WidthDWinset)
		document.DWinset.height = Math.floor(AppliedscaleFactor*HeightDWinset)
	}
	else {
		document.DWmain.width  = WidthDWMain
		document.DWmain.height = HeightDWMain
		document.DWinset.width  = WidthDWinset
		document.DWinset.height = HeightDWinset
	}
	if (boolScaleHW) {
		document.HWmain.width  = mainImageWidth
		document.HWmain.height = Math.floor(AppliedscaleFactor*HeightHWMain)
		document.HWinset.width  = Math.floor(AppliedscaleFactor*WidthHWinset)
		document.HWinset.height = Math.floor(AppliedscaleFactor*HeightHWinset)
	}
	else {
		document.HWmain.width  = WidthHWMain
		document.HWmain.height = HeightHWMain
		document.HWinset.width  = WidthHWinset
		document.HWinset.height = HeightHWinset
	}
	if (boolScaleSp) {
		document.Specialmain.width  = mainImageWidth
		document.Specialmain.height = Math.floor(AppliedscaleFactor*HeightSpecial)
	}
	else {
		document.Specialmain.width  = WidthSpecial
		document.Specialmain.height = HeightSpecial
	}
}