//<!--aqui van rutinas de las cokies -->
 
   var indice=0;

    function getCookieVal (offset)
    {
       var endstr = document.cookie.indexOf (";", offset);
       if (endstr == -1)
         endstr = document.cookie.length;
       return unescape(document.cookie.substring(offset, endstr));
    }

    function GetCookie (name)
    {
      var arg = name + "=";
      var alen = arg.length;
      var clen = document.cookie.length;
      var i = 0;
      while (i < clen)
      {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
          return getCookieVal (j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break; 
      }
      return null;
    }

    function SetCookie (name, value)
    {
      var argv = SetCookie.arguments;
      var argc = SetCookie.arguments.length;
      var expires = (argc > 2) ? argv[2] : null;
      var path = (argc > 3) ? argv[3] : null;
      var domain = (argc > 4) ? argv[4] : null;
      var secure = (argc > 5) ? argv[5] : false;
      document.cookie = name + "=" + escape (value) +
        ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
        ((path == null) ? "" : ("; path=" + path)) +
        ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");
    }


    function DeleteCookie (name)  
    {
        var exp = new Date();
        exp.setTime (exp.getTime() - 1);  // This cookie is history
        var cval = GetCookie (name);
        document.cookie = name + "=" + cval + "; expires="+exp.toGMTString() + ";path=/";
    }


    function enviar() 
    {
        xmarcados=GetCookie("8lxxtt08","/");
        if (xmarcados=="8lxxtt08=") xmarcados=""
        if (xmarcados==null) xmarcados=""
        if (xmarcados==" ") xmarcados=""
        if (xmarcados=="") xmarcados=""
        //coloco los mfnde los marcados
        window.document.formaS.item.value=xmarcados;
        //coloco el texto marcados
        window.document.formaS.pbusca.value="Marcados"; 
        //cargo pft
        window.document.formaS.pft.value = '4';                         
        
        //alert(window.document.formaS.item.value);
        if (window.document.formaS.item.value =="") 
        {
          window.status="No Hay Registros Marcados";
          alert("No Hay Registros Marcados");
        }
        else
        {
          formaS.submit();
          //alert(window.document.formaS.item.value);          
        }

    }      


    function enviar2(cadenabusqueda) 
    {
     
     //alert("Hola " +  cadenabusqueda ); 
     window.document.forma.pbusca.value = window.document.forma.pbusca2.value;
     window.document.forma.item.value = cadenabusqueda;
     window.document.forma.submit();     	
    	
    }
    
    function enviar3(cadenabusqueda) 
    {
     
     //alert("Hola " +  cadenabusqueda); 
     window.document.forma.pbusca.value = cadenabusqueda;
     window.document.forma.numero.value = "0";
     window.document.forma.stype.value = "";     
     window.document.forma.item.value = cadenabusqueda;
     //reviso pft..
     window.document.forma.pft.value = window.document.forma.base.value + '1';          
     
     window.document.forma.submit();     	
    	
    }
    


    function buscar(valor,basedatos) 
    {

        //coloco los mfnde los marcados
        window.document.formaS.item.value=valor;
           
        
        //alert(window.document.formaS.item.value);
        if (window.document.formaS.item.value =="") 
        {
         window.status="No Hay Valor Registrado";
        }
        else
        {

          //coloco el texto marcados
          window.document.formaS.pbusca.value=valor;
          //coloco el nuevo pft el primero
          //reinicio contador..
          //window.document.formaS.numero.value='0';
          //cargo pft
          window.document.formaS.pft.value=window.document.forma.pft.value;           
          //muerto alerta
          alert(window.document.formaS.pft.value);          
          //envio
          formaS.submit();
        }

}      


  function grafico(texto)
  {
  	
      var remote = null
      remote = window.open('','','toolbar=yes,scrollbars=yes,status=no,scrollbars=yes,resizable=yes,menubar=yes,width=500,height=400');

 	
	 remote.document.writeln("<html><head><title>PLANO DIGITALIZADO</TITLE><head>");
	 remote.document.writeln("<body bgcolor=\"#FFFFFF\" text=\"#000000\" leftmargin=\"0\" topmargin=\"0\" background=\"/images/FONDO2.gif\">");
	 remote.document.writeln("<p>");
	 remote.document.writeln("<applet codebase=\"/tiffy\" code=\"TiffyApplet.class\" archive=\"TiffyApplet.jar\"");
	 remote.document.writeln(" id=\"TiffyApplet\" width=\"800\" height=\"600\" >");
	 remote.document.writeln("<param name=\"cabbase\" value=\"TiffyApplets.cab\">");
	 remote.document.write("<param name=Filename value=\""); 
	 remote.document.write(texto); 
	 remote.document.writeln("\">");
	 remote.document.writeln("<param name=\"Options\" value =\"/save\">");
	 remote.document.writeln("Sorry, your browser is not capable of running java applets.");
	 remote.document.writeln("</applet> </p>");
	 remote.document.writeln("</body></html>");
  }


function verdwf(mitexto)
{


 var remote = null
      remote = window.open('','','toolbar=yes,scrollbars=yes,status=no,scrollbars=yes,resizable=yes,menubar=yes,width=500,height=400');

remote.document.writeln("<HTML><HEAD>");
remote.document.writeln("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">");
remote.document.writeln("<TITLE>ZoomON CADViever Light - http://www.cadviewer.com/</TITLE>");
remote.document.writeln("</HEAD><BODY><center>");
remote.document.writeln("<b>Please read <a href=\"readme.html\">this</a> for installation instructions.<p>");
remote.document.writeln("<applet codebase=\"/cadviewer\" code=\"ViewerApplet.class\" archive=\"obfu.jar\" width=787 height=535 MAYSCRIPT>");
remote.document.writeln("<param name=\"name\" value=\"");

remote.document.writeln(mitexto);
remote.document.writeln("\">");
remote.document.writeln("<param name=\"cabbase\" value=\"obfu.cab\">");
remote.document.writeln("<param name=\"type\" value=\"panel\">");
remote.document.writeln("<param name=\"url_target\" value=\"_self\">");
remote.document.writeln("<param name=\"water_mark\" value=\"You can add this water mark via the HTML page\">");
remote.document.writeln("<strong><font color=red>Error, if you see this text, you do not have a Java enabled browser</strong></font>");
remote.document.writeln("</applet></BODY></HTML>");

}




    function marcar(Marca) 
    {
        xmarcados=GetCookie("8lxxtt08","/");
        if (xmarcados=="8lxxtt08=") xmarcados=""
        if (xmarcados==null) xmarcados=""
        if (xmarcados==" ") xmarcados=""
        if (xmarcados=="") xmarcados=""
        if (Marca.checked) 
        {
            if (xmarcados=="") 
            {
              xmarcados=Marca.value+" "
            }
            else
            {
            xmarcados += " or "+Marca.value+" "
            }
        }
        else
        {
           i=xmarcados.indexOf(Marca.value,0)
           if (i==0) 
           {
              xmarcados=xmarcados.substring(i+Marca.value.length+4);
              
           }

           if (i>0)
           {
              xmarcados=xmarcados.substring(0,i-4)+xmarcados.substring(i-4+Marca.value.length+4,xmarcados.length)
              
           }
         }

       if (xmarcados=="" || xmarcados==" " || xmarcados=="  " || xmarcados=="   ") 
       {
         DeleteCookie("8lxxtt08")
         xmarcados= null;
       }
       else
       {
          SetCookie("8lxxtt08",xmarcados,null,"/")
       }; 
      formaS.item.value=xmarcados;
   

        if (xmarcados==null || xmarcados=="") 
        {
         window.status="No Hay Registros Marcados";
        }
        else
        {
         window.status=formaS.item.value;       
        }



      return false;
  }


