function alignHeights() {
	var maxHeight = 0;
	for (var i = 0; i < arguments.length; i+=2) {
		var thisHeight;
		if (arguments[i] && arguments[i].offsetHeight) {
			thisHeight = arguments[i].offsetHeight;
		}
		else if (arguments[i] && arguments.pixelHeight) {
			thisHeight = arguments[i].pixelHeight;
		}
		else {
			thisHeight = 0;
		}
		var adj = arguments[i+1];
		thisHeight += adj;
		maxHeight = Math.max(maxHeight, thisHeight);
	}
	
	for (var i = 0; i < arguments.length; i+=2) {
		if (arguments[i]) {
			var adj = arguments[i+1];
			arguments[i].style.height = "" + (maxHeight-adj) + "px";
		}
	}
}

function alignHeight() {
	var maxHeight = 0;
	for (var i = 0; i < arguments.length; i+=2) {
		var thisHeight;
		if (arguments[i] && arguments[i].offsetHeight) {
			thisHeight = arguments[i].offsetHeight;
		}
		else if (arguments[i] && arguments.pixelHeight) {
			thisHeight = arguments[i].pixelHeight;
		}
		else {
			thisHeight = 0;
		}
		var adj = arguments[i+1];
		thisHeight += adj;
		maxHeight = Math.max(maxHeight, thisHeight);
	}
	
	var i = 0;
	if (arguments[i]) {
		var adj = arguments[i+1];
		arguments[i].style.height = "" + (maxHeight-adj) + "px";
	}
}

function differenceHeight() {
	if (arguments[0]) {
		var height;
		if (arguments[0].offsetHeight) {
			height = arguments[0].offsetHeight;
		}
		else if (arguments[0].pixelHeight) {
			height = arguments[0].pixelHeight;
		}
		else {
			return;
		}
		
		for (var i = 1; i < arguments.length - 2; i++) {
			var thisHeight;
			if (arguments[i] && arguments[i].offsetHeight) {
				thisHeight = arguments[i].offsetHeight;
			}
			else if (arguments[i] && arguments.pixelHeight) {
				thisHeight = arguments[i].pixelHeight;
			}
			else {
				thisHeight = 0;
			}
			height -= thisHeight;
		}
		
		var i = arguments.length - 2;
		if (arguments[i]) {
			var adj = arguments[i+1];
			arguments[i].style.height = "" + (height-adj) + "px";
		}
	}
}

function alignBottom(child, parent) {
	if (child && parent) {
		var parentHeight, parentWidth, childHeight, childWidth;
		if (parent.offsetHeight) {
			parentHeight = parent.offsetHeight;
			parentWidth = parent.offsetWidth;
			childHeight = child.offsetHeight;
			childWidth = child.offsetWidth;
		}
		else if (parent.pixelHeight) {
			parentHeight = parent.pixelHeight;
			parentWidth = parent.pixelWidth;
			childHeight = child.pixelHeight;
			childWidth = child.offsetWidth;
		}
		else {
			return;
		}
		
		child.style.position = "absolute";
		child.style.top = "" + (parentHeight - childHeight) + "px";
		child.style.width = "" + childWidth + "px";
	}
}

function maxHeight(ob, offset) {
	if (!ob) return;
	
	var parent = ob.parentNode;
	var height;
	if (parent.offsetHeight) {
		height = parent.offsetHeight;
	}
	else if (parent.pixelHeight) {
		height = parent.pixelHeight;
	}
	else {
		return;
	}
	
	var node = ob.previousSibling;
	while (node) {
		var thisHeight;
		if (node.offsetHeight) {
			thisHeight = node.offsetHeight;
		}
		else if (node.pixelHeight) {
			thisHeight = node.pixelHeight;
		}
		else {
			thisHeight = 0;
		}
		height -= thisHeight;
		node = node.previousSibling;
	}
	node = ob.nextSibling;
	while (node) {
		var thisHeight;
		if (node.offsetHeight) {
			thisHeight = node.offsetHeight;
		}
		else if (node.pixelHeight) {
			thisHeight = node.pixelHeight;
		}
		else {
			thisHeight = 0;
		}
		height -= thisHeight;
		node = node.nextSibling;
	}
	
	height -= offset;
	ob.style.height = "" + height + "px";
}

// Apply getElementById patch
if ( !document.getElementById ) {
    if ( document.all ) {
        document.getElementById = function( x ) {
            return this.all[x];
        }
    }
    else if ( document.layers ) {
        document.getElementById = function( x ) {
            return this[x];
        }
    }
}