var rightColWidth = 760 - leftColWidth;
var rightColLeft = leftColWidth;
var oFrameHeight = contentGridHeight + 225;
var oFrameWidth = 762;
var clientHOffset = 0;
var clientWOffset = 0;
var oFrame = document.getElementById('outerFrame');
var resizeTimer = -1;
document.getElementById('hmenu').style.top = oFrameHeight - 48 + "px";

var here = "" + window.location, pageDigitIndex;

pageDigitIndex = here.lastIndexOf("gal-pic");
var prevPage, nextPage, curPage, curPath = here.substring(0, pageDigitIndex);
var curPageNum = Math.round(here.substr(pageDigitIndex + 7, 2).valueOf());
var prevPageNum = curPageNum - 1, nextPageNum = curPageNum + 1;

//If you loaded a temp view from HomeSite, this will jump the prev/next back to real files:
if (here.indexOf("hs~") >= 0)  curPath = here.substring(0, here.indexOf("hs~"));

var prevPageLink = (prevPageNum) > 0 ? curPath + 'gal-pic' + prevPageNum + '.html' : curPath + '../gallery.html';
var nextPageLink = (nextPageNum) <= 24 ? curPath + 'gal-pic' + nextPageNum + '.html' : curPath + '../gallery.html';
//document.getElementById('buttPrev').style.visibility = (prevPageNum < 1) ? 'hidden' : 'visible';
//document.getElementById('buttNext').style.visibility = (nextPageNum > 24) ? 'hidden' : 'visible';
function goprev(){ top.location.href = prevPageLink; }
function gogall(){ top.location.href = "../gallery.html"; }
function gonext(){ top.location.href = nextPageLink; }
//alert(here + "\n" + prevPageLink + "\n" + nextPageLink)
document.getElementById('buttPrev').style.left = "60px";
document.getElementById('buttGall').style.left = "340px";
document.getElementById('buttNext').style.left = "500px";

document.getElementById('smallMenu').style.top = "30px";

/*
LLlL must set the div so it ends up the right size (FF & Safari doesn't count the border width)
Must compensate for the misreported client window (Safari reports 16 less high and 18 less wide)
Then calculate based on correct numbers and set top and left (adjusted)
*/
if (navigator.appVersion.indexOf("Safari") >= 0)
{  //Safari
	oFrameHeight -= 2;
	oFrameWidth -= 2;
	leftColWidth -= 40;
	rightColWidth -= 40;
	//clientHOffset = 16;
	//clientWOffset = 18;
	document.getElementById('smallMenu').style.left = "200px";
}
else if (navigator.appVersion.indexOf("MSIE") < 0 )
{  //Firefox etc
	oFrameHeight -= 2;
	oFrameWidth -= 2;
	leftColWidth -= 40;
	rightColWidth -= 40;
	clientHOffset = 0;
	clientWOffset = 0;
	document.getElementById('smallMenu').style.left = "20px";
}
else
{ //else IE adjustments since it does margin correctly
	document.getElementById('smallMenu').style.left = "200px";
}

oFrame.style.height = oFrameHeight + "px"; 
oFrame.style.width = oFrameWidth + "px"; 

function centerWindow()
{
	var top = 0, left = 0;
	top = ((document.body.clientHeight + clientHOffset - oFrameHeight) / 2);
	left = ((document.body.clientWidth + clientWOffset - oFrameWidth) / 2);
	top = (top < 0) ? 0 : top;
	left = (left < 0) ? 0 : left;
	oFrame.style.top = top + 'px';
	oFrame.style.left = left + 'px';
	document.getElementById('copyr').style.visibility = 'hidden';//now part of smallMenu
	resizeTimer = -1;
}

function delayResize()
{
	if (resizeTimer != -1) clearTimeout(resizeTimer);
	resizeTimer = setTimeout('centerWindow()', 200);
}//delayResize

window.onresize = delayResize;//re-center
centerWindow();
/*
if (TurnOnBorders) 
{
	LcolDiv.style.border = '1px dotted #0000ff';
	RcolDiv.style.border = '1px dashed #0000ff';
	document.getElementById('contentGrid').style.border = '1px solid #ff0000';
}
*/
