var curWindowHeight;
var curWindowWidth;
/* The following two functions are not currently used, but are very elegant if you want to manipulate multiple elements */
function getElementsByAttribute(attr,val,container)
{
/* by Bernard Marx (Stockholm) http://www.webmasterworld.com/forum91/1729.htm */
container = container||document
var all = container.all||container.getElementsByTagName('*')
var arr = []
for(var k=0;k<all.length;k++)
if(all[k].getAttribute(attr) == val)
arr[arr.length] = all[k]
return arr
} 

function getElementsByCondition(condition,container)
{
/* by Bernard Marx (Stockholm) http://www.webmasterworld.com/forum91/1729.htm */
container = container||document
var all = container.all||container.getElementsByTagName('*')
var arr = []
for(var k=0;k<all.length;k++)
{
var elm = all[k]
if(condition(elm,k))
arr[arr.length] = elm
}
return arr
} 

		function getWindowWidth() {
			var windowWidth = 0;
			if (typeof(window.innerWidth) == 'number') {
				windowWidth = window.innerWidth;
			}
			else {
				if (document.documentElement && document.documentElement.clientWidth) {
					windowWidth = document.documentElement.clientWidth;
				}
				else {
					if (document.body && document.body.clientWidth) {
						windowWidth = document.body.clientWidth;
					}
				}
			}
			return windowWidth;
		}
		function getWindowHeight() {
			var windowHeight = 0;
			if (typeof(window.innerHeight) == 'number') {
				windowHeight = window.innerHeight;
			}
			else {
				if (document.documentElement && document.documentElement.clientHeight) {
					windowHeight = document.documentElement.clientHeight;
				}
				else {
					if (document.body && document.body.clientHeight) {
						windowHeight= document.body.clientHeight;
					}
				}
			}
			return windowHeight;
		}

		function setVirtualpageHeight() {
			if (document.getElementById) {
				var windowHeight = getWindowHeight();
				curWindowHeight = windowHeight;
				var virtualpageElement = document.getElementById('virtualpage');
				var virtualpageHeight = virtualpageElement.offsetHeight;
				var minHeightDelta = 20;
				var minHeight = windowHeight + minHeightDelta;
				if (minHeight > virtualpageHeight) {
					virtualpageElement.style.height = (minHeight) + 'px';
				}
			}
		}
		/* The following guarantees that there will always be a scrollbar, */
		/* and navigation elements will always be on the same position on each page */
		window.onload = function() {
			setVirtualpageHeight();
		}
		window.onresize = function() {
			setVirtualpageHeight();
		}
