function findElementsSpace(element, initialElement) {
	if(initialElement != false) initialElement = true;
	
	if(element == null) {
		//alert('bouncing out on ' + element.tagName.toLowerCase() );
		var info = new Object();
		info.right = 0;
		info.bottom = 0;
		return info;
	}
	else if(element.tagName != null && (element.tagName.toLowerCase() == "param" || element.tagName.toLowerCase() == "head" || element.tagName.toLowerCase() == "script" || element.tagName.toLowerCase() == "style" || element.tagName.toLowerCase() == "meta" || element.tagName.charAt(0) == "/")) {
		var info = new Object();
		info.right = 0;
		info.bottom = 0;
		return info;
	}
	else {
		var elements = null;
		var info = new Object();
		info.right = 0;
		info.bottom = 0;	
		
		try {
			if(element.tagName != null && element.tagName.toLowerCase() == 'iframe') elements = element.contentWindow.document.childNodes;   //element.contentWindow.document.getElementsByTagName('*');
			else elements = element.childNodes;   //element.getElementsByTagName(*);
		}
		catch(e) {
			if(!isNaN(element.offsetWidth) && !isNaN(element.offsetHeight)) {
				info.right = element.offsetWidth;
				info.bottom = element.offsetHeight;
			}
			return info;
		}
	
		// define the object to return

		// find the size of this object
		var size = findSize(element);
		var location = findLocation(element);
		
		//alert("inital element is " + element.tagName + " " + size.width + " " + size.height);

		if(elements.length <= 0) {
			// if this is the furthest down child return its info.
			//alert("element type -> " + ((element.tagName != null) ? element.tagName : "is Null") + " -> " + info.right + "," + info.bottom + "   " + size.width + "," + location.left + "   " + size.height + "," + location.top);
			info.right = size.width + location.left;
			info.bottom = size.height + location.top;
			return info;
		}
		else {
			// define the object to hold the largest childs info
			var childInfo = new Object();
			childInfo.right = 0;
			childInfo.bottom = 0;



			// find the largest childs info
			for(var i = 0; i < elements.length; i++) {
				var results = findElementsSpace(elements[i], false);
	
				if(results.right > childInfo.right) childInfo.right = results.right;
				if(results.bottom > childInfo.bottom) childInfo.bottom = results.bottom;
			}



			// decide if this element width is greater than its largest childs width + left.
			if(size.width > childInfo.right) {
				info.right = size.width;
			}
			else {
				info.right = childInfo.right;
				
			}
			// decide if this element height is greater than its largest childs height + top.
			if(size.height > childInfo.bottom) {
				info.bottom = size.height;
			}
			else {
				info.bottom = childInfo.bottom;
			}


			if(initialElement) {
				//alert("returning for " + ((element.tagName != null) ? element.tagName : "is Null") + " -> " + info.right + " " + info.bottom + "    " + size.width + "," + size.height + " - " + location.left + "," + location.top + " - " + childInfo.right + "," + childInfo.bottom);
			}
			
			// return this things info (largest point of itself and all children)
			return info;
		}
	}
}

function findSize(element) {
	var size = new Object();
	size.width = 0;
	size.height = 0;

	if(!isNaN(element.offsetWidth)) size.width = element.offsetWidth;
	if(!isNaN(element.offsetHeight)) size.height = element.offsetHeight;
	
	return size;	
}
function findLocation(element) {
	var location = new Object();
	location.left = 0;
	location.top = 0;

	if(!isNaN(element.offsetLeft)) location.left = element.offsetLeft;
	if(!isNaN(element.offsetTop)) location.top = element.offsetTop;

	return location;
}