var initLiquidIconMove = function()
{
	var x = GetCookie("liquidIconX");
	var y = GetCookie("liquidIconY");

	if( x == null ) x = 1070;
	if( y == null ) y = 35;

	document.getElementById("liquidContainer").style.left = x;
	document.getElementById("liquidContainer").style.top = y;
	document.getElementById("sheetBorder_liquidContainer").style.left = x;
	document.getElementById("sheetBorder_liquidContainer").style.top = y;

	return;
}
function activateMoveLiquid()
{
	if( ! sheetEngine.modalOpen )
	{
		document.doMoveLiquid = true;

		var oMousePos = getEventPosition();
		tTop = oMousePos.y - 13 + "px";
		tLeft = oMousePos.x - 13 + "px";

		document.moveLiquidElement = document.getElementById("liquidContainer");
		document.movingLiquidBorderFrame = document.getElementById("sheetBorder_" + document.moveLiquidElement.id );
		document.movingLiquidBorderFrame.style.display = "block";
		document.movingLiquidBorderFrame.style.top = tTop;
		document.movingLiquidBorderFrame.style.left = tLeft;
		document.movingLiquidBorderFrame.style.zIndex = sheetEngine.zIndex + 100;

		// Create a layer, that stretches across the entire app.
		var oFiller = document.createElement("div");
		oFiller.className = "opaqueTransperant moveHelpFiller";
		oFiller.id = "moveHelpFiller_manual";
		oFiller.style.zIndex = sheetEngine.zIndex + 200;
		document.body.appendChild( oFiller );
	}

	document.onmouseup = function()
	{
		if( document.moveLiquidElement != null )
		{	
			// Remove filler
			var oMoveLiquidHelpFiller = document.getElementById("moveHelpFiller_manual");
			if( oMoveLiquidHelpFiller != null )
			{
				document.body.removeChild( oMoveLiquidHelpFiller );
			}
	
			// Remove display of sheetBorder_liquidContainer
			document.getElementById("sheetBorder_liquidContainer").style.display = "none";
		
			// Place liquid icon container
			this.moveLiquidElement.style.top = this.movingLiquidBorderFrame.style.top;
			this.moveLiquidElement.style.left = this.movingLiquidBorderFrame.style.left;
	
			// Save the positions
			var expiration = new Date();
			expiration.setMonth(1);
			expiration.setDate(15);
			expiration.setYear(2015);
			expiration.setHours(16);
			expiration.setMinutes(30);
			expiration.setSeconds(0);
			SetCookie("liquidIconX", this.movingLiquidBorderFrame.style.left, expiration, "/", "vinderslev.dk");
			SetCookie("liquidIconY", this.movingLiquidBorderFrame.style.top, expiration, "/", "vinderslev.dk");

			document.moveLiquidElement = null;

			return;
		}
	
		this.doMoveLiquid = false;
	
		return;
	}
	document.onmousemove = function()
	{
		if( this.doMoveLiquid )
		{
			var oMousePos = getEventPosition();
	
			this.movingLiquidBorderFrame.style.top = ( oMousePos.y - 13 ) + "px";
			this.movingLiquidBorderFrame.style.left = ( oMousePos.x - 7 ) + "px";
		}
	
		return;
	}

	return;
}
