function resizePopUpToContents (Width) {
	var docWidth = documentWidth();
	var docHeight = documentHeight();

	var resizeToWidth = parseInt(document.getElementById('body-container').offsetWidth);
	var resizeToHeight = parseInt(document.getElementById('body-container').offsetHeight);

	window.resizeTo(resizeToWidth, resizeToHeight);

	docWidth = documentWidth();
	docHeight = documentHeight();
	if ((docWidth < resizeToWidth) || (docHeight < resizeToHeight)) {
		resizeToWidth += resizeToWidth - docWidth;
		resizeToHeight += resizeToHeight - docHeight;
		window.resizeTo(resizeToWidth, resizeToHeight);
	}
}

function documentWidth () {
	if(typeof(window.innerWidth) == 'number') {
		//Non-IE
	    return parseInt(window.innerWidth);
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
	    //IE 6+ in 'standards compliant mode'
    	return parseInt(document.documentElement.clientWidth);
	} else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
		//IE 4 compatible
		return parseInt(document.body.clientWidth);
	}
	
	return 0;
}
	
function documentHeight () {
	if(typeof(window.innerWidth) == 'number') {
		//Non-IE
	    return parseInt(window.innerHeight);
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
	    //IE 6+ in 'standards compliant mode'
	    return parseInt(document.documentElement.clientHeight);
	} else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
		//IE 4 compatible
		return parseInt(document.body.clientHeight);
	}
	
	return 0;
}
