// the following function draws on information from http://www.howtocreate.co.uk/tutorials/javascript/browserwindow
// and http://goodies.zitez.net/resizeinnerheight.html

window.onload = function() {resize_window();}

function resize_window() {
	var myWidth = 0, myHeight = 0;
	var newWidth = 0;
	var need_resize = 0;
	var heightAdjustment = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		// non-IE
		myWidth = window.innerWidth; myHeight = window.innerHeight;
	if (myWidth > 1200) { 
			newWidth = 1200;
			if (myHeight > screen.availHeight)
				myHeight = screen.availHeight; 
			window.resizeTo(newWidth,myHeight);
			heightAdjustment = myHeight - window.innerHeight;
			window.resizeTo(newWidth,myHeight + heightAdjustment);
//			heightAdjustment = myHeight - screen.availHeight;
//				window.resizeTo(newWidth,myHeight);
		}
	} else if( document.documentElement && ( document.documentElement.clientWidth ||document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight;
		if (myWidth > 1200) { 
			newWidth = 1200;
			if (myHeight > screen.availHeight)
				myHeight = screen.availHeight; 
			window.resizeTo(newWidth,myHeight);
			heightAdjustment = myHeight - document.documentElement.clientHeight;
			window.resizeTo(newWidth,myHeight + heightAdjustment);
//			heightAdjustment = myHeight - screen.availHeight;
//				window.resizeTo(newWidth,myHeight);
		}
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth; myHeight = document.body.clientHeight;
		if (myWidth > 1200) { 
			newWidth = 1200;
			if (myHeight > screen.availHeight)
				myHeight = screen.availHeight; 
			window.resizeTo(newWidth,myHeight);
			heightAdjustment = myHeight - document.body.clientHeight;
		alert('Your resolution is '+screen.width+'x'+screen.height+', heightAdjustment is '+heightAdjustment);
			window.resizeTo(newWidth,myHeight + heightAdjustment);
//			heightAdjustment = myHeight - screen.availHeight;
//				window.resizeTo(newWidth,myHeight);
		}
	}
}
