

function advanceTopImages(){
	//reset counter to 1 if it reaches 4; otherwise increment by 1
	currImageTop = (currImageTop == topCaptionArray.length-1) ? 0 : ++currImageTop;
	document.getElementById("topCaption").firstChild.data = topCaptionArray[currImageTop];
	document.getElementById("topImage").src = "/phpThumb_1.6.0/phpThumb.php?w=210&src=" + topJpegArray[currImageTop];	
}

function advanceBottomImages(){
	//reset counter to 1 if it reaches 4; otherwise increment by 1
	currImageBottom = (currImageBottom == bottomCaptionArray.length-1) ? 0 : ++currImageBottom;
	document.getElementById("bottomCaption").firstChild.data = bottomCaptionArray[currImageBottom];
	document.getElementById("bottomImage").src = "/phpThumb_1.6.0/phpThumb.php?w=210&src=" + bottomJpegArray[currImageBottom];
}

function openTopWindow(){
	im.src = 'topJpegArray[currImageTop]';
}

function openWindow(imageURL){ 
	var popImageWin = window.open('' , 'Vane' , 'width=400, height=400, top=40, left=40, status=no, toolbar=no, menubar=no , location=no'); 

	popImageWin.document.write('<html><head><title>Vane</title>');
	popImageWin.document.write('<style>body{margin: 0px;}</style></head>'); 
	popImageWin.document.write('<body onLoad="self.focus();" onBlur="window.close();"><img id="pic" style="display: none" /><span style="width: 100%; text-align: center;">'); 
	popImageWin.document.write('</span></body></html>'); 

	var img = new Image(); 
	img.onload = function() {
		sizeImgWin(popImageWin, img)
	}; 
	img.src = imageURL; 
} 

function sizeImgWin(win, img){ 
	var new_w = img.width; 
	var new_h = img.height; 
	var old_w = win.innerWidth || win.document.body.offsetWidth; 
	var old_h = win.innerHeight || win.document.body.offsetHeight; 
	if (!new_w) { new_w = old_w; } 
	if (!new_h) { new_h = old_h; } 
	new_w -= old_w; 
	new_h -= old_h; 
	win.resizeBy(new_w,new_h); 
	var pic = win.document.getElementById('pic'); 
	pic.src = img.src; 
	pic.style.display = 'block'; 
}
