function startModules(id)
{
	// Variables
	var div = $(id);
	
	// Loop over childs
	for (var i=0; i<div.childNodes.length; i++)
	{
		with (div.childNodes[i])
		{
			// Check if it's a valid child
			if (div.childNodes[i].style)
			{
				// Get child's first child
				var child = null;
				for (var j=0; j<childNodes.length; j++)
				{
					if (childNodes[j] && childNodes[j].tagName && childNodes[j].tagName.toLowerCase() == "div")
					{
						child = childNodes[j];
						break;
					}
				}

				// Remove?
				var remove = false;

				// Check for parent_style attribute
				var c = child && child.getAttribute;
				if (c && child.getAttribute("parent_style"))
				{
					remove = true;
					style.cssText += ";" + child.getAttribute("parent_style");
				}

				// Check for ongrow event
				var ongrow = "";
				if (c && (ongrow = child.getAttribute("ongrow")))
				{
					remove = true;

					// Get amount
					var height = offsetHeight;
					style.height = "";
					style.overflow = "";
					var amount = Math.max(0, offsetHeight - height);

					eval(ongrow.replace("amount", amount));
				}

				// Check for extendable attribute
				if (c && child.getAttribute("extendable"))
				{
					remove = true;

					var height = offsetHeight;
					style.height = "";
					style.overflow = "";
					var diff = Math.max(0, offsetHeight - height);

					// Find all modules that must be extended
					for (var j=0; j<div.childNodes.length; j++)
					{
						var d = div.childNodes[j];
						if (!d || !d.tagName || d.tagName.toLowerCase() != "div") continue;
						if (d == child.parentNode) continue;

						// Check if module is below
						if (parseInt(d.style.top) > getObjectPosition(child).y + height)
						{
							var gotDown = d.getAttribute("gotDown") ? parseInt(d.getAttribute("gotDown")) : 0;
							d.style.top = (parseInt(d.style.top) + Math.max(0, diff - gotDown)) + "px";
							d.setAttribute("gotDown", gotDown + Math.max(0, diff - gotDown));
						}

						// Check if module is container
						var test = parseInt(d.style.left) < offsetLeft;
						test = test && parseInt(d.style.top) < offsetTop;
						test = test && parseInt(d.style.left) + d.offsetWidth > offsetLeft + offsetWidth;
						test = test && parseInt(d.style.top) + d.offsetHeight > offsetTop + height;
						if (test)
						{
							var extended = d.getAttribute("extended") ? parseInt(d.getAttribute("extended")) : 0;
							d.style.height = (parseInt(d.style.height) + Math.max(0, diff - extended)) + "px";
							d.setAttribute("extended", extended + Math.max(0, diff - extended));
						}
					}
				}

				// Remove child
				if (remove)
				{
					child.parentNode.removeChild(child);
				}
			}
		}
	}
}

function extend()
{
	var amount = arguments[0];
	var ignore = (typeof arguments[1] == 'boolean');

	if (ignore)
	{
		for (var i=2; i<arguments.length; i++)
		{
			var mod = $("mod_" + arguments[i]);
			mod.style.height = (parseInt(mod.style.height) + amount) + "px";
		}
	}
	else
	{
            for (var i=1; i<arguments.length; i++)
            {
                    var mod = $("mod_" + arguments[i]);
                    var extended = mod.getAttribute("extended") ? parseInt(mod.getAttribute("extended")) : 0;
                    mod.style.height = (parseInt(mod.style.height) + Math.max(0, amount - extended)) + "px";
                    mod.setAttribute("extended", extended + Math.max(0, amount - extended));
            }
    }
}

function moveDown()
{
	var amount = arguments[0];
	var ignore = (typeof arguments[1] == 'boolean');

	if (ignore)
	{
		for (var i=2; i<arguments.length; i++)
		{
			var mod = $("mod_" + arguments[i]);
			mod.style.top = (parseInt(mod.style.top) + amount) + "px";
		}
	}
	else
	{
		for (var i=1; i<arguments.length; i++)
		{
			var mod = $("mod_" + arguments[i]);
			var gotDown = mod.getAttribute("gotDown") ? parseInt(mod.getAttribute("gotDown")) : 0;
			mod.style.top = (parseInt(mod.style.top) + Math.max(0, amount - gotDown)) + "px";
			mod.setAttribute("gotDown", gotDown + Math.max(0, amount - gotDown));
		}
	}
}
loader.register('startModules("DragPlace");');