// JavaScript Document capa

var permisoN4=0;
        var leftN4;
        var topN4;
        var idCapa;
        var idCapax;
        var idCapay;
                
        /**
        * funciones para manejar eventos de raton en Nestcape 4x
        */       

        function capturaN4(e)
        {
            idCapa.captureEvents(Event.MOUSEMOVE)
            leftN4=e.x
            topN4=e.y
        }                
        /**
        * funciones para arrastrar la capa en Nestcape 4x
        */
        function arrastraN4(e)
        {
            if (permisoN4==1)
            {
                idCapa.moveBy(e.x-leftN4,e.y-topN4)
                return false
            }
        }
        /**
        * funcion para detener la captura de los eventos de raton
        */
        function paraN4()
        {
            idCapa.releaseEvents(Event.MOUSEMOVE)
        }


        /**
        * funciones y variables para manejar eventos de raton en Internet Explorer y mover la capa
        */

        var permisoIE=false

        function arrastraIE(id)
        {
            if (permisoIE==true)
            {
                document.all[id].style.pixelLeft=idCapax+event.clientX-iex
                document.all[id].style.pixelTop=idCapay+event.clientY-iey
                return false
            }
        }
        
        
        var permisoN6=false

        function arrastraN6(e)
        {
            if (permisoN6==true)
            {
                idCapa.style.left=idCapax+e.clientX-n6x+"px"
                idCapa.style.top=idCapay+e.clientY-n6y+"px"
                return false
            }
        }        
        function paramN6(e)
        {
                n6x=e.clientX ;
                n6y=e.clientY;
                idCapa.addEventListener("mousemove", arrastraN6, false);                 
        }

        function inicializa(id)
        {
            if(document.all)
            {
                iex=event.clientX
                iey=event.clientY
                idCapax=document.all[id].style.pixelLeft
                idCapay=document.all[id].style.pixelTop
                permisoIE=true
                arrastraIE('caja1');
            }
            else if(document.layers)
            {
                idCapa=eval(id);
                idCapa.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP);
                idCapa.onmousedown=capturaN4;
                idCapa.onmousemove=arrastraN4;
                idCapa.onmouseup=paraN4;
            }
            else if(document.getElementById)
            {
                idCapa = document.getElementById(id);
                idCapa.addEventListener("mousedown", paramN6, false);                
                idCapax=parseInt(document.getElementById(id).style.left);         
                idCapay=parseInt(document.getElementById(id).style.top);
                permisoN6=true
            }           
        }        
       
        
        /**
        * funcion para esconder la capa
        */

        function esconde(id)
        {
            if (document.all)
                document.all[id].style.visibility="hidden"
            else if (document.layers)
                document.layers[id].visibility="hide"
            else if (document.getElementById)
                document.getElementById(id).style.visibility="hidden"
         }
