function selectEnvio(id)
{
    switch(id)
    {
        case 1:
            document.getElementById("otro_envio_text").style.display = 'none';
            document.getElementById("opciones_envio").style.display = 'none';
            break;
        case 2:
            document.getElementById("otro_envio_text").style.display = 'none';
            document.getElementById("opciones_envio").style.display = 'inline';
            break;
        case 3:
            document.getElementById("otro_envio_text").style.display = 'inline';
            document.getElementById("opciones_envio").style.display = 'inline';
            break;
    }
}

function selectDirEnvio(id)
{
    switch(id)
    {
        case 1:
            document.getElementById("seleccionar_direccion").style.display = 'none';
            document.getElementById("especificar_otra_direccion").style.display = 'none';
            break;
        case 2:
            document.getElementById("seleccionar_direccion").style.display = 'inline';
            document.getElementById("especificar_otra_direccion").style.display = 'none';
            break;
        case 3:
            document.getElementById("seleccionar_direccion").style.display = 'none';
            document.getElementById("especificar_otra_direccion").style.display = 'inline';
            break;
    }
}

function resetBuscar()
{
    document.frmBusqueda.str.value = '';
    document.frmBusqueda.marca.value = '';
    document.frmBusqueda.familia.value = '';
    document.frmBusqueda.subfamilia.value = '';
}


function fechaSubmit()
{
    fechaini = document.formulario.fechainiDia.value + "/" + document.formulario.fechainiMes.value + "/" + document.formulario.fechainiAno.value;
    document.formulario.fechaini.value = fechaini;

    fechafin = document.formulario.fechafinDia.value + "/" + document.formulario.fechafinMes.value + "/" + document.formulario.fechafinAno.value;
    document.formulario.fechafin.value = fechafin;

    document.formulario.submit();
}

function recalcular()
{
    if ((event.keyCode != 37) && (event.keyCode != 38) && (event.keyCode != 39) && (event.keyCode != 40))
    {
        document.formPedido.submit();
    }

}

function montre(id) {
	  if (document.getElementById) {
		  document.getElementById(id).style.display="block";
		} else if (document.all) {
		  document.all[id].style.display="block";
		} else if (document.layers) {
		  document.layers[id].display="block";
		} }

 function cache(id) {
	  if (document.getElementById) {
		  document.getElementById(id).style.display="none";
		} else if (document.all) {
		  document.all[id].style.display="none";
		} else if (document.layers) {
		  document.layers[id].display="none";
		} }

function activa_check_int()
{
    if (document.formulario.use_internet_check.checked==true)
    {
        document.formulario.use_internet_check_def[0].disabled = false;
        document.formulario.use_internet_check_def[1].disabled = false;
        document.formulario.use_internet_check_def[0].checked = true;
    }
    else
    {
        document.formulario.use_internet_check_def[0].disabled = true;
        document.formulario.use_internet_check_def[1].disabled = true;
    }
}

function copiarDireccion ()
{
    if (document.formPedido.igual.checked == 1)
    {
        document.formPedido.empresa2.value      = document.formPedido.empresa1.value;
        document.formPedido.universidad2.value  = document.formPedido.universidad1.value;
        document.formPedido.laboratorio2.value  = document.formPedido.laboratorio1.value;
        document.formPedido.facultad2.value     = document.formPedido.facultad1.value;
        document.formPedido.departamento2.value = document.formPedido.departamento1.value;
        document.formPedido.contacto2.value     = document.formPedido.contacto1.value;
        document.formPedido.email2.value        = document.formPedido.email1.value;
        document.formPedido.telf2.value         = document.formPedido.telf1.value;
        document.formPedido.fax2.value          = document.formPedido.fax1.value;
        document.formPedido.direccion2.value    = document.formPedido.direccion1.value;
        document.formPedido.cp2.value           = document.formPedido.cp1.value;
        document.formPedido.ciudad2.value       = document.formPedido.ciudad1.value;
        document.formPedido.provincia2.value    = document.formPedido.provincia1.value;
        document.formPedido.pais2.value         = document.formPedido.pais1.value;
        document.formPedido.proyecto2.value     = document.formPedido.proyecto1.value;
        document.formPedido.pedido2.value       = document.formPedido.pedido1.value;
        document.formPedido.poblacion2.value       = document.formPedido.poblacion1.value;
    }
    else
    {
        document.formPedido.empresa2.value      = '';
        document.formPedido.universidad2.value  = '';
        document.formPedido.laboratorio2.value  = '';
        document.formPedido.facultad2.value     = '';
        document.formPedido.departamento2.value = '';
        document.formPedido.contacto2.value     = '';
        document.formPedido.email2.value        = '';
        document.formPedido.telf2.value         = '';
        document.formPedido.fax2.value          = '';
        document.formPedido.direccion2.value    = '';
        document.formPedido.cp2.value           = '';
        document.formPedido.ciudad2.value       = '';
        document.formPedido.provincia2.value    = '';
        document.formPedido.pais2.value         = '';
        document.formPedido.proyecto2.value     = '';
        document.formPedido.pedido2.value       = '';
        document.formPedido.poblacion2.value    = '';
    }

}