document.getSize = function document_getSize () {
	var body;
	
	// use document.documentElement if browser is in standard render mode
	if (document.compatMode && document.compatMode == 'CSS1Compat') {
		body = document.documentElement;
	}
	// use document.body if browser is in quirks render mode
	else {
		body = document.body;
	} 
    // browser window dimensions
	var window_size = window.getSize();		
	
	// body dimensions
	var width = body.offsetWidth;
	var height = body.offsetHeight;
	// overwrite dimensions with scrollWidth/scrollHeight
	if (width <= body.scrollWidth) {
		width = body.scrollWidth;
	}
		
	if (height <= body.scrollHeight) {
		height = body.scrollHeight;
	}
	
	// overwrite dimensions with browser window
	if (width <= window_size.width) {
		width = window_size.width;			
	}
	
	if (height <= window_size.height) {
		height = window_size.height;			
	}
	
	if (navigator.current.browser.name == "msie") {
		var scroll = window.getScrollbarVisibility(window.getSize(true));
		if (scroll.y) {
			width -= 21;
		}
		else if (!scroll.x) {
			height -= 16;
		}
	}
	
	
	return { 'width' : width, 'height' : height };			
}		
document.getElementPosition = function document_getElementPosition(elem) {
	var x = 0;
	var y = 0;
	
    if (elem.offsetParent) {
        while (elem.offsetParent) {
            x += elem.offsetLeft
            y += elem.offsetTop;
            elem = elem.offsetParent;
        }
    } else if (elem.x || elem.y) {
        x += elem.x;
        y += elem.y;
    }
    return { 'x' : x, 'y' : y };
};
document.maximizeElement = function document_maximizeElement(elem, container) {
	var size, pos;
	if (container == window) {
		size = window.getSize((navigator.current.browser.name == "msie" && navigator.current.browser.version < 7));
		pos = window.getScrollPosition();
	}
	else if (container == document) {
		size = document.getSize();
		pos = { 'x' : 0, 'y' : 0 };
	}
	else {
		size = { 'width' : container.offsetWidth, 'height' : container.offsetHeight };
		pos = document.getElementPosition(container);
	}
	elem.style.top = pos.y + "px";
	elem.style.left = pos.x + "px";
	elem.style.width = size.width + "px";
	elem.style.height = size.height + "px";
}