
function pedidoCambiaTipoPedido(sel) {
	return;

	switch(sel.selectedIndex) {
		case 3:		//Puntual
			document.getElementById('formaPago2').disabled = false;
			document.getElementById('formaPago3').disabled = false;

			if(document.getElementById('formaPago1').checked)
				document.getElementById('formaPago2').checked = true;

			document.getElementById('formaPago1').disabled = true;
			break;	
			
		default:	//Periódico
			document.getElementById('formaPago1').disabled = false;
			document.getElementById('formaPago1').checked = true;

			document.getElementById('formaPago2').disabled = true;
			document.getElementById('formaPago3').disabled = true;
			break;
	} 
	pedidoCalculaImporte(sel.form);
}



function pedidoCalculaImporte(f) {
	return;

	var tipoPack = f.tipoPack.selectedIndex;
	var zonaGeografica = f.zonaGeografica.selectedIndex;


	var calcular = (tipoPack!=0) && (zonaGeografica!=0);

	if(calcular) {
		if(tipoPack==1) {
			if (zonaGeografica == 1) importe = 21.90;
			if (zonaGeografica == 2) importe = 26.50;
		} 
		if(tipoPack==2) {
			if (zonaGeografica == 1) importe = 26.90;
			if (zonaGeografica == 2) importe = 32.00;
		}

		if (document.getElementById('formaPago3').checked) importe += 4;

		importe = '' + Math.round(importe*100);
		importe = importe.substr(0, importe.length-2) + ',' + importe.substr(importe.length-2);
		cad = 'El importe total de su pedido, según los parámetros seleccionados, es de <b>' + (''+importe).replace('.', ',') + ' €</b>';
		f.importe.value = importe;

	} else {
		cad = 'Para calcular el importe de su pedido debe seleccionar el tipo de pack y la zona geográfica del envío';
		f.importe.value = '';
	}
	
	document.getElementById('divImporte').innerHTML = cad;
}

var vent;

function pedidoEnvia(f) {

	var tipoPack = f.tipoPack.selectedIndex;
	if (tipoPack==0) return alert('Debe seleccionar el tipo de pack');

	var tipoPedido = f.tipoPedido.selectedIndex;
	if (tipoPedido==0) return alert('Debe seleccionar el tipo de pedido');

	if (zonaGeografica==0) return alert('Debe seleccionar la zona geográfica');

	var formaPago = 1;
	if (document.getElementById('formaPago2').checked) formaPago = 2;
	if (document.getElementById('formaPago3').checked) formaPago = 3;

	if (formaPago==1) {
		if(f.cuenta1.value.length!=4) return alert('El código del banco debe tener 4 dígitos');
		if(f.cuenta2.value.length!=4) return alert('El código de la sucursal debe tener 4 dígitos');
		if(f.cuenta3.value.length!=2) return alert('El número de control debe tener 2 dígitos');
		if(f.cuenta4.value.length!=10) return alert('El número de cuenta debe tener 10 dígitos');
	}

	if (f.nombre.value=='' || f.telefono.value=='' || f.email.value=='') return alert('Todos los datos de contacto son obligatorios');

	var zonaGeografica = f.zonaGeografica.selectedIndex;
	if (zonaGeografica==0) return alert('Debe seleccionar la zona geográfica de envío');
	if (f.direccion.value=='' || f.localidad.value=='' || f.provincia.value=='' || f.cp.value=='') return alert('Todos los datos de envío son obligatorios');
	
	if(vent) vent.close();
	vent = window.open('','pedido','width=600,height=600,scrollbars=no,resizable=no,status=yes,menubar=no,location=no');
	
	f.action = 'pedido.php';
	f.target = 'pedido';
	f.submit();
}