function inicio(){
//	f = capa.scrollHeight;
	f= $("capa").scrollHeight;// = f;
//		alert(f);
//	alert(f);
//alert(parent.document.getElementById("frame1").height);
	parent.document.getElementById("frame1").height= f;

	//alert('hola'+f);
	//alert(parent.document.getElementById("frame1").height);
	
	//capa.style.height = f;
}

//function inicio2(){
//f = contenido.scrollHeight;

//f =parent.getElementById("capa").height

//alert(f);
//parent.getElementById("capa").height = f;
//parent.central.style.height = f;
//}

function clearEmailBoletin() {
	foo = $('inscribirEmail');	
	
	if(foo.value == "ingrese aquí su email")
		foo.value = "";
}
function checkEmailClear() {
	foo = $('inscribirEmail');	

	if(foo.value.substring(0,1) == " " || foo.value == "")
		foo.value = "ingrese aquí su email";
}

function makeDisable()
	{
    var x=document.getElementById("done")
    x.disabled=true
}
function makeEnable(){
	
    var x=document.getElementById("done")
    x.disabled=false
}

function makeDisableText(valor)
	{
	 if(valor==0)
	 	{
	    	var x=document.getElementById("AMOUNT1")
    		x.disabled=false
		}
	else 
		{
		 var x=document.getElementById("AMOUNT1")
		 x.disabled=true
		}
			
	}

function validar() {
  var i, s, s_value, numargs = validar.arguments.length;
  var forma = document.forms[validar.arguments[0]];
  for (i = 1; i < numargs; i++) {
    s_value = forma.elements[validar.arguments[i]].value;
    s = s_value.replace(/(^\s+)|(\s+$)/g, '');
    if (s=='') {
      alert('Campo es obligatorio');
      forma.elements[validar.arguments[i]].focus();
      return false;
    }
  }
  return true;
}


function ValidarDatos(Valor) { 
 for (var i=0; i<Valor.length; i++) 
 	{ 
	   if ((" \t\n\r").indexOf(Valor.charAt(i))==-1) 
		return true;
		valor.focus();
	   } 
	 return false; 
}


 function validarEmail(valor) {
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor.value)){
   return (true)
  } else {
	
   alert("La direccion de email es incorrecta.");
   valor.focus();
   return false;
  }
 }

 function validarEmailEn(valor) {
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor.value)){
   return (true)
  } else {
   alert("The Email is not correct");
   valor.focus();
   return (false);
  }
 }



 function navegar_list1(destino,requiere_registros,multiples_registros,confirmar)
{	
	var cont_seleccionar = 0;
	var i = 0;
	var ir_sig_pagina = true;
	len = document.form1.elements.length;
	for(i=0; i<len ; i++) {
		if (document.form1.elements[i].name == 'seleccionar') {
			if (document.form1.elements[i].checked == true) {
				cont_seleccionar++;
			}
		}
	}
	if ((requiere_registros==1)&&(cont_seleccionar==0)) {
		alert("You need select user");
		ir_sig_pagina = false;

	}
	if ((multiples_registros==0)&&(cont_seleccionar>1)) {
		alert("You can't select multiple items for this action");
		ir_sig_pagina = false;

	}
	if (ir_sig_pagina) {
		if ((confirmar!=1)  || (confirm("Are you sure?"))) {
		document.form1.action = destino;
		document.form1.submit();	
		}
	}
}
 
 function navegar_list2(destino,requiere_registros,multiples_registros,confirmar)
{	
	var cont_seleccionar = 0;
	var i = 0;
	var ir_sig_pagina = true;
	len = document.form2.elements.length;
	for(i=0; i<len ; i++) {
		if (document.form2.elements[i].name == 'seleccionar') {
			if (document.form2.elements[i].checked == true) {
				cont_seleccionar++;
			}
		}
	}
	if ((requiere_registros==1)&&(cont_seleccionar==0)) {
		alert("You need select user");
		ir_sig_pagina = false;

	}
	if ((multiples_registros==0)&&(cont_seleccionar>1)) {
		alert("You can't select multiple items for this action");
		ir_sig_pagina = false;

	}
	if (ir_sig_pagina) {
		if ((confirmar!=1)  || (confirm("Are you sure?"))) {
		document.form2.action = destino;
		document.form2.submit();	
		}
	}
}

function navegar_list1(destino,requiere_registros,multiples_registros,confirmar)
{	
	var cont_seleccionar = 0;
	var i = 0;
	var ir_sig_pagina = true;
	len = document.form01.elements.length;
	for(i=0; i<len ; i++) {
		if (document.form01.elements[i].name == 'seleccionar') {
			if (document.form01.elements[i].checked == true) {
				cont_seleccionar++;
			}
		}
	}
	if ((requiere_registros==1)&&(cont_seleccionar==0)) {
		alert("You need select user");
		ir_sig_pagina = false;

	}
	if ((multiples_registros==0)&&(cont_seleccionar>1)) {
		alert("You can't select multiple items for this action");
		ir_sig_pagina = false;

	}
	if (ir_sig_pagina) {
		if ((confirmar!=1)  || (confirm("Are you sure?"))) {
		document.form01.action = destino;
		document.form01.submit();	
		}
	}
}


function openWindows(pagina) {
var opciones="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, width=508, height=365, top=85, left=140";
window.open(pagina,"",opciones);
}

function ValidarNombre(Valor) { 
 for (var i=0; i<Valor.value.length; i++) 
 	{ 
	   if ((" \t\n\r").indexOf(Valor.value.charAt(i))==-1) 
		return true;
	   } 
	    alert("El campo " + Valor.id + " no puede ser vacio");
		Valor.focus();
	 return false; 
}


function ValidarName(Valor) { 
 for (var i=0; i<Valor.value.length; i++) 
 	{ 
	   if ((" \t\n\r").indexOf(Valor.value.charAt(i))==-1) 
		return true;
	   } 
	    alert("The field " + Valor.id + " cannot be empty");
		Valor.focus();
	 return false; 
}


function Concatenate()
{
	
 document.getElementById("EXPDATE").value= document.getElementById("done").options[document.getElementById("done").selectedIndex].value + document.getElementById("EXPYEAR").options[document.getElementById("EXPYEAR").selectedIndex].value;
// alert( document.donationStep.EXPDATE.value);
 return true;
}

function validateStep1()
{
	var comboBox;
	var textBox;	
	comboBox=document.donacionPaso1.AMOUNT.options[document.donacionPaso1.AMOUNT.selectedIndex].value
	//document.donacionPaso1.AMOUNT.value;
    textBox=document.donacionPaso1.AMOUNT1.value;
		 
	 if (comboBox == 0 && textBox =='') 
	 {
		 alert("Seleccione o escriba el Monto a Donar");
		 document.forms.donacionPaso1.AMOUNT.focus();
			 return false;			 
	 }
	 return true;	
}

function validateStep1EN()
{
	var comboBox;
	var textBox;	
	comboBox=document.donacionPaso1.AMOUNT.options[document.donacionPaso1.AMOUNT.selectedIndex].value
	//document.donacionPaso1.AMOUNT.value;
    textBox=document.donacionPaso1.AMOUNT1.value;
		 
	 if (comboBox == 0 && textBox =='') 
	 {
		 alert("select or write the donation amount");
		 document.forms.donacionPaso1.AMOUNT.focus();
			 return false;			 
	 }
	 return true;	
}

function navegar_list3(destino,requiere_registros,multiples_registros,confirmar)
{	
	var cont_seleccionar = 0;
	var i = 0;
	var ir_sig_pagina = true;
	len = document.form3.elements.length;
	for(i=0; i<len ; i++) {
		if (document.form3.elements[i].name == 'seleccionar') {
			if (document.form3.elements[i].checked == true) {
				cont_seleccionar++;
			}
		}
	}
	if ((requiere_registros==1)&&(cont_seleccionar==0)) {
		alert("You need select user");
		ir_sig_pagina = false;

	}
	if ((multiples_registros==0)&&(cont_seleccionar>1)) {
		alert("You can't select multiple items for this action");
		ir_sig_pagina = false;

	}
	if (ir_sig_pagina) {
		if ((confirmar!=1)  || (confirm("Are you sure?"))) {
		document.form3.action = destino;
		document.form3.submit();	
		}
	}
}

function navegar_list04(destino,requiere_registros,multiples_registros,confirmar)
{	
	var cont_seleccionar = 0;
	var i = 0;
	var ir_sig_pagina = true;
	len = document.form04.elements.length;
	for(i=0; i<len ; i++) {
		if (document.form04.elements[i].name == 'seleccionar') {
			if (document.form04.elements[i].checked == true) {
				cont_seleccionar++;
			}
		}
	}
	if ((requiere_registros==1)&&(cont_seleccionar==0)) {
		alert("You need select user");
		ir_sig_pagina = false;

	}
	if ((multiples_registros==0)&&(cont_seleccionar>1)) {
		alert("You can't select multiple items for this action");
		ir_sig_pagina = false;

	}
	if (ir_sig_pagina) {
		if ((confirmar!=1)  || (confirm("Are you sure?"))) {
		document.form04.action = destino;
		document.form04.submit();	
		}
	}
}


function validateCrediCard(ccNumb) {  
//alert(ccNumb);
var valid = "0123456789"  
var len = ccNumb.length;  
var iCCN = parseInt(ccNumb); 
var sCCN = ccNumb.toString();
sCCN = sCCN.replace (/^\s+|\s+$/g,'');  
var iTotal = 0;  
var bNum = true; 
var bResult = false; 
var temp;  
var calc;  


for (var j=0; j<len; j++) {
  temp = "" + sCCN.substring(j, j+1);
  if (valid.indexOf(temp) == "-1"){bNum = false;}
}


if(!bNum){
	bResult = false;
}


if((len == 0)&&(bResult)){ 
  bResult = false;
} else{  
  if(len >= 15){ 
    for(var i=len;i>0;i--){ 
      calc = parseInt(iCCN) % 10; 
      calc = parseInt(calc); 
      iTotal += calc; 
      i--; 
      iCCN = iCCN / 10; 
      calc = parseInt(iCCN) % 10 ;
      calc = calc *2;            
     
      switch(calc){
        case 10: calc = 1; break;
        case 12: calc = 3; break;
        case 14: calc = 5; break;
        case 16: calc = 7; break;
        case 18: calc = 9; break;
        default: calc = calc; 
      }                                               
    iCCN = iCCN / 10; 
    iTotal += calc;  
  }  // END OF LOOP
  if ((iTotal%10)==0){  
    bResult = true;  
  } else {
    bResult = false; 
    }
  }
}

if(bResult) {
 return true;
}
if(!bResult){
	alert("La tarjeta de credito es incorrecta");
	document.donationStep.CARDNUM.focus();
	
}

}

 function navegar_list(destino,requiere_registros,multiples_registros,confirmar)
{	
	var cont_seleccionar = 0;
	var i = 0;
	var ir_sig_pagina = true;
	len = document.sponsor_child.elements.length;
	for(i=0; i<len ; i++) {
		if (document.sponsor_child.elements[i].name == 'seleccionar') {
			if (document.sponsor_child.elements[i].checked == true) {
				cont_seleccionar++;
			}
		}
	}
	if ((requiere_registros==1)&&(cont_seleccionar==0)) {
		alert("You need select user");
		ir_sig_pagina = false;

	}
	if ((multiples_registros==0)&&(cont_seleccionar>1)) {
		alert("You can't select multiple items for this action");
		ir_sig_pagina = false;

	}
	if (ir_sig_pagina) {
		if ((confirmar!=1)  || (confirm("Are you sure?"))) {
		document.sponsor_child.action = destino;
		document.sponsor_child.submit();	
		}
	}
}

function numerico(valor)
{ 
var cad;
	cad = valor.toString(); 
for (var i=0; i<cad.length; i++) 
{ 
 var caracter = cad.charAt(i);
  if (caracter<"0" || caracter>"9") 
   alert("entre");
   return false;
}
alert("no");
return true; 

}


function validarEnteroTelefono(valor)
{ 
	var temp =document.getElementById("telefono").value;
    var valor = parseInt(temp); 
      //Compruebo si es un valor numérico 
      if (isNaN(valor)) 
	  { 
         //entonces (no es numero) devuelvo el valor cadena vacia 
		alert('En campo Telefono es un numero');
		document.getElementById("telefono").focus();
      return ""
      }else{ 
         //En caso contrario (Si era un número) devuelvo el valor 
          return true; 
      } 
} 

function validarEnteroPHONE(valor)
{ 
	var temp =document.getElementById("Phone").value;
    var valor = parseInt(temp); 
      //Compruebo si es un valor numérico 
      if (isNaN(valor)) 
	  { 
         //entonces (no es numero) devuelvo el valor cadena vacia 
		alert('The field Phone is a number');
		document.getElementById("Phone").focus();
      return ""
      }else{ 
         //En caso contrario (Si era un número) devuelvo el valor 
          return true; 
      } 
} 



function validarEnteroZip(valor)
{ 
	var temp = document.getElementById("Zip").value;
    var valor = parseInt(temp); 
      //Compruebo si es un valor numérico 
      if (isNaN(valor)) 
	  { 
         //entonces (no es numero) devuelvo el valor cadena vacia 
		alert('El campo zip es un número');
		document.getElementById("Zip").focus();
      return ""
      }else{ 
         //En caso contrario (Si era un número) devuelvo el valor 
          return true; 
      } 
} 


function validarEnteroZipCode(valor)
{ 	var temp=document.getElementById("Zip").value;
    var valor = parseInt(temp); 
      //Compruebo si es un valor numérico 
      if (isNaN(valor)) 
	  { 
         //entonces (no es numero) devuelvo el valor cadena vacia 
		alert('The field Zip is a number');
		document.getElementById("Zip").focus();
      return ""
      }else{ 
         //En caso contrario (Si era un número) devuelvo el valor 
          return true; 
      } 
} 


function validarEnteroTarjetaCredito(valor)
{ 
	var temp =document.getElementById("Tarjeta de credito").value;
    var valor = parseInt(temp); 
      //Compruebo si es un valor numérico 
      if (isNaN(valor)) 
	  { 
         //entonces (no es numero) devuelvo el valor cadena vacia 
		alert('El campo Número de Tarjeta debe ser númerico');
		document.getElementById("Tarjeta de credito").focus();
      return ""
      }else{ 
         //En caso contrario (Si era un número) devuelvo el valor 
          return true; 
      } 
} 


function validarEnteroCrediCard(valor)
{ 
	var temp = document.getElementById("Card Number").value;
    var valor = parseInt(temp); 
      //Compruebo si es un valor numérico 
      if (isNaN(valor)) 
	  { 
         //entonces (no es numero) devuelvo el valor cadena vacia 
		alert('The field Card Number is a number');
		document.getElementById("Card Number").focus();
      return ""
      }else{ 
         //En caso contrario (Si era un número) devuelvo el valor 
          return true; 
      } 
} 


function validarEnteromonto(valor)



 { 
	var temp = document.getElementById("AMOUNT1").value;
    var valor = parseInt(temp); 
      //Compruebo si es un valor numérico 
      if (isNaN(valor) && temp!='') 
	  { 
         //entonces (no es numero) devuelvo el valor cadena vacia 
		alert('El campo monto debe ser númerico');
		document.getElementById("AMOUNT1").focus();
      return ""
      }else{ 
         //En caso contrario (Si era un número) devuelvo el valor 
          return true; 
      } 
} 








function validarEnteroamount(valor)
{ 
	var temp = document.getElementById("AMOUNT1").value;
    var valor = parseInt(temp); 
      //Compruebo si es un valor numérico 
      if (isNaN(valor) && temp!='') 
	  { 
         //entonces (no es numero) devuelvo el valor cadena vacia 
		alert('The field Amount is a number');
		document.getElementById("AMOUNT1").focus();
      return ""
      }else{ 
         //En caso contrario (Si era un número) devuelvo el valor 
          return true; 
      } 
} 













function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length; i++) 
      { 
      Char = sText.charAt(i) ; 
		if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

function validarEnteroamount(valor)
{ 
	var temp = document.getElementById("AMOUNT1").value;
    var valor = IsNumeric(temp); 
      //Compruebo si es un valor numérico 
      if (!valor ) 
	  { 
         //entonces (no es numero) devuelvo el valor cadena vacia 
		alert('El campo monto debe ser númerico');
		document.getElementById("AMOUNT1").focus();
	 	return false;	  
       }else{ 
         //En caso contrario (Si era un número) devuelvo el valor 
          return true; 
          
      } 
} 

function validarEnteroamountEN(valor)
{ 
	var temp = document.getElementById("AMOUNT1").value;
    var valor = IsNumeric(temp); 
      //Compruebo si es un valor numérico 
      if (!valor ) 
	  { 
         //entonces (no es numero) devuelvo el valor cadena vacia 
		alert('The field Amount is a number');
		document.getElementById("AMOUNT1").focus();
	 	return false;	  
       }else{ 
         //En caso contrario (Si era un número) devuelvo el valor 
          return true; 
          
      } 
} 


