// blowup.js

function showBlowup(divID, imageID) {
	if(document.layers) {
		// Navigator 4 model
		var divObject = document.layers[divID]
		var imageObject = document.images[imageID]
		if (screen.width < 1024) {
			divObject.pageX = 230//imageObject.x
		divObject.pageY = 253//imageObject.y
		}
		else {
			divObject.pageX = 250//imageObject.x
			divObject.pageY = 292//imageObject.y
		}
		divObject.visibility = "visible"
	} else if(document.all) {
		// Internet Explorer model
		var divStyle = document.all.item(divID).style
		var imageObject = document.images[imageID]
		if (screen.width < 1024) {
			divStyle.zoom='50%'
			divStyle.posLeft = 230;
			divStyle.posTop = 253;
		}
		else {
			divStyle.posLeft = 250//(window.event.clientX - window.event.offsetX)
			divStyle.posTop = 292//(Window.event.clientY - window.event.offsetY + document.body.scrollTop)
		}
		if (navigator.appVersion.indexOf("Mac") >= 0) { // work around Mac IE bug
			divStyle.posTop -= document.body.scrollTop
		}
		divStyle.visibility = "visible"
	}
}

function showBlowupInNewWindow(imageFileURL,width,height) {
	// Workaround for Navigator 6
	windowOptions = "directories=0,menubar=0,personalbar=0,status=0,resizable=1,width="
	windowOptions += width + ",height=" + height
	window.open(imageFileURL,"nav6workaround",windowOptions)
}

function hideBlowup(divID) {
	if(document.layers) {
		var divObject = document.layers[divID]
		divObject.visibility = "hidden"
	} else if (document.all) {
		// Use IE DHTML
		var divStyle = document.all.item(divID).style
		divStyle.visibility = "hidden"
	}
}

function showThumbnailFrame(numPics,tableWidth,tableHeight) {
// Setup how we want the table
//var  = 30;
//var  = 9;
//var tableHeight = 8;

	// Set the width for the thumnails
	var thumWidth = 100;
	var thumHeight = 75;
	var i = 0;
	var j = 0;
	var rightColPic = 0;
	var numPrefix = '0';

//alert(screen.width);
	// Make smaller thumbs if we're in low resolution
	if (screen.width < 1024) {
		thumWidth = 50;
		thumHeight = 37;
	}

	// write the table
	document.write('<TABLE ID="tblImages" CELLPADDING="1" CELLSPACING="0" BORDER="0">');
//alert(tableWidth+tableHeight+tableWidth-2);
	for (i = 1; i<=numPics; i++) {
		if (i>9)
			numPrefix = '';
		if (i > (tableWidth+tableHeight+tableWidth-2))
			break;
		if (i==tableWidth+tableHeight-1)
			document.write('<TR>');
		// Check for top or bottom row
		if (i<=tableWidth || i>=tableWidth+tableHeight-1) {
			document.write('<TD ALIGN="left" VALIGN="top" border=1><A href="javascript:void(0)" onMouseOver="showBlowup(\'image'+numPrefix+i+'\',\'eg'+i+'\')" onMouseOut="hideBlowup(\'image'+numPrefix+i+'\')"><IMG name="eg'+i+'" src="image'+numPrefix+ i +'-small.jpg" border=0 width='+thumWidth+' height='+thumHeight+'></A></TD>');
			document.write('<DIV id="image'+numPrefix+i+'"  style="position:absolute;top:250;left:200;height:480;visibility:hidden;margin:-2px;"><A href="javascript:void(0)" onMouseOut="hideBlowup(\'image'+numPrefix+i+'\')" onClick="hideBlowup(\'image'+numPrefix+i+'\')"><IMG src="image'+numPrefix+i+'-big.jpg" border=0 width=640 height=480></A></DIV>');
		}
		else {
			document.write('<TR><TD ALIGN="left" VALIGN="top"><A href="javascript:void(0)" onMouseOver="showBlowup(\'image'+numPrefix+i+'\',\'eg'+i+'\')" onMouseOut="hideBlowup(\'image'+numPrefix+i+'\')"><IMG name="eg'+i+'" src="image'+numPrefix+ i +'-small.jpg" border=0 width='+thumWidth+' height='+thumHeight+'></A></TD>');
			document.write('<DIV id="image'+numPrefix+i+'"  style="position:absolute;top:250;left:200;height:480;visibility:hidden;margin:-2px;"><A href="javascript:void(0)" onMouseOut="hideBlowup(\'image'+numPrefix+i+'\')" onClick="hideBlowup(\'image'+numPrefix+i+'\')"><IMG src="image'+numPrefix+i+'-big.jpg" border=0 width=640 height=480></A></DIV>');
			if (numPics >= ((tableWidth*2)+tableHeight-2) && (i <= (numPics-tableWidth)-(tableHeight-2))) {
				for (j=0; j<tableWidth-2; j++) {
					document.write('<TD></TD>');
				}
				document.write('<TD ALIGN="left" VALIGN="top" border=1><A href="javascript:void(0)" onMouseOver="showBlowup(\'image'+ numPrefix + (((tableWidth*2)+tableHeight-2)+i-tableWidth) +'\',\'eg' + (((tableWidth*2)+tableHeight-2)+i-tableWidth) +'\')" onMouseOut="hideBlowup(\'image'+numPrefix + (((tableWidth*2)+tableHeight-2)+i-tableWidth)+'\')"><IMG name="eg'+ (((tableWidth*2)+tableHeight-2)+i-tableWidth) +'" src="image'+numPrefix+ (((tableWidth*2)+tableHeight-2)+(i-tableWidth)) +'-small.jpg" border=0 width='+thumWidth+' height='+thumHeight+'></A></TD></TR>');
				document.write('<DIV id="image'+numPrefix + (((tableWidth*2)+tableHeight-2)+i-tableWidth)+'"  style="position:absolute;top:250;left:200;height:480;visibility:hidden;margin:-2px;"><A href="javascript:void(0)" onMouseOut="hideBlowup(\'image'+numPrefix + (((tableWidth*2)+tableHeight-2)+i-tableWidth)+'\')" onClick="hideBlowup(\'image'+numPrefix + (((tableWidth*2)+tableHeight-2)+i-tableWidth)+'\')"><IMG src="image'+numPrefix + (((tableWidth*2)+tableHeight-2)+i-tableWidth)+'-big.jpg" border=0 width=640 height=480></A></DIV>');
			}
		}
	}
	document.write('</table>');
}
