﻿dragsw = true;
startdrag = function(t, e) {
    if (e.button != 2) {
        if (e.preventDefault) e.preventDefault();
        e.cancelBubble = true;
        window.document.onmousemoveOld = window.document.onmousemove;
        window.document.onmouseupOld = window.document.onmouseup;
        if(dragsw){
		window.document.onmousemove = dodrag;
		}
	window.document.onmouseup = stopdragup;
        window.document.draged = t;
        t.dragX = e.clientX;
        t.dragY = e.clientY;
    }
    return false;
}
dodrag = function(e) {
    if (!e) e = event;
    t = window.document.draged;
    t.style.left = (t.offsetLeft + e.clientX - t.dragX) + "px";
    t.style.top = (t.offsetTop + e.clientY - t.dragY) + "px";
    t.dragX = e.clientX;
    t.dragY = e.clientY;
    t.style.cursor = 'move';
    return false;
}
stopdragup = function() {
    window.document.onmousemove = window.document.onmousemoveOld;
    window.document.onmouseup = window.document.onmouseupOld;
    t = window.document.draged;
    t.style.cursor = 'auto';
}
stopdrag = function() {
     dragsw = false;
}
resumedrag = function() {
     dragsw = true;
}

setLayer = function( strId )
{
	var obj = document.getElementById(strId);
	obj.style.display='none';
}