/* Reposition/size footer */
function getClientSize(){
	var result = {width: 0, height: 0};
	if ((typeof(window.innerHeight) == 'number') && (typeof(window.innerWidth) == 'number')){
		result.height = parseInt(window.innerHeight);
		result.width = parseInt(window.innerWidth);
	} else if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth){
		result.height = parseInt(document.documentElement.clientHeight);
		result.width = parseInt(document.documentElement.clientWidth);
	} else if (document.body && document.body.clientHeight && document.body.clientWidth){
		result.height = parseInt(document.body.clietHeight);
		result.width = parseInt(document.body.clientWidth);
	} 
	return result;	
}

function relocateContainer(){
	/* Adjust this if footer height changes */
	var wrapheight = 260 + 335;
	var wrapwidth = 950;
	if(document.getElementById){
		var clientSize = getClientSize();
		if (clientSize.height >= wrapheight){
			var offset = clientSize.height - wrapheight;
			var d = document.getElementById('footer');	
			if (d) d.style.top = (offset).toString() + 'px';
			d = document.getElementById('main-wrapper');	
			if (d) d.style.top = ((clientSize.height / 2) - (wrapheight / 2)).toString() + 'px';
		}
		if (clientSize.width <= wrapwidth) {
			var offset = wrapwidth - clientSize.width + 15;
			var d = document.getElementById('footer');
			if (d) d.style.width = wrapwidth + 'px';
		} else {
			var d = document.getElementById('footer');
			if (d) d.style.width = clientSize.width + 'px';
		}
	}
}
window.onload = function(){ relocateContainer()};
window.onresize = function(){ relocateContainer()};

function doPopUp(url, heading, width, height){
	var pageid = null;
	pageid = window.open(url, heading, 'toolbars=0,statusbar=0,menubar=0,width=' + width.toString() + ',height=' + height.toString()); 
}
