<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">

<HTML>

<HEAD>

   <TITLE>Menus</TITLE>

   <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (WinNT; I) [Netscape]">

</HEAD>

<BODY TEXT="#FF0000" BGCOLOR="#FFFFFF" LINK="#FF0000" VLINK="#FF0000" ALINK="#FF0000">
 

<FORM>
<BR>
<BR>
<CENTER>
<INPUT TYPE="button" VALUE="Ver cesta"  ONCLICK="top.ps.verLista()"><BR>
<BR>
<BR>
<BR>

<!--  INICI PERSONALITZAR    -->

<A HREF="http://www.sitio1.es/pagina1">Link 1</A><BR>
<A HREF="http://www.sitio2.es/pagina2">Link 2</A><BR>
...<BR>
<A HREF="http://www.sition.es/pagina3">Link n</A><BR>

<!--  FI PERSONALITZAR    -->
</CENTER>
</FORM>
 

</BODY>
 
 

<SCRIPT LANGUAJE = "JavaScript">

<!--

var conten

function esNoNumero(n)
{
      var c

      for (var i=0; i<n.length; i++)
      {
        c=n.substring(i,i+1);
        if (! (c>='0' && c<='9') )
        {
          return 1
        }
      }
      return 0
}
 

function creador(n)
{
        this.length=n
        for (var i=1;i<=n;i++)
        {
                this [i]=0
        }
        return this
}
 

function bruto(i)
{
        var valorBruto;
 
        valorBruto = top.ps.conten[i].cantidad * top.ps.conten[i].precio;
        return valorBruto;
}
 

function totalProductos()
{
        total=0
        mlv=0
        llgratis=0
        n=conten[0]

        for (var i=1; i<=n;i++)
        {
           total=(total)+(top.ps.conten[i].precio)*top.ps.conten[i].cantidad;
        }
        top.producte.document.write("<P><font SIZE=+2>");
        top.producte.document.write("<b><font color='#000000'>Total: ");
        top.producte.document.write(pMils(" " + total));
        top.producte.document.write(" Ptas. </B>");
        top.producte.document.write("</font><br>");
        top.producte.document.write("<HR>");
        return 1;
}
 

function calculaTotalProductos()
{
        total=0
        mlv=0
        llgratis=0
        n=conten[0]

        for (var i=1; i<=n;i++)
        {
          total=(total)+((top.ps.conten[i].precio)*top.ps.conten[i].cantidad);
        }
        return total;
}
 

function construct (referencia, cantidad, precio, titulo)
{
        this.referencia=referencia;
        this.cantidad=cantidad;
        this.precio=precio;
        this.titulo=titulo;
}
 

function agregaArticulo(referencia, cantidad, precio, titulo)
{
        if (top.ps.esNoNumero(cantidad) || cantidad <= 0)
        {
          texto="La cantidad introducida no es valida";
          alert(texto);
        }
        else
        {
          texto="Este artículo ha sido repercutido en la Lista de Pedido.";
          for (var i=1; i<=conten[0]; i++)
          {
            if (top.ps.conten[i].referencia == referencia)
            {
              var j=parseInt(top.ps.conten[i].cantidad);
              var h=parseInt(cantidad);
              top.ps.conten[i].cantidad=h;
              alert(texto + " Siguen habiendo " + conten[0] + " referencia(s).");
              return;
            }
          }
          conten[conten[0]+1]= new construct(referencia, cantidad, precio, titulo);
          conten[0]++;
          alert(texto + " Hay " + conten[0] + " referencia(s).");
        }
}
 

function apostrof(cad)
{
      var novaCad;

      novaCad = cad;
      for (var i = 0; i < cad.length; i++)
      {
        if (cad.charAt(i) == "\'" )
        {
          if(i < cad.length-1)
          {
             novaCad = cad.substring(0, i) + "\140" + cad.substring(i+1, cad.length-1);
          }
          else
          {
             novaCad = cad.substring(0, i) + "\140"
          }
        }
      }
      return novaCad;
}
 

function pMils(num)
{
    var numAmbPunt;
    var partEntera;
    var partEnteraM;

    partEntera = Math.floor(num/1000);
    partEnteraM = Math.floor(num/1000000);

    if(num > 1000000)
    {
       numAmbPunt = partEnteraM + "." + num.substring(num.length-6, num.length-3) + "." + num.substring(num.length-3, num.length);
    }
    else if(num > 1000)
    {
       numAmbPunt = partEntera + "." + num.substring(num.length-3, num.length);
    }
    else
       numAmbPunt = num;

    return numAmbPunt;
}

function eliminarArticulos(formulari)
{
    var j;
    var i;
    var h;

    var aux;
    aux = new creador(100);

    for (i=1, h=0, j=0; i<=conten[0]; i++, h+=1)
    {
      if (! formulari.elements[h].checked)
      {
        aux[++j]=conten[i];
      }

   }
    for (i=1; i<=j; i++)
    {
      conten[i]=aux[i];
    }
    conten[0]=j;
    top.ps.mostrarArticulos();
}
 

function eliminarTodosArticulos()
{
    conten[0]=0;
    top.ps.mostrarArticulos();
}
 

function enviarPedido()
{
       conten[0]=0;
//       alert("Es recomendable guardar una copia impresa del resguardo como comprobante.");
}
 

function mensajeAlEnviar()
{
       alert("Seleccione la opción PRINT o IMPRIMIR de su navegador.");
}
 

function verLista()
{
    if (conten[0]==0)
    {
      alert("Lista de Pedido vacía");
    }
    else
    {
      top.ps.mostrarArticulos();
    }
}

 
function mostrarArticulos()
{
    var texto;
    var campo;
    var conjunto;
    if (conten[0]==0)
    {
      alert("Lista de Pedido vacía");
    }
    top.producte.document.clear();
    top.producte.document.write("<HTML>\n");
    top.producte.document.write("<body bgcolor='#FFFFFF'>");

<!--  INICI PERSONALITZAR    -->

    top.producte.document.write("<center><h2><font color='#FFFFFF'> Lista de Pedido de " + top.document.forms[0].elements['COD_CLI'].value + " (" + top.document.forms[0].elements['NOM_CLI'].value + ") </h2></font></center>\n");
    top.producte.document.write("<center><form method='POST' action='mailto:xpi@pi-savall.es' NAME='Pedido'>\n");

<!--  FI PERSONALITZAR    -->

    top.producte.document.write("<table border=1 cellspacing=0>");
    top.producte.document.write("<tr>\n");
    top.producte.document.write("<td width=50 bgcolor='#A6CAF0'>");
    top.producte.document.write("<font color=#000000><b>Num. Art.</b></font>");
    top.producte.document.write("</td>\n");
    top.producte.document.write("<td width=250 bgcolor='#A6CAF0'>");
    top.producte.document.write("<font color=#000000><b>Descripci&oacute;n</b></font>");
    top.producte.document.write("</td>\n");
    top.producte.document.write("<td width=80 align='center' bgcolor='#A6CAF0'>");
    top.producte.document.write("<font color=#000000><b>Cantidad</b></font>");
    top.producte.document.write("</td>\n");
    top.producte.document.write("<td width=80 align='center' bgcolor='#A6CAF0'>");
    top.producte.document.write("<font color=#000000><b>Precio (Pts)</b></font>");
    top.producte.document.write("</td>\n");
    top.producte.document.write("<td width=80 align='center' bgcolor='#A6CAF0'>");
    top.producte.document.write("<font color=#000000><b>Imp. Bruto</b></font>");
    top.producte.document.write("</td>\n");
    top.producte.document.write("<td width=80 align='center' bgcolor='#CCCCCC'>");
    top.producte.document.write("<font color=#000000><b>Eliminar</b></font>");
    top.producte.document.write("</td>\n");
    top.producte.document.write("</tr>\n");

    for (var i=1; i<=conten[0]; i++)
    {
        texto=""
        top.producte.document.write("<tr>");
        top.producte.document.write("<td align='CENTER' width=50>");
        top.producte.document.write("<font color=#000000>");
        top.producte.document.write(top.ps.conten[i].referencia)
        top.producte.document.write("</font></td>\n");
        top.producte.document.write("<td width=250>");
        top.producte.document.write("<font color=#000000>");
        top.producte.document.write(top.ps.conten[i].titulo)
        top.producte.document.write("</font></td>\n");
        top.producte.document.write("<td align='RIGHT' width=80>");
        top.producte.document.write("<font color=#000000>");
        top.producte.document.write(pMils(top.ps.conten[i].cantidad))
        top.producte.document.write("</font>&nbsp;</td>\n");
        top.producte.document.write("<td align='RIGHT' width=80>");
        top.producte.document.write("&nbsp;<font color=#000000>");
        top.producte.document.write(pMils(top.ps.conten[i].precio))
        top.producte.document.write("</font>&nbsp;</td>\n")
        top.producte.document.write("<td align='RIGHT' width=80><b>");
        top.producte.document.write("&nbsp;<font color=#000000>");
        top.producte.document.write(pMils(" " + top.ps.bruto(i)));
        top.producte.document.write("</b></font>&nbsp;</td>\n");
        top.producte.document.write("<td width=80 align=center>");
        top.producte.document.write("<INPUT TYPE=checkbox NAME=Campo"+i+" VALUE='Eliminado'>\n");
        top.producte.document.write("</td></tr>\n");
    }

    top.producte.document.write("</table><p>\n");

    for (i=1; i<=conten[0]; i++)
    {
        texto=top.ps.conten[i].referencia;
        campo="r_" + i;
        conjunto="<INPUT NAME='" + campo + "' TYPE='HIDDEN' VALUE='" + texto + "'>\n";
        top.producte.document.write(conjunto);

        texto=apostrof(top.ps.conten[i].titulo);
        campo="d_" + i;
        conjunto="<INPUT NAME='" + campo + "' TYPE='HIDDEN' VALUE='" + texto + "'>\n";
        top.producte.document.write(conjunto);

        texto=pMils(top.ps.conten[i].cantidad);
        campo="q_" + i;
        conjunto="<INPUT NAME='" + campo + "' TYPE='HIDDEN' VALUE='" + texto + "'>\n";
        top.producte.document.write(conjunto);

        texto=pMils(top.ps.conten[i].precio);
        campo="p_" + i;
        conjunto="<INPUT NAME='" + campo + "' TYPE='HIDDEN' VALUE='" + texto + "'>\n";
        top.producte.document.write(conjunto);

        texto=pMils(" " + top.ps.bruto(i));
        campo="b_" + i;
        conjunto="<INPUT NAME=" + campo + " TYPE='HIDDEN' VALUE='" + texto + "'>\n";
        top.producte.document.write(conjunto);
     }

     texto=pMils(" " + top.ps.calculaTotalProductos());
     campo="t";
     conjunto="<INPUT NAME='" + campo + "' TYPE='HIDDEN' VALUE='" + texto + "'>\n";
     top.producte.document.write(conjunto);

     texto=top.document.forms[0].elements['COD_CLI'].value + "  ";
     campo="k";
     conjunto="<INPUT NAME='" + campo + "' TYPE='HIDDEN' VALUE='" + texto + "'>\n";
     top.producte.document.write(conjunto);

     texto=top.document.forms[0].elements['NOM_CLI'].value + "  ";
     campo="n";
     conjunto="<INPUT NAME='" + campo + "' TYPE='HIDDEN' VALUE='" + texto + "'>\n";
     top.producte.document.write(conjunto);

     if (top.ps.totalProductos()==0)
       return;
 
     top.producte.document.write("<center>");
     top.producte.document.write("<input type=button value='Continuar Pedido' onClick=history.back()>\n");
     top.producte.document.write("<input type=button value='Eliminar marcados' onClick=top.ps.eliminarArticulos(this.form)>\n");
     top.producte.document.write("<input type=button value='Eliminar todos' onClick=top.ps.eliminarTodosArticulos()><P>\n");
     top.producte.document.write("Al contado<INPUT NAME='medio' TYPE='RADIO' VALUE='C'>&nbsp;&nbsp;&nbsp;\n");
     top.producte.document.write("Transferencia bancaria<INPUT NAME='medio' TYPE='RADIO' VALUE='B'>&nbsp;&nbsp;&nbsp;\n");
     top.producte.document.write("Tarjeta de cr&eacute;dito<INPUT NAME='medio' TYPE='RADIO' VALUE='T'>&nbsp;&nbsp;&nbsp;<BR><BR>\n");
     top.producte.document.write("Persona de contacto <INPUT NAME='email' TYPE='TEXT' SIZE='30' MAXLENGHT='40'><br><p>\n");
     top.producte.document.write("Datos de pago <INPUT NAME='datospago' TYPE='TEXT' SIZE='50' MAXLENGHT='50'><p>\n");
     top.producte.document.write("<INPUT TYPE='SUBMIT' VALUE='Enviar el Pedido' NAME='submit' onClick='top.ps.enviarPedido()'>\n");
     top.producte.document.write("</FONT></center>\n");
     top.producte.document.write("</FORM>");
     top.producte.document.write("<P></BODY>\n");
     top.producte.document.write("</HTML>\n");
     top.producte.document.close();
}

conten = new creador (100);
conten[0]=0;

document.clear();

// -->

</SCRIPT>

<NOSCRIPT>

<!--  INICI PERSONALITZAR    -->

<A HREF="mailto:nom@domini.es"><B>mailto:nom@domini.es</B></A></FONT>

<!--  FI PERSONALITZAR    -->

</NOSCRIPT></P>

</HTML>