// JavaScript Document

var imageWidth=620, imageHeight=500;
var windowWidth, windowHeight;
var thumbHeight;
var agent = navigator.userAgent.toLowerCase();
var mac = (agent.indexOf("mac")!=-1);
var ie = ((agent.indexOf("msie") != -1) && (agent.indexOf('opera')==-1));

window.onresize= resizeThis;
window.onload = resizeThis;

function SetImageDim(Width, Height) {

	imageWidth = Width;
	imageHeight = Height + 70;
	setHeight(document.body.scrollHeight);
}

function setHeight(thumbFrameHeight){
		
//	windowWidth = document.getElementById("phototable").offsetWidth;
//	windowWidth = document.getElementById("container").offsetWidth - //document.getElementById("container").offsetLeft;

	var BottomFrame;
	var TopFrame;

	if (!(mac && ie)){
		windowSize();
		thumbHeight = thumbFrameHeight;
		BottomFrame = document.getElementById("BottomFrame");
		TopFrame = document.getElementById("TopFrame");
		Height = thumbHeight+20;
		FrameHeight = windowHeight-thumbFrameHeight;
		TotalHeight = imageHeight + thumbHeight;
		
		if (FrameHeight < TotalHeight)
		{
			FrameHeight = TotalHeight;
		}
		
		if (document.getElementById("phototable"))
		{
		PhototableWidth = document.getElementById("phototable").offsetWidth;
//		document.getElementById("phototable").style.width = PhototableWidth + "px";
		

//		BottomFrame.style.height=thumbHeight + "px";
		BottomFrame.style.top=imageHeight + "px";
		TopFrame.style.height=imageHeight + "px";
		
		TopFrame.style.width=imageWidth + 12 + "px";
		BottomFrame.style.width=PhototableWidth  - 10 + "px";
		
//		document.getElementById("phototable").style.width = PhototableWidth + "px";
//		document.getElementById("phototable").style.height = FrameHeight;
		


		document.getElementById("phototable").offsetWidth;
		}
	}
}

function resizeThis(){
	setHeight(thumbHeight);
}

function windowSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;

  }
  windowWidth = myWidth - document.getElementById('container').offsetLeft;
  windowHeight = myHeight - document.getElementById('container').offsetTop;
//  windowwidth = document.getElementById('container').style.width
//  windowHeight = document.getElementById('container').style.height

}
