//==============================================================================
// CONSTANTS

	var M_strFloaterColor = "";
	var M_nFloaterBorderWidth = 6;

//==============================================================================
// VARIABLES

	var m_bSwap = false;
	var m_bInsertTop = false;
	var m_bInsertLeft = false;
	var M_bDragging = false;

//==============================================================================
// FUNCTIONS

//------------------------------------------------------------------------------
function M_HighlightDim(
	i_strBorder, // 't' for top, 'b' for bottom, 'l' for left, or 'r' for right, anything else for whole element.
	io_clDim // <TD> element representing the dimension
	)
{
	if (io_clDim != null) {
		switch (i_strBorder) {
			case "t":
				io_clDim.style.borderTopColor = M_strFloaterColor;
				io_clDim.style.borderTopWidth = M_nFloaterBorderWidth;
				break;
			case "b":
				io_clDim.style.borderBottomColor = M_strFloaterColor;
				io_clDim.style.borderBottomWidth = M_nFloaterBorderWidth;
				break;
			case "l":
				io_clDim.style.borderLeftColor = M_strFloaterColor;
				io_clDim.style.borderLeftWidth = M_nFloaterBorderWidth;
				break;
			case "r":
				io_clDim.style.borderRightColor = M_strFloaterColor;
				io_clDim.style.borderRightWidth = M_nFloaterBorderWidth;
				break;
			default:
				io_clDim.style.backgroundColor = M_strFloaterColor;
				break;
		}
	}
}

//------------------------------------------------------------------------------
function M_ClearDimHighlight(
	io_clDim // <TD> element representing the dimension
	)
{
	var nRuleIndex;
	var clRule;

	if (io_clDim != null) {
		clRule = GetRuleByName(io_clDim.className);
		
		io_clDim.style.borderLeftColor = clRule.style.borderLeftColor;
		io_clDim.style.borderLeftWidth = clRule.style.borderLeftWidth;
		io_clDim.style.borderRightColor = clRule.style.borderRightColor;
		io_clDim.style.borderRightWidth = clRule.style.borderRightWidth;
		io_clDim.style.borderTopColor = clRule.style.borderTopColor;
		io_clDim.style.borderTopWidth = clRule.style.borderTopWidth;
		io_clDim.style.borderBottomColor = clRule.style.borderBottomColor;
		io_clDim.style.borderBottomWidth = clRule.style.borderBottomWidth;
		io_clDim.style.backgroundColor = clRule.style.backgroundColor;
	}
}

//------------------------------------------------------------------------------
function M_GJsdnd_HighLightTarget(
	)
{
	var clFloater;
	var clPrivate;
	var unElementLeft;
	var unElementTop;

	clPrivate = M_clDragNDrop;
	clFloater = clPrivate.m_clWindow.document.getElementById("DnDFltr");
	M_ClearDimHighlight(clPrivate.m_clFlyOverElement);
	clElement = clPrivate.GetTarget(clFloater);
	unElementTop = clPrivate.GetAbsPos(clElement, 'Top');
	unElementLeft = clPrivate.GetAbsPos(clElement, 'Left');
	
	if (clElement != null && (clElement.className == 'ActiveDimension' || clElement.className == 'TVActiveDimension'
		|| clElement.className == 'ChartActiveDimension' || clElement.className == 'DragNDropRow'
		|| clElement.className == 'TVDragNDropRow' || clElement.className == 'ChartDragNDropRow'
		|| clElement.className == 'DragNDropCol' || clElement.className == 'TVDragNDropCol'
		|| clElement.className == 'ChartDragNDropCol'|| clElement.className == 'DragNDropOther'
		|| clElement.className == 'TVDragNDropOther' || clElement.className == 'ChartDragNDropOther')
			&& clElement.id.indexOf("-1") == -1 
			&& (clPrivate.m_clSourceElement != null && clElement.id != clPrivate.m_clSourceElement.id))
	{
		clPrivate.m_clFlyOverElement = clElement;

		// As each table has at least one dimension along the row and one dimension along the
		// column. If the source dimension is the last one, the user should not be able to insert it.
		if (clPrivate.m_clSourceElement != null) {
			if (clPrivate.m_clSourceElement.getAttribute("Count") == 1) {
				M_HighlightDim("", clElement);
				m_bSwap = true;
			}
			else {
				// If the target dimension is along the column and in case of inserting, the top
				// or the bottom side should be highlighted.
				// Item selection: If the target dimension is along the "rows" or the "other" areas
				// and in case of inserting, the top or the bottom side should be highlighted.
				if (clPrivate.m_bIsDimView == true || clElement.id.indexOf("Col") != -1) {
					if (clFloater.offsetTop > (unElementTop - (clElement.offsetHeight / 2 ))
						&& (unElementTop + clElement.offsetHeight < clFloater.offsetTop + clFloater.offsetHeight))
					{
						M_HighlightDim("b", clElement);
						m_bSwap = false;
						m_bInsertTop = false;
						m_bInsertLeft = false;
					}
					else if (unElementTop >= (clFloater.offsetTop + clFloater.offsetHeight / 2)
						&& (clPrivate.m_clSourceElement.getAttribute("Count") != 1))
					{
						M_HighlightDim("t", clElement);
						m_bSwap = false;
						m_bInsertTop = true;
					}
					else {
						M_HighlightDim("", clElement);
						m_bSwap = true;
					}
				}
				// Table view: If the target dimension is along the "rows" or the "other" areas
				// and in case of inserting, the left or the right side should be highlighted.
				else {
					if (clElement.id.indexOf("Row") != -1) {
						if (clFloater.offsetLeft > (clElement.offsetLeft + clElement.offsetWidth/2))
						{
							M_HighlightDim("r", clElement);
							m_bSwap = false;
							m_bInsertLeft = false;
							m_bInsertTop = false;
						}
						else if (clElement.offsetLeft > clFloater.offsetLeft)
						{
							M_HighlightDim("l", clElement);
							m_bSwap = false;
							m_bInsertLeft = true;
						}
						else {
							M_HighlightDim("", clElement);
							m_bSwap = true;
						}
					}
					else if (clElement.id.indexOf("Oth") != -1) {
						if (clElement.offsetLeft > clFloater.offsetLeft)
						{
							M_HighlightDim("l", clElement);
							m_bSwap = false;
							m_bInsertLeft = true;
						}
						else {
							M_HighlightDim("", clElement);
							m_bSwap = true;
						}
					}
				}
			}
		}
	}
	// If there is no "other" dimension, the source should be inserted to the right
	// of "Other:".
	else if ((clElement != null && clElement.id.indexOf("-1") != -1)
			&& (clPrivate.m_clSourceElement != null && clPrivate.m_clSourceElement.getAttribute("Count") != 1))
	{
		clPrivate.m_clFlyOverElement = clElement;
		M_HighlightDim("", clElement);
		m_bSwap = false;
	}
	
	clPrivate.m_bHighLightInProgress = null;
}

//------------------------------------------------------------------------------
function M_RebuildOtherColRow(
	i_szDim,
	i_szVar,
	i_nReportType
	)
{
	var unDim = parseInt(i_szDim.substr(3));
	// Convert from Dim codes to view postions.
	unDim = GetViewDim(unDim);

	return i_szVar + "+='" + unDim.toString() + "'+','";
}

//------------------------------------------------------------------------------
function GJsdnd(
	)
{
	this.m_clPrivate = new PJsdnd();
}

//------------------------------------------------------------------------------
function GJsdnd_Initialize(
	i_clWindow,
	i_bIsDimView
	)
{
	var aTempArray;
	var clDoc;
	var clFloater = null;
	var clPrivate;
	var unIndex;
	var unTempIndex;
	var unTarget = 0;

	clPrivate = this.m_clPrivate;
	clPrivate.m_clWindow = i_clWindow;
	clPrivate.m_bIsDimView = i_bIsDimView;
	clFloater = document.getElementById("DnDFltr");
	if (clFloater != null) {
		M_strFloaterColor = GetRuleStyle(clFloater.className, "backgroundColor");
	
		M_clDragNDrop = clPrivate;
		clDoc = i_clWindow.document;
		clDoc.onmousedown = this.StartDrag;
		clDoc.onmouseup = this.EndDrag;
		clDoc.onmousemove = this.DragOver;
		aTempArray = new Array();
		if (!PWdsapp_bIsIE) {
			aTempArray[ 0 ] = clDoc.getElementsByTagName("TD");
			aTempArray[ 1 ] = clDoc.getElementsByTagName("TH");
		}
		else {
			aTempArray[ 0 ] = clDoc.all;
		}

		clPrivate.m_clTargets = new Array();
		for( unTempIndex = 0; unTempIndex < aTempArray.length; unTempIndex++ )
		{
			var aTemp = aTempArray[ unTempIndex ];
			for (unIndex=0; unIndex < aTemp.length; unIndex++) {
				if (aTemp[unIndex].className == 'ActiveDimension'
				|| aTemp[unIndex].className == 'TVActiveDimension'
				|| aTemp[unIndex].className == 'ChartActiveDimension'
				|| aTemp[unIndex].className == 'DragNDropRow'
				|| aTemp[unIndex].className == 'TVDragNDropRow'
				|| aTemp[unIndex].className == 'ChartDragNDropRow'
				|| aTemp[unIndex].className == 'DragNDropCol'
				|| aTemp[unIndex].className == 'TVDragNDropCol'
				|| aTemp[unIndex].className == 'ChartDragNDropCol'
				|| aTemp[unIndex].className == 'DragNDropOther'
				|| aTemp[unIndex].className == 'TVDragNDropOther'
				|| aTemp[unIndex].className == 'ChartDragNDropOther'
				|| (aTemp[unIndex].id.indexOf("-1") != -1))
				{
				clPrivate.m_clTargets[unTarget++] = aTemp[unIndex];
				}
			}
		}
	}
}
GJsdnd.prototype.Initialize = GJsdnd_Initialize;

//------------------------------------------------------------------------------
function GJsdnd_StartDrag(
	i_clEvent
	)
{
	var clElement;
	var clEvent;
	var clFloater;
	var clPrivate;
	var clRightArrow;
	var bInDND    = false;
	var bInDNDTmp = false;
	var strDimensionName;

	clPrivate = M_clDragNDrop;
	if (!PWdsapp_bIsIE) {
		clEvent = i_clEvent;
		// Now we have the target, but a problem is that Netscape 6 considers the text node
		// (and not the containing) to be the target. 
		// Therefore we go up through the DOM tree as long as the current node is not a tag 
		// (as long as its nodeType is not 1).
		if (clEvent) {
			clElement = clEvent.target;
			while (clElement && clElement.tagName != 'TD'&& clElement.tagName != 'TH') {
				clElement = clElement.parentNode;
			}
			if (clEvent.button == 0) {
				M_bDragging = true;
			}
		}
	}
	else {
		clEvent = clPrivate.m_clWindow.event;
		clElement = clEvent.srcElement;
		if (clEvent.button == 1) {
			M_bDragging = true;
		}
	}
	
	clFloater = clPrivate.m_clWindow.document.getElementById("DnDFltr");
	if (clElement && (clElement.className == 'ActiveDimension'
		|| clElement.className == 'TVActiveDimension'
		|| clElement.className == 'ChartActiveDimension'
		|| clElement.className == 'DragNDropRow'
		|| clElement.className == 'TVDragNDropRow'
		|| clElement.className == 'ChartDragNDropRow'
		|| clElement.className == 'DragNDropCol'
		|| clElement.className == 'TVDragNDropCol'
		|| clElement.className == 'ChartDragNDropCol'
		|| clElement.className == 'DragNDropOther'
		|| clElement.className == 'TVDragNDropOther'
		|| clElement.className == 'ChartDragNDropOther'))
	{
		bInDND = true;
	}

	if (clElement && (clElement.id == "DnDTmp")) {
		bInDNDTmp = true;
		if (PWdsapp_bIsIE) {
			clElement = clElement.parentElement;
		}
	}

	if (bInDND || bInDNDTmp)   
	{
		// Any changes made to any item should be save to the hidden fields
		if (typeof(SaveSelectionState) != 'undefined') {
			SaveSelectionState();
		}
		// Save the position of the scrollbar
		if (typeof(vScroll) != 'undefined') {
			ObjWdsForm.WD_VPos.value = vScroll.getTop();
		}

		// Need to hide the arrow if the active dimension is dragged.
		if (typeof(M_nActiveDimension) != 'undefined' && clElement.id.indexOf(M_nActiveDimension) != -1) {
			clRightArrow = document.getElementById("RightArrow");
			if (clRightArrow != null) {
				clRightArrow.style.visibility = 'hidden';
			}
		}

		clPrivate.m_clSourceElement = clElement;
		strDimensionName = GetDimensionNameFromCell(clElement);
		clFloater.innerHTML = "<nobr>&nbsp;" + strDimensionName + "&nbsp;</nobr>";

		SetFloaterPosition(clEvent, clFloater);
		clElement.style.visibility = 'hidden';
		clFloater.style.visibility = 'visible';
		setTimeout('M_GJsdnd_HighLightTarget()',1);
	}

	return false;
}
GJsdnd.prototype.StartDrag = GJsdnd_StartDrag;

//------------------------------------------------------------------------------
function GJsdnd_EndDrag(
	)
{
	var bKeepSort = true;
	var clDest;
	var clElement; 
	var clFloater;
	var clPrivate;
	var clSrce;
	var clForm;
	var nReportType;
	var szCol = "";
	var szRow = "";
	var szOth = "";
	var szVarDest;
	var szVarSrce;
	var unTempDim;

	try {
		nReportType = parseInt(ObjWdsForm.IF_ReportType.value);
		clPrivate = M_clDragNDrop;
		clFloater = clPrivate.m_clWindow.document.getElementById("DnDFltr");
		M_ClearDimHighlight(clPrivate.m_clFlyOverElement);
		if (clPrivate.m_clSourceElement != null) {
			clSrce = clPrivate.m_clSourceElement.id;
		}
		if (clPrivate.GetTarget(clFloater) != null) {
			clDest = clPrivate.GetTarget(clFloater).id;
		}
		if ((clSrce != null) && (clDest != null)) {
			szVarSrce = 'sz' + clSrce.substr(0,3);
			szVarDest = 'sz' + clDest.substr(0,3);
			unSourceDim = eval(clSrce.substr(3));
			unTargetDim = eval(clDest.substr(3));

			if ((unSourceDim != null) && (unTargetDim != null)
					&& (unTargetDim != unSourceDim)
					&& (clPrivate.m_clSourceElement.getAttribute("Count") != 1 || clDest.substr(3) != "-1"))
			{
				// Loop through all the dimensions from the left along the "other", then
				// from the top along the column, and from the left along the row.
				for(unTarget = 0; unTarget < clPrivate.m_clTargets.length; unTarget++) {
					clElement = clPrivate.m_clTargets[unTarget].id;

					if (clElement.substr(3) != "-1") {
						// If the element is the deferent to the target and the source, just leave it
						// in the same position.
						if ((clElement != clDest) && (clElement != clSrce)) {
							szVarName = 'sz' + clElement.substr(0,3);
							eval(M_RebuildOtherColRow(clElement, szVarName, nReportType));
						}
						else {
							// Insert a dimension
							if (!m_bSwap) {

								// In this case of inserting a dimension on the left or on the top of the
								// target, the source should be insert first.
								// Otherwise, the target should be insert first.
								if ((clElement == clDest) && (clDest.substr(3) != "-1")) {
									if (m_bInsertTop || m_bInsertLeft) {
										eval(M_RebuildOtherColRow(clSrce, szVarDest, nReportType));
										eval(M_RebuildOtherColRow(clDest, szVarDest, nReportType));
									}
									else {
										eval(M_RebuildOtherColRow(clDest, szVarDest, nReportType));
										eval(M_RebuildOtherColRow(clSrce, szVarDest, nReportType));
									}
								}
								// In this case the "other" area is empty and we are dragging another dimension
								// to it.
								else if (clDest.substr(3) == "-1") {
									eval(M_RebuildOtherColRow(clSrce, szVarDest, nReportType));
								}
							}
							// Swap dimensions
							else {

								// In case of swaping dimensions and the element:
								// If the element equal to the target, the source should be inserted in
								// the target position.
								// If the element equal to the source, the target should be inserted in
								// the source position.
								if (clElement == clDest) {
									eval(M_RebuildOtherColRow(clSrce, szVarDest, nReportType));
								}
								else if (clElement == clSrce){
									eval(M_RebuildOtherColRow(clDest, szVarSrce, nReportType));
								}
							}
						}
					}

					// Record the last Col Dimension's DimNum, it will be used for checking
					// if the inner most column is dragged.
					szVarTemp = 'sz' + clElement.substr(0,3);
					if (szVarTemp == "szCol") {
						unTempDim = eval(clElement.substr(3));
					}
				}

				if (szVarSrce == "szCol" && unSourceDim == unTempDim) {
					bKeepSort = false;
				}
				// When dragging and dropping dimensions from other dimensions to a Row or
				// column dimension (not to other dimension) or vice versa (from row/column to
				// other dimensions), the sorting order should be reset and also other dimension's
				// active item id should be reset as well.

				if ( (szVarSrce == "szOth" || szVarDest == "szOth")
					&& szVarDest != szVarSrce) {
					bKeepSort = false;
					clForm = clPrivate.m_clWindow.ObjWdsForm;
					if (szVarSrce == "szOth") {
						eval("clForm.oWD_DimActiveItemId" + unSourceDim + ".value = -1");
					}
				}
				if (szCol.charAt(szCol.length - 1) == ',') {
					szCol = szCol.substr(0, szCol.length - 1);
				}
				if (szRow.charAt(szRow.length - 1) == ',') {
					szRow = szRow.substr(0, szRow.length - 1);
				}
				if (szOth.charAt(szOth.length - 1) == ',') {
					szOth = szOth.substr(0, szOth.length - 1);
				}
				// The column(s) have changed.  Reset the sort.
				if (clPrivate.m_clWindow.ObjWdsForm.sWD_Cols.value != szCol) {
					bKeepSort = false;
				}
				clPrivate.m_clWindow.ObjWdsForm.sWD_Cols.value = szCol;
				clPrivate.m_clWindow.ObjWdsForm.sWD_Rows.value = szRow;
				clPrivate.m_clWindow.ObjWdsForm.sWD_Others.value = szOth;
				clPrivate.m_clWindow.ObjWdsForm.sWD_FirstRow.value = 0;
				clPrivate.m_clWindow.ObjWdsForm.sWD_FirstCol.value = 0;
				clPrivate.m_clWindow.ObjWdsForm.sWD_ChartRow.value = 0;
				clPrivate.m_clWindow.ObjWdsForm.sWD_ChartCol.value = 0;
				if (!bKeepSort) {
					clPrivate.m_clWindow.ObjWdsForm.sWD_viewsortcode.value = "";
				}
				clPrivate.m_clWindow.ObjWdsForm.action = clPrivate.m_clWindow.document.location.pathname;
				executeWait(clPrivate.m_clWindow.ObjWdsForm);
			}
		}
		if (clSrce != null) {
			// Need to show the arrow if the active dimension is dropped back to its position.
			if (typeof(M_nActiveDimension) != 'undefined' && clPrivate.m_clSourceElement.id.indexOf(M_nActiveDimension) != -1) {
				clRightArrow = document.getElementById("RightArrow");
				if (clRightArrow != null) {
					clRightArrow.style.visibility = 'visible';
				}
			}

			clFloater.style.visibility = 'hidden';
			clPrivate.m_clSourceElement.style.visibility = 'visible';
			clPrivate.m_clSourceElement = null;
		}
	}
	catch(ex) {
	}

	M_bDragging = false;

	return false;
}
GJsdnd.prototype.EndDrag = GJsdnd_EndDrag;

//------------------------------------------------------------------------------
function GJsdnd_DragOver(
	i_clEvent
	)
{
	var clEvent;
	var clFloater;
	var clPrivate;

	clPrivate = M_clDragNDrop;
	clFloater = clPrivate.m_clWindow.document.getElementById("DnDFltr");

	if (!PWdsapp_bIsIE) {
		clEvent = i_clEvent;
	}
	else {
		clEvent = clPrivate.m_clWindow.event;
		// With IE, for some reason if the left button is released outside the Browser window,
		// the onmouseup event is not received.  [Note that if the body of this GJsdnd_DragOver
		// function is returns true instead of false, the onmouseup event is received but as the
		// mouse is moved the text on the screen appears 'selected'.]  So when the mouse is moved,
		// we check if we are in dragging mode and if we are we check if the mouse button is still down.  If it isn't, we end dragging.
		if (M_bDragging) {
			if (clEvent && clEvent.button != 1) {
				return GJsdnd_EndDrag(i_clEvent);
			}
		}
	}
	if (clPrivate.m_clSourceElement != null && clEvent != null)  {
		SetFloaterPosition(clEvent, clFloater);
		if (!clPrivate.m_bHighLightInProgress) {
			clPrivate.m_bHighLightInProgress = true;
			// setTimeout to create a new thread;
			setTimeout('M_GJsdnd_HighLightTarget()',1);
		}
	}

	return false;
}
GJsdnd.prototype.DragOver = GJsdnd_DragOver;

//------------------------------------------------------------------------------
function PJsdnd(
	)
{
	this.m_clSourceElement = null;
	this.m_clWindow = null;
	this.m_bIsDimView = false;
	this.m_clTargets = null;
}

//------------------------------------------------------------------------------
function PJsdndGetAbsPos(
	i_clElement,
	i_szPos
	)
{
	var unPos = 0;

	while (i_clElement != null) {
		unPos += i_clElement["offset" + i_szPos];
		i_clElement = i_clElement.offsetParent;
	}

	return unPos;
}
PJsdnd.prototype.GetAbsPos = PJsdndGetAbsPos;

//------------------------------------------------------------------------------
function PJsdndGetTarget(
	i_clFloater
	)
{
	var clTargetElement;
	var clPrivate;
	var unArea;
	var unElementLeft;
	var unElementTop;
	var unFloaterLeft;
	var unFloaterTop;
	var unBiggestArea;
	var unTarget;

	unFloaterLeft = i_clFloater.offsetLeft;
	unFloaterTop = i_clFloater.offsetTop;
	unFloaterRight = unFloaterLeft + i_clFloater.offsetWidth;
	unFloaterBottom = unFloaterTop + i_clFloater.offsetHeight;
	unBiggestArea = 0;
	clTargetElement = null;
	clPrivate = M_clDragNDrop;

	for(unTarget = 0; unTarget < clPrivate.m_clTargets.length; unTarget++) {
		clElement = clPrivate.m_clTargets[unTarget];
		if ( clElement.className == 'ActiveDimension' || clElement.className == 'TVActiveDimension'
			|| clElement.className == 'ChartActiveDimension' || clElement.className == 'DragNDropRow'
			|| clElement.className == 'TVDragNDropRow' || clElement.className == 'ChartDragNDropRow'
			|| clElement.className == 'DragNDropCol' || clElement.className == 'TVDragNDropCol'
			|| clElement.className == 'ChartDragNDropCol'|| clElement.className == 'DragNDropOther'
			|| clElement.className == 'TVDragNDropOther' || clElement.className == 'ChartDragNDropOther'
			|| (clElement.id.indexOf("-1") != -1))
		{
			unElementLeft = this.GetAbsPos(clElement, "Left");
			unElementTop = this.GetAbsPos(clElement, "Top");

			unElementRight = unElementLeft + clElement.offsetWidth;
			unElementBottom = unElementTop + clElement.offsetHeight;
			unRectLeft = Math.max(unFloaterLeft, unElementLeft);
			unRectRight = Math.min(unFloaterRight, unElementRight);
			unRectTop = Math.max(unFloaterTop, unElementTop);
			unRectBottom = Math.min(unFloaterBottom, unElementBottom);
			unRectWidth = unRectRight - unRectLeft;
			unRectHeight = unRectBottom - unRectTop;
			if (unRectWidth > 0 && unRectHeight > 0) {
				unArea = unRectWidth * unRectHeight;
				if (unArea > unBiggestArea)
				{
					unBiggestArea = unArea;
					clTargetElement = clElement;
				}
			}
		}
	}

	return clTargetElement;
}
PJsdnd.prototype.GetTarget = PJsdndGetTarget;

//------------------------------------------------------------------------------
function GetDimensionNameFromCell(
	i_clCell
	)
{
	var clInnerMostElement;
	var strDimName;

	// This is a row or column dimension
	clInnerMostElement = i_clCell.getElementsByTagName("span")[0];
	while (clInnerMostElement && clInnerMostElement.childNodes && clInnerMostElement.childNodes.length > 0)
	{
		clInnerMostElement = clInnerMostElement.childNodes[0];
	}
	if (clInnerMostElement) {
		strDimName = clInnerMostElement.data;
	}
	else {
		strDimName = " ";
	}

	return strDimName;
}

//------------------------------------------------------------------------------
// The floater is positioned so that it the mouse is in the middle of it.
function SetFloaterPosition(
	i_clEvent,
	io_clFloater
	)
{
	var nMousePosX;
	var nMousePosY;
		
	if (i_clEvent != null && io_clFloater != null) {
		if (i_clEvent.clientX) {
			nMousePosX = i_clEvent.clientX;
			nMousePosY = i_clEvent.clientY;
		}
		else {
			nMousePosX = i_clEvent.pageX;
			nMousePosY = i_clEvent.pageY;
		}
		if (!isNaN(nMousePosX)) {
			io_clFloater.style.left = nMousePosX - (io_clFloater.offsetWidth / 2);
		}
		if (!isNaN(nMousePosY)) {
			io_clFloater.style.top = nMousePosY - (io_clFloater.offsetHeight / 2);
		}
	}
}
