function valida_envia_step1(){ 
  error=false;
  strError="¡¡Corrija los campos marcados en rojo!!\n\n";
  //strError= new Array(13)
  //valido el nombre 
    if (document.f1.Name.value.length==0){
       strError=strError+("- Tiene que escribir su nombre\n");
      // alert(strError[1]); 
       //document.f1.Name.focus();
	   document.f1.Name.style.backgroundColor='#ff4500';
       error=true;
     }else{
      document.f1.Name.style.backgroundColor='#ffcc33'; 
      } 
    
 //Valido el Apellido
	if (document.f1.surname.value.length==0){
       strError=strError+("- Tiene que escribir su apellido\n");
      // alert(strError[1]); 
       //document.f1.Name.focus();
	   document.f1.surname.style.backgroundColor='#ff4500';
       error=true 
   }else{
      document.f1.surname.style.backgroundColor='#ffcc33'; 
      } 
   
 // Validar email
	var email = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
	if (!email.test(document.f1.email.value) ) {
	error=true;
	strError=strError+("- El e-mail es incorrecto\n");
	document.f1.email.style.backgroundColor='#ff4500';
	}else{
      document.f1.email.style.backgroundColor='#ffcc33'; 
      } 
   
//valido el PedCP
    PedCP = document.f1.PedCP.value ;
    PedCP = validarEntero(PedCP); 
    document.f1.PedCP.value=PedCP; 
    if (PedCP==""){ 
      // alert("Tiene que introducir un número entero en su Código Postal."); 
	   strError=strError+("- El Código Postal del Pedido está vacio\n");
       //document.f1.PedCP.focus();
	    document.f1.PedCP.style.backgroundColor='#ff4500';
	   	error=true;	   
       
    }else{ 
       if ((PedCP>99999 )|| (PedCP<01000)){ 
          //alert("Código Postal no válido.") ;
		   strError=strError+("- El Código Postal del Pedido no es válido\n");
          //document.f1.PedCP.focus() ;
		   document.f1.PedCP.style.backgroundColor='#ff4500';
		  error=true;
          
       }
       else{
      document.f1.PedCP.style.backgroundColor='#ffcc33'; 
      }  
       
    } 
    
	
	//Valido la fecha
		var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
		var matchArray = document.f1.fechaentrega.value.match(datePat); // is the format ok?

		if (matchArray == null) {
		//alert("Por favor recuerde introducir la fecha de la siguiente forma dd/mm/yyyy.");
		strError=strError+("- Se debe introducir la fecha de la siguiente forma dd/mm/yyyy.\n");
		document.f1.fechaentrega.style.backgroundColor='#ff4500';
		error=true;
		//return false;
		}
		else{
		day = matchArray[1]; // p@rse date into variables
		month = matchArray[3];
		year = matchArray[5];

		    if (month < 1 || month > 12) { // check month range
		        error=true;
		        strError=strError+("- El mes no es válido\n");
		        document.f1.fechaentrega.style.backgroundColor='#ff4500';
		        //return false;
		    }
		    else{
		        if (month > 5 && month <11){
		        error=true;
		        strError=strError+("- Todavia no ha comenzado la campaña, realice sus pedidos con fecha de entrega entre Noviembre y Mayo aproximadamente, Muchas gracias \n");
		        document.f1.fechaentrega.style.backgroundColor='#ff4500';
		        }
		        else{
		            document.f1.fechaentrega.style.backgroundColor='#ffcc33';
		       
		if (day < 1 || day > 31) {
		strError=strError+("- El día debe estar entre 1 y 31\n");
		document.f1.fechaentrega.style.backgroundColor='#ff4500';
		error=true;
		//return false;
		}
		else{
		    document.f1.fechaentrega.style.backgroundColor='#ffcc33';
		}
		if ((month==4 || month==6 || month==9 || month==11) && day==31) {
		    strError=strError+("- El mes "+month+" no tiene 31 días.\n");
		    document.f1.fechaentrega.style.backgroundColor='#ff4500';
		    //alert("El mes "+month+" no tiene 31 dias!")
		    //return false;
		    error=true;
		}
		else{
		    document.f1.fechaentrega.style.backgroundColor='#ffcc33';
		}
		if (month == 2) { // check for february 29th
		    var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
		    if (day > 29 || (day==29 && !isleap)) {
		        //alert("Febrero de " + year + " no tiene " + day + " dias!");
		        strError=strError+("- Febrero de " + year + " no tiene " + day + " dias!\n");
		        document.f1.fechaentrega.style.backgroundColor='#ff4500';
		        error=true;
		        //return false;
		    }
		    else{
		        document.f1.fechaentrega.style.backgroundColor='#ffcc33';}
		    }
		    document.f1.fechaentrega.style.backgroundColor='#ffcc33';
        } }}
//Valido el Nombre del Pedido
if (document.f1.PedName.value.length==0){
       strError=strError+("- Tiene que escribir el nombre del destinatario\n");
      // alert(strError[1]); 
       //document.f1.Name.focus();
	   document.f1.PedName.style.backgroundColor='#ff4500';
       error=true 
        
    }else{document.f1.PedName.style.backgroundColor='#ffcc33';}
 //Valido el Apellido del pedido
	if (document.f1.PedSurname.value.length==0){
       strError=strError+("- Tiene que escribir el apellido del destinatario\n");
      // alert(strError[1]); 
       //document.f1.Name.focus();
	   document.f1.PedSurname.style.backgroundColor='#ff4500';
       error=true;
        
    }else{document.f1.PedSurname.style.backgroundColor='#ffcc33';}
	
	if (document.f1.PedTAddress.value =="") //comprueba si el campo nombre esta vacío
	{
		
		strError=strError+("- Seleccione el tipo de Vía del Pedido\n");
		document.f1.PedTAddress.style.backgroundColor='#ff4500';
	error=true
		
	}else{document.f1.PedTAddress.style.backgroundColor='#ffcc33';}
	if (document.f1.PedAddress.value =="") //comprueba si el campo nombre esta vacío
	{
		strError=strError+("- Indique la dirección del Pedido\n");
		document.f1.PedAddress.style.backgroundColor='#ff4500';
		error=true
		
	}else{document.f1.PedAddress.style.backgroundColor='#ffcc33';}
	if (document.f1.Pedpoblacion.value =="") //comprueba si el campo nombre esta vacío
	{
		strError=strError+("- Indique la Población del Pedido\n");
		document.f1.Pedpoblacion.style.backgroundColor='#ff4500';
		error=true
	}else{document.f1.Pedpoblacion.style.backgroundColor='#ffcc33';}
	if (document.f1.Pedprovincia.value =="") //comprueba si el campo nombre esta vacío
	{
		strError=strError+("- Indique la Provincia del Pedido\n");
		document.f1.Pedprovincia.style.backgroundColor='#ff4500';
		error=true
	}else{document.f1.Pedprovincia.style.backgroundColor='#ffcc33';}
	
 // Validar email Pedido
 //var email = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
	if (!email.test(document.f1.Pedemail.value) ) {
	error=true;
	strError=strError+("- El e-mail del Pedido es incorrecto\n");
	document.f1.Pedemail.style.backgroundColor='#ff4500';
	}else{document.f1.Pedemail.style.backgroundColor='#ffcc33';}
//Validar Telefon

if (document.f1.Pedphone.value.length != 9) {
      error=true;
	  strError=strError+("- El Telefono debe tener 9 cifras");
	  document.f1.Pedphone.style.backgroundColor='#ff4500';
	  }
   else{ 
            if ( validarEntero(document.f1.Pedphone.value)==""){
			 error=true;
			 strError=strError+("- El Telefono está vacio.");
			 document.f1.Pedphone.style.backgroundColor='#ff4500';
			} else{document.f1.Pedphone.style.backgroundColor='#ffcc33';}
         } 
   

 //el formulario se envia (bloquea una capa y visualiza otra)
 if (error==false){
    //alert("Muchas gracias por enviar el formulario"); 
    blocking('pr','datos'); 
    }
    else{
    
    window.alert(strError)
	strError="";
    }
} 


function valida_envia_step2(){ 


//Valido Si ha elegido algun producto
strErrorStep2="";
if (document.f1.cantClemenules1.value=="0") {
	if (document.f1.cantClemenules5.value=="0"){
		if (document.f1.cantHermandinas2.value=="0"){
			if (document.f1.cantNavelLanelate3.value=="0"){
			    if (document.f1.cantValenciaLate4.value=="0"){
				    strErrorStep2=strErrorStep2+("- Debe seleccionar algún producto\n");
				    error=true;
			    }
			    else{
			    error=false;
			    }
		    }
		    else{
			error=false;
			}
	    }
	    else{
		error=false;
		}
    }
    else{
	error=false;
	}
}
else{
error=false;
}
      // alert(strError[1]); 
       //document.f1.Name.focus();
	  // document.f1.PedName.style.backgroundColor='#9fc628';
        
        
    
if (error==false){
    //alert("Muchas gracias por enviar el formulario"); 
    blocking('pago','pr');
    }
    else{
    
    window.alert(strErrorStep2)
	strErrorStep2="";
    }
}

function valida_envia_step3(){ 


//Valido Si ha elegido algun producto
strErrorStep3="";
if (document.f1.FPago.value=="") {
	error=true;
	strErrorStep3=strErrorStep3+("- Seleccione una Forma de Pago.");
	document.f1.FPago.style.backgroundColor='#9fc628';
}
else{
	error=false;
	}
      // alert(strError[1]); 
       //document.f1.Name.focus();
	  // document.f1.PedName.style.backgroundColor='#9fc628';
        
        
    
if (error==false){
    //alert("Muchas gracias por enviar el formulario"); 
    //blocking('pago','pr');
	document.f1.submit();
    }
    else{
    
    window.alert(strErrorStep3)
	strErrorStep3="";
    }
}


// ******************************************************************
// This function accepts a string variable and verifies if it is a
// proper date or not. It validates format matching either
// mm-dd-yyyy or mm/dd/yyyy. Then it checks to make sure the month
// has the proper number of days, based on which month it is.

// The function returns true if a valid date, false if not.
// ******************************************************************

function isDate(dateStr) {

var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
var matchArray = dateStr.match(datePat); // is the format ok?

if (matchArray == null) {
alert("Por favor recuerde introducir la fecha de la siguiente forma dd/mm/yyyy.");
return false;
}

day = matchArray[1]; // p@rse date into variables
month = matchArray[3];
year = matchArray[5];

if (month < 1 || month > 12) { // check month range
alert("El mes debe ser un valor entre 1 y 12.");
return false;
}

if (day < 1 || day > 31) {
alert("Los dias deben tener una valor entre 1 y 31.");
return false;
}

if ((month==4 || month==6 || month==9 || month==11) && day==31) {
alert("El mes "+month+" no tiene 31 dias!")
return false;
}

if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day > 29 || (day==29 && !isleap)) {
alert("Febrero de " + year + " no tiene " + day + " dias!");
return false;
}
}
return true; // date is valid
}



function copy_data() {
	
	document.getElementById('order_name').value= document.getElementById('name').value;
	document.getElementById('order_surname').value= document.getElementById('surname').value;
	document.getElementById('order_taddress').value= document.getElementById('taddress').value;		
	document.getElementById('order_street').value= document.getElementById('street').value;
	document.getElementById('order_cp').value= document.getElementById('cp').value;
	document.getElementById('order_city').value= document.getElementById('city').value;
	document.getElementById('order_state').value= document.getElementById('state').value;
	document.getElementById('order_phone').value= document.getElementById('phone').value;
	document.getElementById('order_email').value= document.getElementById('email').value;
}

function calculo(cantidad,precio,inputtext,totaltext){

	// Calculo del subtotal
	subtotal = precio*cantidad;
	inputtext.value=subtotal;

        //Calculo del total
	total = eval(totaltext.value);
	totaltext.value = total + subtotal;
}

function SumaTotal(tot){

	document.getElementById('tot').value = eval(document.getElementById('precioValenciaLate42').value) + eval(document.getElementById('precioNavelLanelate32').value) + eval(document.getElementById('precioHermandinas22').value) + eval(document.getElementById('precioClemenules12').value)+ eval(document.getElementById('precioClemenules52').value);
}

function blocking(nr,nr1)// esta funcion ejecuta la orden valida segun el explorador si es explorer document.all.style.display
{
	if (document.layers)
	{
		document.layers[nr].display = 'block'; //block = mostrado
		document.layers[nr1].display = 'none'; //none = oculto
	}
	else if (document.all)
	{ 
		document.all[nr].style.display = 'block';
		document.all[nr1].style.display = 'none';
	}
	else if (document.getElementById)
	{
		document.getElementById(nr).style.display = 'block';
		document.getElementById(nr1).style.display = 'none';
	}
}

function muesocult(br,img)
{
	if (document.layers)
	{	
		vista = (document.layers[br].display == 'none') ? 'block' : 'none';
		document.layers[br].display = vista;
		
		if (document.layers[br].display == 'none'){
		document.layers[img].setAttribute('src','/images/neutral/flecha_abajo1.gif'); }
		else{
		document.layers[img].setAttribute('src','/images/neutral/flecha_arriba1.gif');}
			}
	else if (document.all)
	{
		vista = (document.all[br].style.display == 'none') ? 'block' : 'none';
		document.all[br].style.display = vista;
		if (document.all[br].style.display == 'none'){
		document.all[img].setAttribute('src','/images/neutral/flecha_abajo1.gif'); }
		else{
		document.all[img].setAttribute('src','/images/neutral/flecha_arriba1.gif');}
	}	
	else if (document.getElementById)
	{
		vista = (document.getElementById(br).style.display == 'none') ? 'block' : 'none';
		document.getElementById(br).style.display = vista;
		if (document.getElementById(br).style.display == 'none'){
		document.getElementById(img).setAttribute('src','/images/neutral/flecha_abajo1.gif'); }
		else{
		document.getElementById(img).setAttribute('src','/images/neutral/flecha_arriba1.gif');}
	} 	
}

function expandir_formulario(){
 if (document.f1.expandir.checked){
	xDisplay('capaexpansion', 'block')
 }else{
	xDisplay('capaexpansion', 'none')
 }

}


avisado=false 
function validarEntero(valor){ 
      //intento convertir a entero. 
      //si era un entero no le afecta, si no lo era lo intenta convertir 
       valor = parseInt(valor) 

      //Compruebo si es un valor numérico 
      if (isNaN(valor)) { 
         //entonces (no es numero) devuelvo el valor cadena vacia 
         return "" 
      }else{ 
         //En caso contrario (Si era un número) devuelvo el valor 
         return valor 
      } 
} 


function compruebaValidoEntero(){ 
   enteroValidado = validarEntero(document.f1.numero.value) 
   if (enteroValidado == 0){ 
      //si vale 0 es que no era válido. Lo aviso 
      if (!avisado){ 
         alert ("Debe escribir un entero!") 
         //selecciono el texto 
         document.f1.numero.select() 
         //coloco otra vez el foco 
         document.f1.numero.focus() 
         avisado=true 
         setTimeout('avisado=false',50)
         return 0
      } 
   }else 
      document.f1.numero.value = enteroValidado 
} 

function compruebaValidoCP(){ 
 

   CPValido=true 
   //si no tiene 5 caracteres no es válido 
   if (document.f1.cp.value.length != 5) {
      CPValido=false;
      return 0;
      }
   else{ 
      for (i=0;i<5;i++){ 
         CActual = document.f1.cp.value.charAt(i) 
         if (validarEntero(CActual)==0){ 
            CPValido=false; 
            return 0;
            break; 
         } 
      } 
   } 
   if (!CPValido){ 
      if (!avisado){ 
         //si no es valido, Lo aviso 
         alert ("Debe escribir un código postal válido") 
         //selecciono el texto 
         document.f1.cp.select() 
         //coloco otra vez el foco 
         document.f1.cp.focus() 
         avisado=true 
         setTimeout('avisado=false',50) 
      } 
   } 
} 

function compruebaValidoPedCP()
{ 
 
   //si no tiene 5 caracteres no es válido 
   if (document.f1.PedCP.value.length != 5){
	  return 0;
	  }
   else{ 
		if (validarEntero(document.f1.PedCP.value)==""){ 
				return 0; 
	    } 
		else
		return 1;
    } 
   } 

function validarEmail(valor) {//Esta no la uso
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
   // alert("La dirección de email " + valor    + " es correcta.") 
   return (true)  } else {
   alert("La dirección de email "+  valor    + " es incorrecta.");
   //document.f1.valor.focus() 
   return (false);
  }
 }

 
 
 function vacio() {
   
  // Array con todos los elementos del formulario
  camposTexto = f1.elements;
  
  for (x=0; x < camposTexto.length; x++) {
 
    if (camposTexto[x].value == '' && camposTexto[x].type=='text'){
   
     alert("El campo " + camposTexto[x].name
       + " está vacio y es OBLIGATORIO");
     return false;
  
    }

   }

   // Recorremos todos los campos de texto buscando que esten llenos
   // Lista con los checkbox
   check = formulario.deportes;

   // Variable que detecte si hay alguno seleccionado
   // Inicialmente en false
   //Recorremos todos los checkbox buscando que haya alguno marcado
   selected = false

   x=0;
  
   while (!selected && (x <check.length)) {
 
    if (check[x].checked) {   
     selected = true;  
    }
    
    x++;

   }
   
   if (!selected) {
 
   alert ("Para poder continuar deberá de selecionar alguna de las opciones");
   return false;

   }
   alert("Todo está correctamente");
   return true;
  }
function ValidacionNombre()
{
	if (document.f1.Name.value =="") //comprueba si el campo nombre esta vacío
	{
		//alert ("Debes indicar el nombre");
		//strError= "Debes indicar el nombre" +
		//document.f1.Name.focus();   //posicionarse en el campo vacío
		return 0;
		
	}else
	return 1;
	
}//OK
function ValidacionApellido()
{
	if (document.f1.surname.value =="") //comprueba si el campo nombre esta vacío
	{
		//alert ("Debes indicar el apellido");
		//document.f1.surname.focus();   //posicionarse en el campo vacío
	return 0;
		
	}else
	return 1;
	
}//OK
function ValidacionNombrePed()
{
	if (document.f1.PedName.value =="") //comprueba si el campo nombre esta vacío
	{
		//alert ("Debes indicar el nombre de los datos de entrega");
		//document.f1.Name.focus();   //posicionarse en el campo vacío
		return 0;
		
	}else
	return 1;
		
	
	
}//OK
function ValidacionTDomicilioPed()
{
	if (document.f1.PedTAddress.value =="") //comprueba si el campo nombre esta vacío
	{
		//alert ("Debe seleccionar un tipo de vía en los datos del pedido");
		//document.f1.surname.focus();   //posicionarse en el campo vacío
		
	return 0;
		
	}else
	return 1;
	
}//OK
function ValidacionFPago()
{
	if (document.f1.FPago.value =="") //comprueba si el campo nombre esta vacío
	{
		//alert ("Debe seleccionar un tipo de vía en los datos del pedido");
		//document.f1.surname.focus();   //posicionarse en el campo vacío
		
	return 0;
		
	}else
	return 1;
	
}//OK
function ValidacionDireccionPed()
{
	if (document.f1.PedAddress.value =="") //comprueba si el campo nombre esta vacío
	{
		//alert ("Debe indicar el domicilio de envío en los datos del pedido");
		//document.f1.surname.focus();   //posicionarse en el campo vacío
		
	return 0;
		
	}else
	return 1;
	
}//OK
function ValidacionPedPob()
{
	if (document.f1.Pedpoblacion.value =="") //comprueba si el campo nombre esta vacío
	{
		//alert ("Debe seleccionar la población en los datos del pedido");
		//document.f1.surname.focus();   //posicionarse en el campo vacío
		
	return 0;
		
	}else
	return 1;
	
}//OK
function ValidacionDireccionPed()
{
	if (document.f1.PedAddress.value =="") //comprueba si el campo nombre esta vacío
	{
		//alert ("Debe indicar el domicilio de envío en los datos del pedido");
		//document.f1.surname.focus();   //posicionarse en el campo vacío
		
	return 0;
		
	}else
	return 1;
	
}//OK
function ValidacionPedPro()
{
	if (document.f1.Pedprovincia.value =="") //comprueba si el campo nombre esta vacío
	{
		//alert ("Debe seleccionar la provincia en los datos del pedido");
		//document.f1.surname.focus();   //posicionarse en el campo vacío
		
	return 0;
		
	}else
	return 1;
	
}//OK

function compruebaValidoPedPhone(){ 
 

   PhoneValido=true 
   //si no tiene 9 caracteres no es válido 
   if (document.f1.Pedphone.value.length != 9) 
      PhoneValido=false 
   else{ 
            if ( validarEntero(document.f1.Pedphone.value)==""){
			 PhoneValido=false
			}else
			 PhoneValido=true
			 
         } 
   if (!PhoneValido){ 
      if (!avisado){ 
         //si no es valido, Lo aviso 
         alert ("El Nº de Teléfono no es válido, debe ser similar al ejemplo inferior.") 
         //selecciono el texto 
         document.f1.Pedphone.select() 
         //coloco otra vez el foco 
         document.f1.Pedphone.focus() 
         avisado=true 
         setTimeout('avisado=false',50) 
      }
	return 0	  
   } 
   else
   return 1
} 

  function validarSiNumero(numero){
if (!/^([0-9])*$/.test(numero))
alert("El valor " + numero + " no es un número");
}

function ValidacionPaso1(f1,pr,datos)
{
	if (document.f1.Name.value =="") //comprueba si el campo nombre esta vacío
	{
		alert ("Debes indicar el nombre");
		document.f1.Name.focus();   //posicionarse en el campo vacío
		return false;
	}
	else
		//return true;
		blocking('pr','datos')
}
function ValidacionPaso2(tot)
{
	if (document.f1.tot.value=='0') //comprueba si el campo total esta vacío
	{
		alert ("Debe seleccionar una cantidad de algún producto, para continuar");
		//document.getElementById('tot').focus();   //posicionarse en el campo vacío
		return 0;
	}
	else
		return 1;
		
}

//function ValidacionPaso1(f1,pr,datos)
//{
	//if (document.f1.Name.value =="") //comprueba si el campo nombre esta vacío
	//{
		//alert ("Debes indicar el nombre");
		//document.f1.Name.focus();   //posicionarse en el campo vacío
		//return false;
	//}
	//else
	//if (document.f1.Surname.value =="") //comprueba si el campo nombre esta vacío
	//{
	//	alert ("Debes indicar el Apellido");
		//document.f1.Surname.focus();   //posicionarse en el campo vacío
		//return false;
	//}
	//else
	//if (!compruebaValidoCP()) //comprueba si el campo nombre esta vacío
	//{
		
		//document.f1.CP.focus();   //posicionarse en el campo vacío
		//return false;
	//}
	//else
		//return true;
		//blocking('pr','datos')
//}
 
 
 ///valida campos no vacíos
function valida(c)
{
//alert("validando");
var i,v;
if(c)
 {
 i=c.name+"obl";
 (c.value.length<5)?v="visible":v="hidden";
 document.getElementById(i).style.visibility=v;
 }
}
///deshabilita botón enviar si campos vacíos

function deshabilita(form)
{
    if ((ValidacionNombre()) && (ValidacionApellido()) && (ValidarEmail('email')) && (ValidacionNombrePed()) && (ValidacionTDomicilioPed()) && (ValidacionDireccionPed()) && (ValidacionPedPob()) && (ValidacionPedPro())  && (ValidarEmail('Pedemail'))  && (compruebaValidoPedCP()) && (compruebaValidoPedPhone()) )
    { // && ValidarEmail("email") && (f1.PedName.value != "") && (f1.PedTAddress.value != "") && (f1.PedAddress.value != "") && (f1.PedCP.value != "") && (f1.Pedpoblacion.value != "") && (f1.Pedprovincia.value != "") && ValidarEmail("Pedemail") && (f1.Pedphone.value != "") &&  (f1.CP.value.length >= 5)
		f1.B1.disabled = false; 
	} 
    else 
	{ 
		f1.B1.disabled = true; 
	}
}
function deshabilitaB2(form)
{
    if ((ValidacionPaso2('tot')) )
    { // && ValidarEmail("email") && (f1.PedName.value != "") && (f1.PedTAddress.value != "") && (f1.PedAddress.value != "") && (f1.PedCP.value != "") && (f1.Pedpoblacion.value != "") && (f1.Pedprovincia.value != "") && ValidarEmail("Pedemail") && (f1.Pedphone.value != "") &&  (f1.CP.value.length >= 5)
		document.f1.B2.disabled = false; 
	} 
    else 
	{ 
		document.f1.B2.disabled = true; 
	}
}
function deshabilitaB3(form)
{
    if ((ValidacionFPago()) )
    { // && ValidarEmail("email") && (f1.PedName.value != "") && (f1.PedTAddress.value != "") && (f1.PedAddress.value != "") && (f1.PedCP.value != "") && (f1.Pedpoblacion.value != "") && (f1.Pedprovincia.value != "") && ValidarEmail("Pedemail") && (f1.Pedphone.value != "") &&  (f1.CP.value.length >= 5)
		document.f1.B3.disabled = false; 
	} 
    else 
	{ 
		document.f1.B3.disabled = true; 
	}
}
function ValidarEmail(field)
{
var retVal = true;
var email = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
if (!email.test(document.getElementById(field).value) ) 
{
retVal = false
}
return retVal; 
}