
function volver(){ 

location.href = 'https://www.santander.cl/';

}

function envia(){ 

	
	var trj;
	/*var j;
	var numero;
	trj = document.form.ntarjeta1.value + document.form.ntarjeta2.value + document.form.ntarjeta3.value + document.form.ntarjeta4.value;
	
	alert(trj.length%2);
	
	for(j=1; ; j==trj.length, j++){
		if (j%2 = 0){
		numero = trj()
		}else{
		
		}
	
	}*/
	
	
	var valida=true;
	var found_it;
	for(var i=0; i<document.form.ttarjeta.length;i++){
	if(document.form.ttarjeta[i].checked){
	found_it = document.form.ttarjeta[i].value
	}
	}
	if(found_it !=null){
	}
	else{
	alert('Favor seleccionar una Tarjeta / Please select a Credit Card');
	return false	
	}
		
	if (document.form.ntarjeta.value == ''){
      alert('Debe ingresar el numero de su Tarjeta / No Credit Card Number');
      return false;       
    }
    
    if (valida_tc(document.form.ntarjeta.value)==false){
        alert('Número de Tarjeta no válido / Invalid Credit Card Number');
        document.form.ntarjeta.focus();
        return false;       
     }    
	 
     /*
    if (valida_internacional(document.form.ntarjeta.value,found_it)==true){
	document.getElementById("label_monto").innerHTML='*Monto en Dolares:';
	document.form.monto_dolares.value=document.form.monto.value;
	}
     else    */
     
       if (valida_nacional(document.form.ntarjeta.value,found_it)==true){     
            document.getElementById("label_monto").innerHTML='*Monto en Pesos Chilenos: / Amount (Chilean Pesos)';
	    document.form.monto_dolares.value="";
	 }
       else	 
       if (valida_internacional(document.form.ntarjeta.value,found_it)==true){
	   document.getElementById("label_monto").innerHTML='*Monto en Dólares / Amount (Dollars):';
	   document.form.monto_dolares.value=document.form.monto.value;
	} 	 	 
	else{
		alert('Número de Tarjeta no válido / Invalid Credit Card Number');
        	return false;       
  	}     
     
     /*
       if (valida_nacional(document.form.ntarjeta.value,found_it)==true){     
            document.getElementById("label_monto").innerHTML='*Monto en Pesos:';
	    document.form.monto_dolares.value="";
	 }
	 else{
	document.getElementById("label_monto").innerHTML='*Monto en Dólares:';
	document.form.monto_dolares.value=document.form.monto.value;
	}
    */
    if (document.form.data_mes.value == 0){
      alert('Debe seleccionar el mes de la Fecha de Vencimiento de su Tarjeta / Invalid Expiration Month');
      return false;       
    }
    if (document.form.data_ano.value == 0){
      alert('Debe seleccionar el año de la Fecha de Vencimiento de su Tarjeta / Invalid Expiration Year');
      return false;
    }
    if (document.form.data_mes.value < 3 && document.form.data_ano.value == 2010){
	  alert('Debe seleccionar una Fecha de Vencimiento válida / Invalid Expiration Date');
      return false;
    }
    
    if (document.form.monto.value == ''){
      alert('Debe ingresar el Monto de la Donación / Invalid Amount ');
      return false;       
    }
    if (document.form.monto.value == 0){
      alert('Debe ingresar el Monto de la Donación / Invalid Amount ');
      return false;       
    }    
    if (document.form.monto.value >1000000){
      alert('El Monto de su donación no puede ser superior a un millon de pesos / Amount cannot be greater than 1.000.000.-');
      return false;       
    }
    
	document.form.action="procesa.asp";
	document.form.submit();

}


function valida_tarjeta(){

	var found_it;
	for(var i=0; i<document.form.ttarjeta.length;i++){
	if(document.form.ttarjeta[i].checked){
	found_it = document.form.ttarjeta[i].value
	}
	}
	if(found_it !=null){
	}
	else
	if (document.form.ntarjeta.value!='')
	{
	alert('Favor seleccione un tipo de Tarjeta / Please select a Credit Card');
	return false	
	}
  
        if (document.form.ntarjeta.value!='')
    	if (valida_tc(document.form.ntarjeta.value)==false){
           alert('Número de Tarjeta no válido');
           //document.form.ntarjeta.focus();
           return false;       
        }      
  
       if (valida_nacional(document.form.ntarjeta.value,found_it)==true){     
            document.getElementById("label_monto").innerHTML='*Monto en Pesos Chilenos/ Amount (Chilean Pesos):';
	    document.form.monto_dolares.value="";
	 }
       else	 
       if (valida_internacional(document.form.ntarjeta.value,found_it)==true){
	   document.getElementById("label_monto").innerHTML='*Monto en Dólares / Amount (Dollars):';
	   document.form.monto_dolares.value=document.form.monto.value;
	} 	 	 
	else{
		alert('Número de Tarjeta no válido / Invalid Credit Card Number');
        	return false;       
  	}
  	
}
function imprimir()
{
window.print();
}

var nav4 = window.Event ? true : false;

function acceptNum(evt){
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57	
var key = nav4 ? evt.which : evt.keyCode;
return (key <= 13 || (key >= 48 && key <= 57));
}
