home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2004 December
/
PCWorld_2004-12_cd.bin
/
software
/
komercni
/
netgenium
/
NETGenium.msi
/
_B4A5F9DE730F039E0CBFC30C1A8A8467
/
_8E6F2A9B58094515B88AC95662CA08AB
< prev
next >
Wrap
Text File
|
2004-10-01
|
5KB
|
154 lines
<PUBLIC:COMPONENT>
<PUBLIC:ATTACH EVENT="onmousedown" ONEVENT="fnDown()" />
<SCRIPT LANGUAGE="JScript">
function fnDown()
{
var o = window.document.elementFromPoint(event.clientX, event.clientY);
// sometimes IE returns BODY object if element is disabled
if (o.disabled == false && o.tagName != "BODY")
{
if (event.srcElement != element)
{
element.fireEvent("onmousedown");
return;
}
event.srcElement.ondragstart = fnCancel;
// Get ItemID
jsDD_MovingItem = jsDD_ActiveItem = element.ItemID;
// Create line
if (window.document.dragLine2 == null)
{
window.document.dragLine2 = window.document.createElement("HR");
window.document.dragLine2.style.position = "absolute";
window.document.dragLine2.style.color = "#333333";
window.document.dragLine2.style.height = 1;
window.document.dragLine2.style.display = "none";
window.document.body.insertAdjacentElement("afterBegin", window.document.dragLine2);
}
// Create window
if (window.document.dragWindow == null)
{
window.document.dragWindow = window.document.createElement("SPAN");
window.document.dragWindow.className = "DragWindow";
window.document.body.insertAdjacentElement("afterBegin", window.document.dragWindow);
}
window.document.dragWindow.style.height = element.offsetHeight;
window.document.dragWindow.style.width = element.offsetWidth + 10;
window.document.dragWindow.move = false;
element.cY = event.clientY;
element.cX = event.clientX;
element.oY = event.offsetY;
if (element.tagName == "TR") element.oY -= element.cells(0).offsetTop;
element.oX = event.offsetX + 5;
// Attach events
if (element.ItemID > 0)
{
window.document.attachEvent("onmousemove", fnMove);
window.document.attachEvent("onscroll", fnMove);
}
window.document.attachEvent("onmouseup", fnUp);
window.document.attachEvent("onselectstart", fnCancel);
}
}
function fnMove()
{
if (!window.document.dragWindow.move && Math.abs(element.cY - event.clientY) < 10 && Math.abs(element.cX - event.clientX) < 10) return;
window.document.dragWindow.move = true;
// Move window
window.document.dragWindow.style.top = event.clientY - element.oY + window.document.body.scrollTop;
window.document.dragWindow.style.left = event.clientX - element.oX + window.document.body.scrollLeft;
// Scroll page if needed
if (event.clientY > window.document.body.clientHeight - 40 && window.document.body.scrollTop + event.clientY < window.document.body.scrollHeight - 60)
{
window.scrollBy(0, 20);
}
else if (event.clientY < 40)
{
window.scrollBy(0, -20);
}
// Get table or cell with ItemID attribute
window.document.dragWindow.style.display = "none";
var o = window.document.elementFromPoint(event.clientX, event.clientY);
window.document.dragWindow.style.display = "block";
try
{
while (o.ItemID == null) o = o.parentElement;
jsDD_ActiveItem = o.ItemID;
if (jsDD_MovingItem != jsDD_ActiveItem)
{
var margin = 0;
window.document.dragLine2.style.width = o.offsetWidth;
if (element.tagName == "TR")
{
margin = -1;
o = o.cells(0);
}
window.document.dragLine2.style.top = jsMarginTop() + jsOffsetTop(o) + margin;
window.document.dragLine2.style.left = jsMarginLeft() + jsOffsetLeft(o);
window.document.dragLine2.style.display = "";
}
else window.document.dragLine2.style.display = "none";
}
catch (e)
{
if (element.tagName == "TR") // Set reference to the last item in the table
{
o = element.parentElement.parentElement;
if (event.clientY > jsMarginTop() + jsOffsetTop(o, true))
{
jsDD_ActiveItem = o.rows(o.rows.length - 1).ItemID + 1;
window.document.dragLine2.style.width = o.offsetWidth;
window.document.dragLine2.style.top = jsMarginTop() + jsOffsetTop(o, true);
window.document.dragLine2.style.left = jsMarginLeft() + jsOffsetLeft(o);
window.document.dragLine2.style.display = "";
}
else jsDD_ActiveItem = 0;
}
else jsDD_ActiveItem = 0; // Item is a table, unknown element...
}
}
function fnUp()
{
// Hide line and window
window.document.dragLine2.style.display = window.document.dragWindow.style.display = "none";
// Detach events
if (element.ItemID > 0)
{
window.document.detachEvent("onmousemove" , fnMove);
window.document.detachEvent("onscroll" , fnMove);
}
window.document.detachEvent("onmouseup" , fnUp);
window.document.detachEvent("onselectstart", fnCancel);
// Execute
if (jsDD_MovingItem == jsDD_ActiveItem)
{
if (!window.document.dragWindow.move) jsDD_Click(element); // OnClick
}
else if (jsDD_ActiveItem != 0)
{
jsExecuteDrag(element.Command);
}
}
function fnCancel()
{
return false;
}
</SCRIPT>
</PUBLIC:COMPONENT>