    function sleep(milliseconds) {
        var start = new Date().getTime();
        for (var i = 0; i < 1e7; i++) {
            if ((new Date().getTime() - start) > milliseconds) {
                break;
            }
        }
    }

    function getBrowserDims() {
        var values = new Array();

        if (typeof( window.innerWidth ) == 'number') {
            values[0] = window.innerWidth;
            values[1] = window.innerHeight;
        } 
        else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
            values[0] = document.documentElement.clientWidth;
            values[1] = document.documentElement.clientHeight;
        } 
        else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
            values[0] = document.body.clientWidth;
            values[1] = document.body.clientHeight;
        }
        return(values);
    }

    function setLink(id) {
        currentStyle = document.getElementById(id).style;
        currentStyle.cursor = "pointer";
    }

    function unsetLink(id) {
        currentStyle = document.getElementById(id).style;
        currentStyle.cursor = "auto";
    }

    function showById(id, posX, posY) {
        if (posX != undefined) moveXaxisId(id, posX);
        if (posY != undefined) moveYaxisId(id, posY);
        currentStyle = document.getElementById(id).style;
        currentStyle.visibility = "visible";
    }

    function hideById(id) {
        currentStyle = document.getElementById(id).style;
        currentStyle.visibility = "hidden";
    }
/*
    function Move(id, posx, posy) {
        var idWidth  = document.getElementById(id).offsetWidth;
        var idHeight = document.getElementById(id).offsetHeight;
        var coorX    = new String(posx);
        var coorY    = new String(posy);

        currentStyle = document.getElementById(id).style;
        if (coorX != '') {
            if (coorX.substr(0, 1) != '-') {
                currentStyle.left = coorX;
            }
            else {

                currentStyle.right = coorX.substr(1, coorX.length);
            }
        }
        if (coorY != '') {
            if (coorY.substr(0, 1) != '-') {
                currentStyle.top = coorY;
            }
            else {
                currentStyle.bottom = coorY.substr(1, coorY.length);
            }
        }
    }
*/
    function moveXaxisId(id, newpos) {
        currentStyle = document.getElementById(id).style;
        currentStyle.left = newpos+"px";
    }

    function moveYaxisId(id, newpos) {
        currentStyle = document.getElementById(id).style;
        currentStyle.top = newpos+"px";
    }

    function setWidth (id, newValue) {
        currentStyle = document.getElementById(id).style;
        currentStyle.width = newValue+"px";
    }

    function setHeight (id, newValue) {
        currentStyle = document.getElementById(id).style;
        currentStyle.height = newValue+"px";
    }

    function setColor(id, color) {
        currentStyle       = document.getElementById(id).style;
        currentStyle.color = color;
    }

    function swap_image(img, newimage) {
        document.images[img].src = newimage;
    }

    function swapBackgroundImage(id, url) {
        document.getElementById(id).style["backgroundImage"] = 'url(' + url + ')';
    }

    function moveElement(id, toX, toY, offSet, speed) {
        var coorX = document.getElementById(id).style.left.replace(/\D/g, '');
        var coorY = document.getElementById(id).style.top.replace(/\D/g, '');
        var curOffSet;

        if ((coorX != toX) && (coorY != toY)) {
            if (offSet == 0) offSet = 1;
            if (coorX > toX) {
                curOffSet = offSet;
                if ((coorX - toX) < offSet) curOffSet = coorX - toX;
                coorX = coorX - curOffSet;
            }
            else if (coorX < toX) {
                curOffSet = offSet;
                if ((toX - coorX) < offSet) curOffSet = toX - coorX;
                coorX = coorX + curOffSet;
            }
            if (coorY > toY) {
                curOffSet = offSet;
                if ((coorY - toY) < offSet) curOffSet = coorY - toY;
                coorY = coorY - curOffSet;
            }
            else if (coorY < toY) {
                curOffSet = offSet;
                if ((toY - coorY) < offSet) curOffSet = toY - coorY;
                coorY = coorY + curOffSet;
            }
            document.getElementById(id).style.left = coorX+"px";
            document.getElementById(id).style.top  = coorY+"px";
            setTimeout("moveElement('" + id + "', '" + toX + "', '" + toY + "', '" + offSet + "', '" + speed + "')", speed);
        }
    }

    function showLogin(left, top) {
        var anchuraVentana = 0;
        var valorParcial   = 0;

        if (window.innerWidth) {
            //navegadores basados en mozilla
            anchuraVentana = window.innerWidth;
        }
        else if (document.body.clientWidth) {
            //Navegadores basados en IExplorer, es que no tengo innerwidth
            anchuraVentana = document.body.clientWidth;
        }
        document.getElementById("identificacion").style["left"] = anchuraVentana+"px";

        document.getElementById('identificacion').style.visibility = "visible";
        
        moveElement('identificacion', (anchuraVentana - 360), 5, 10, 2000)
    }

    function checkThemAll (checker) {
        var regexp = new RegExp(checker.name.substring(4,checker.name.length) + "_.+");

        for (i=0; i < checker.form.length; i++) {
            if ((checker.form[i].type == 'checkbox') && (checker.form[i].name.match(regexp))) {
                checker.form[i].checked = checker.checked;
            }
        }
    }
