var theElement = new Object();
function setVariables(e, id)
{
    var x = 0;
    var y = 0;    
    theElement = document.getElementById(id); 
    theElement.isClick = true;
    if (document.attachEvent)
    {
        x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;        
        y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;     
    }
    else
    {
        x = e.clientX + window.scrollX;
        y = e.clientY + window.scrollY;
        e.preventDefault();
    }    
    theElement.cursorX = x;
    theElement.cursorY = y;
    theElement.L = parseInt(theElement.style.left.replace("px", ""));
    theElement.T = parseInt(theElement.style.top.replace("px", ""));
    theElement.onselectstart = function(){return false;}    
}

function makeMove(e, num)
{
    if (theElement != null && theElement.isClick)     
    {    
        if (document.attachEvent)
        {
            x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
            y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
        }
        else
        {
            x = e.clientX + window.scrollX;
            y = e.clientY + window.scrollY;
        }
        if (num > 0)
            theElement.style.left =  (theElement.L + x - theElement.cursorX) +"px";     
        if (num >1)
            theElement.style.top = (theElement.T + y - theElement.cursorY) +"px";        
    }
}
function stopMove()
{
    theElement.isClick = false;
    theElement = null;
}
