    function NewWindow(url) {
        var img = new Image();
        img.src = url;
        if (img.width > screen.width || img.height > screen.width) {

        }
        if (img.width > screen.width || img.height > screen.width) {
            if (img.width > screen.width && img.height <= screen.height) {
                var nw = screen.width - 70;
                var nh = parseInt(img.height) + 36
            }
            if (img.height > screen.height && img.width <= screen.width) {
                var nh = screen.height - 70;
                var nw = parseInt(img.height) + 36
            }
            if (img.width > screen.width && img.height > screen.height) {
                var nh = screen.height - 70;
                var nw = screen.width - 70;
            }
            window.open(url, "_blank", "width=" + img.width + ",height=" + img.height + ",left=0,top=0,'toolbar=no, location=no,directories=no, status=no, menubar=no, scrollbars=yes,resizable=yes");
        }
        else {
            var nh = parseInt(img.height) + 25;
            var nw = parseInt(img.width) + 25;
            window.open(url, "_blank", "width=" + img.width + ",height=" + img.height + ",'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no");
        }
    }

    function ShowMenu() {
        
    }
    function LogInShow() {
        document.getElementById("LogInID").style.visibility = "visible";
    }
    function LogInHide() {
        document.getElementById("LogInID").style.visibility = "hidden";
    }

    var posx;
    var posy;
    var zMax = 0;
    var obj;

    function GetXY(itemToMove, e, IDNr) {
        document.EditForm["EditX" + IDNr].value = parseInt(itemToMove.style.left);
        document.EditForm["EditY" + IDNr].value = parseInt(itemToMove.style.top);
        document.EditForm["EditZ" + IDNr].value = parseInt(itemToMove.style.zIndex);
        document.EditForm["EditID" + IDNr].value = "T" + IDNr;
    }
    function GetXY2(itemToMove, e, IDNr) {
        document.EditForm["EditX" + IDNr].value = parseInt(itemToMove.style.left);
        document.EditForm["EditY" + IDNr].value = parseInt(itemToMove.style.top);
        document.EditForm["EditZ" + IDNr].value = parseInt(itemToMove.style.zIndex);
        document.EditForm["EditID" + IDNr].value = itemToMove.src;
    }
   
    function drag_start(itemToMove, e) {    
        itemToMove.style.zIndex = ++window.zMax;
        if (!e) e = window.event;
        obj = itemToMove;
        posx = e.clientX - parseInt(obj.style.left);
        posy = e.clientY - parseInt(obj.style.top);
        itemToMove.style.cursor="move";
        if (e.preventDefault) e.preventDefault();
        else e.returnValue = false;
    }

    function drag_stop(e) {    
        if (obj) {
            obj.style.cursor = "pointer";
            posx = null;
            posy = null;
            obj = null;
            zMax = null;
        }
    }

    function drag(e) {    
        if (!obj) return;

        if (!e) e = window.event;

        var height, width;
        if (document.all)
        {
            height = document.body.offsetHeight;
            width = document.body.offsetWidth;
        }
        else if (document.layers)
        {
            height = window.innerHeight;
            width = window.innerWidth;
        }
        var newX = e.clientX - posx;
        var newY = e.clientY - posy;
        if (newX < -obj.clientWidth / 2)
        {
            newX = -obj.clientWidth / 2;
            posx = e.clientX - parseInt(obj.style.left);
        }
        if (newY < -obj.clientHeight / 2)
        {
            newY = -obj.clientHeight / 2;
            posy = e.clientY - parseInt(obj.style.top);
        }

        obj.style.left = newX;
        obj.style.top = newY;

        if (e.preventDefault) e.preventDefault();
        else e.returnValue = false;
    }

    document.onmousemove = drag;
    document.onmouseup = drag_stop;

    document.ondragstart = function()
    {
        return false;
    }
    document.onselectstart = function()
    {
        return false;
    }
