
  <!--
  var pagActual = 'id0';
  
  function SeleccionaPais(home){  		
		//window.location.href = "CMRCORPFFLogin.jsp?PAGINA=CMRLogOn&PAIS="+home.value;
		if(home.value == "CL"){
			window.location.href = "https://www.cmrfalabella.com/b2cfapr/CMRCORP/logica/jsp/CMRCORPFFLogin.jsp?PAGINA=CMRLogOn&PAIS=CL";
		}
		if(home.value == "AR"){
			window.location.href = "https://www.cmrfalabella.com/b2carpr/CMRCORP/logica/jsp/CMRCORPFFLogin.jsp?PAGINA=CMRLogOn&PAIS=AR";
		}
		if(home.value == "PE"){
			window.location.href = "http://www.cmrfalabella.com/b2cpepr/CMRCORP/logica/jsp/CMRCORPFFLogin.jsp?PAGINA=CMRLogOn&PAIS=PE";
		}
		if(home.value == "CO"){
			window.location.href = "http://www.cmrfalabella.com/b2cfapr/CMRCORP/logica/jsp/CMRCORPFFLogin.jsp?PAGINA=CMRLogOn&PAIS=CO";
		}		
    }
    
    function SeleccionaFecha(fech){
		window.location.href = "CMRCORPAFEstadoCuentaAction.do?MESES="+fech.value;
    }

   function cambiar(item) {
   obj1 = document.getElementById(pagActual);
   obj1.style.display="none";
   pagActual = item;
   obj=document.getElementById(item);
   visible=(obj.style.display!="none")
   if (visible) {
     obj.style.display="none";
   } else {
      obj.style.display="block";
   }
}
//-->


function Validar(form)
        {
          pin= new String(form.PINSEGFORM.value);
          nuevopin=new String(form.PINCAMBIO.value);
          pinant=pin;
          pinnue=nuevopin;
          pincon=form.PINSEGVALIDA.value;

         if((trim(pin)=="")||(!EsNumero(pin)))
             {
              alert("Debe ingresar la clave. Recuerde que son válidos únicamente dígitos.");
              form.PINSEGFORM.value="";
             }
          else if((trim(nuevopin)=="")||(!EsNumero(nuevopin)) )
             {
              alert("Debe ingresar la nueva clave. Recuerde que son válidos únicamente dígitos.");
              form.PINCAMBIO.value="";
             }
         else if(form.PINSEGVALIDA.value!=form.PINCAMBIO.value)
             { alert("La clave de confirmación es diferente a la nueva.");
             }
			 else{
			  form.PINSEGFORM.value=trim(form.PINSEGFORM.value);
			  form.PINCAMBIO.value=trim(form.PINCAMBIO.value);
			  form.submit();
				}
      }

		function EsNumero(s)
		{   var i;
			if ((s=="")|| (s == " ") || (s == "  ")) return false;
			for (i = 0; i < s.length; i++)
			{
				var c = s.charAt(i);
				if (! (isDigit(c) ) )
				return false;
			}
			return true;
		}
		function trim(cadena){ var cadenaE="";
			   for (i=0;i<cadena.length;i++){letra=cadena.substring(i,i+1);if (letra!=' '){ cadenaE=cadenaE + letra; } }
			   return(cadenaE);
		}
		function isDigit(c){return ((c >= "0") && (c <= "9"));}


function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return 0;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

menus_array = new Array ('ddTarjeta', 'ddUsos', 'ddPagoServ', 'ddAvance', 'ddSuperAvance', 'ddAutomotriz', 'ddPremium', 'ddBeneficios', 'ddEventos', 'ddViveCMR', 'ddPuntos', 'ddServicios','ddServicio');
menus_status_array = new Array ();

function showHideSwitch (theid) {
  if (document.getElementById) {
    var switch_id = document.getElementById(theid);
    var imgid = theid+'Button';
    var button_id = document.getElementById(imgid);
    if (menus_status_array[theid] != 'show') {
      switch_id.className = 'showSwitch';
	  menus_status_array[theid] = 'show';
	  document.cookie = theid+'=show';
    }else{
      switch_id.className = 'hideSwitch';
	  menus_status_array[theid] = 'hide';
	  document.cookie = theid+'=hide';
    }
  }
}
function resetMenu () {
  if (document.getElementById) {
    for (var i=0; i<menus_array.length; i++) {
      var idname = menus_array[i];
      var switch_id = document.getElementById(idname);
      var imgid = idname+'Button';
      var button_id = document.getElementById(imgid);
      if (getCookie(idname) == 'show') {
        switch_id.className = 'showSwitch';
	    menus_status_array [idname] = 'show';
	  }else{
        switch_id.className = 'hideSwitch';
	    menus_status_array [idname] = 'hide';
	  }
    }
  }
}
/*
            var ns4 = (document.layers)? true:false
            var ie4 = (document.all)? true:false
            var teclaCodigo          
 

            document.onkeydown = TeclaPulsada          
            if (ns4)  document.captureEvents(Event.KEYDOWN)   
 

            function TeclaPulsada (tecla)
            {
                        if (ns4) teclaCodigo = tecla.which
                        if (ie4) teclaCodigo = event.keyCode
                        if (teclaCodigo ==17)  { document.onkeydown = inhabilitar
                        return
                        }
                        
            }

            function inhabilitar(){ 

                        return false 
            }  
            document.oncontextmenu=inhabilitar
    */        
            
            
            

function validaAfilitialeAhora(obj){

       if (document.solicitud.A01_Nombres.value == ""){ 
        alert ("Ingrese sus Nombres");
				document.solicitud.A01_Nombres.focus(); 
        return 0;
      }
      if (document.solicitud.A02_Apellido_paterno.value == ""){ 
        alert ("Ingrese su Apellido Paterno");
				document.solicitud.A02_Apellido_paterno.focus(); return 0;
      }
      if (document.solicitud.A03_Apellido_materno.value == ""){ 
        alert ("Ingrese su Apellido Materno");
				document.solicitud.A03_Apellido_materno.focus(); return 0;
      }
      if (document.solicitud.A05_N°_de_documento.value == ""){ 
        alert ("Ingrese su Nro. de Documento");
				document.solicitud.A05_N°_de_documento.focus(); return 0;
      }    
      if (document.solicitud.A04_Tipo_de_documento.value == "DNI"){ 
          if ( document.solicitud.A05_N°_de_documento.value.length < 8 || document.solicitud.A05_N°_de_documento.value.length > 8){ 
              alert ("El nro de DNI debe de tener solo 8 digitos");
              document.solicitud.A05_N°_de_documento.focus(); 
              return 0;
            }
      }   
      if (document.solicitud.A06_Fecha_de_Nacimiento.value == ""){ 
        alert ("Ingrese su Fecha de Nacimiento");
				document.solicitud.A06_Fecha_de_Nacimiento.focus(); return 0;
      }       
      if (document.solicitud.A07_Nivel_Educacional.value == ""){ 
        alert ("Seleccione su Nivel Educacional");
				document.solicitud.A07_Nivel_Educacional.focus(); return 0;
      }       
      if (document.solicitud.A08_Direccion.value == ""){ 
        alert ("Ingrese su Dirección");
				document.solicitud.A08_Direccion.focus(); return 0;
      }      
      if (document.solicitud.A09_Departamento.value == "--SELECCIONE--"){ 
        alert ("Seleccione su Departamento");
				document.solicitud.A09_Departamento.focus(); return 0;
      }       
         if (document.solicitud.A10_Provincia.value == ""){ 
        alert ("Seleccione su Provincia");
				document.solicitud.A10_Provincia.focus(); return 0;
      } 
      if (document.solicitud.A11_Distrito.value == ""){ 
        alert ("Seleccione su Distrito");
				document.solicitud.A11_Distrito.focus(); return 0;
      }   
      if (document.solicitud.A12_Tipo_de_Vivienda.value == ""){ 
        alert ("Seleccione su Tipo de Vivienda");
				document.solicitud.A12_Tipo_de_Vivienda.focus(); return 0;
      }       
      if (document.solicitud.A13_Tipo_de_Actividad.value == ""){ 
        alert ("Seleccione su Tipo de Actividad");
				document.solicitud.A13_Tipo_de_Actividad.focus(); return 0;
      } 
      
              if (document.solicitud.A14_RUC.value != ""){
                 if (document.solicitud.A14_RUC.value.length == 11){ 
                     if (!valruc(document.solicitud.A14_RUC.value)){
                        alert('Nro. de Ruc Incorrecto')
                        document.solicitud.A14_RUC.focus(); return 0;   
                     }
                 }else{
                     alert('Nro. de Ruc Incorrecto')
                     document.solicitud.A14_RUC.focus(); return 0;
                 }
              }
              
       if (document.solicitud.A15_Empresa.value == ""){ 
        alert ("Ingrese el Nombre de la Empresa");
				document.solicitud.A15_Empresa.focus(); return 0;
      } 

              if (document.solicitud.A16_RUC.value != ""){
                 if (document.solicitud.A16_RUC.value.length == 11){ 
                     if (!valruc(document.solicitud.A16_RUC.value)){
                        alert('Nro. de Ruc Incorrecto')
                        document.solicitud.A16_RUC.focus(); return 0;   
                     }
                 }else{
                     alert('Nro. de Ruc Incorrecto')
                     document.solicitud.A16_RUC.focus(); return 0;
                 }
              } 

      if (document.solicitud.A17_Direccion_Empresa.value == ""){ 
        alert ("Ingrese su Dirección");
				document.solicitud.A17_Direccion_Empresa.focus(); return 0;
      } 
      if (document.solicitud.A18_Departamento.value == "--SELECCIONE--"){ 
        alert ("Seleccione su Departamento");
				document.solicitud.A18_Departamento.focus(); return 0;
      }       
         if (document.solicitud.A19_Provincia.value == ""){ 
        alert ("Seleccione su Provincia");
				document.solicitud.A19_Provincia.focus(); return 0;
      } 
      if (document.solicitud.A20_Distrito.value == ""){ 
        alert ("Seleccione su Distrito");
				document.solicitud.A20_Distrito.focus(); return 0;
      }        
      if (document.solicitud.A21_Cargo.value == ""){ 
        alert ("Ingrese su Cargo");
				document.solicitud.A21_Cargo.focus(); return 0;
      } 
      if (document.solicitud.A22_Ingreso_neto.value == ""){ 
        alert ("Ingrese su Ingreso Neto");
				document.solicitud.A22_Ingreso_neto.focus(); return 0;
      }   
    
         if (document.solicitud.A23_Telefono_casa.value == ""){ 
        alert ("Ingrese el Teléfono de su Casa");
				document.solicitud.A23_Telefono_casa.focus(); return 0;
      }          
      if (document.solicitud.A24_Telefono_trabajo.value == ""){ 
        alert ("Ingrese el Teléfono de Trabajo");
				document.solicitud.A24_Telefono_trabajo.focus(); return 0;
      }          
      if (document.solicitud.A25_Telefono_Celular.value == ""){ 
        alert ("Ingrese el Teléfono Celular");
				document.solicitud.A25_Telefono_Celular.focus(); return 0;
      }   
      if (document.solicitud.A26_Email.value == ""){ 
        alert ("Ingrese su email");
				document.solicitud.A26_Email.focus(); return 0;
      }
      
      document.solicitud.submit();
	}




 function validaActualizaDatos(){
      if (document.solicitud.A01_Nombres.value == ""){ 
        alert ("Ingrese su Nombre");
				document.solicitud.A01_Nombres.focus(); return 0;
      }
      if (document.solicitud.A02_Apellido_paterno.value == ""){ 
        alert ("Ingrese su Apellido Paterno");
				document.solicitud.A02_Apellido_paterno.focus(); return 0;
      }
      if (document.solicitud.A03_Apellido_materno.value == ""){ 
        alert ("Ingrese su Apellido Materno");
				document.solicitud.A03_Apellido_materno.focus(); return 0;
      }
      if (document.solicitud.A05_Nro_de_documento.value == ""){ 
        alert ("Ingrese su Nro. de Documento");
				document.solicitud.A05_Nro_de_documento.focus(); return 0;
      }
      if (document.solicitud.A21_RUC.value == ''){
          document.solicitud.A21_RUC.value=''
     }else{    
          if (document.solicitud.A21_RUC.value.length < 11){ 
            alert ("El número de RUC debe de tener 11 digitos");
            document.solicitud.A21_RUC.focus(); 
            return;
          }
      }
      if (document.solicitud.A24_RUC_de_la_empresa.value == ''){
          document.solicitud.A24_RUC_de_la_empresa.value=''
     }else{    
          if (document.solicitud.A24_RUC_de_la_empresa.value.length < 11){ 
            alert ("El número de RUC debe de tener 11 digitos");
            document.solicitud.A24_RUC_de_la_empresa.focus(); 
            return;
          }
      }
      document.solicitud.submit();
	}

function EsNumero(s){   
	var i;
	if ((s=="")|| (s == " ") || (s == "  ")) return false;
		for (i = 0; i < s.length; i++){
			var c = s.charAt(i);
			if (! (isDigit(c) ) && c != "-")
				return false;
		}
	return true;
}


function validaReclamos(form){
	if(form.A01_Nombres_y_apellidos.value == ''){
		alert('Ingrese su Nombre');
		form.A01_Nombres_y_apellidos.focus();
		return false;
	}
	form.submit()
}

/* ini validar fechas */

function keyFormatoFecha(ob)
/*
Autor		: Claudio Zarate 07/03/2001
Descripcion	: provee una mascara en linea a los textos tipo Fecha
*/

{
	var x=window.event.keyCode;
   
	keyValidaFecha();  //-- valida que solo ingresen numeros o '/'
   
	if (x==13)    //-- si es enter no hace nada
	{
		window.event.keyCode = 0;
		window.event.returnValue=false;
		return;
	}
   
   
	var fecha, tecla ;
   
	if (x != 8 && x != 47)
   {  
         if(ob.value.length==0)
         {			
            tecla=String.fromCharCode(window.event.keyCode);         
            
            if(tecla <= "3")
               ob.value= tecla ;
            
            window.event.returnValue=0;

            return ;
         }
      
         if(ob.value.length==1)
         {
            fecha=ob.value;
            tecla=String.fromCharCode(window.event.keyCode);

            if(eval(fecha) < 3)
               ob.value=fecha + tecla + "/" ;

            if(eval(fecha) == 3)
            {  if(tecla <= "1")
                  ob.value=fecha + tecla + "/" ;
            }
            
            window.event.returnValue=0;
            return ;
         }

         if(ob.value.length==3)
         {
            fecha=ob.value;
            tecla=String.fromCharCode(window.event.keyCode);         

            if(tecla <= "1")
               ob.value=fecha + tecla ;
            
            window.event.returnValue=0;
            return ;
         }
      
         if(ob.value.length==4)
         {
            fecha=ob.value.substr(3,4);            
            tecla=String.fromCharCode(window.event.keyCode);         

            if(eval(fecha) == 0)
               ob.value=ob.value + tecla + "/" ;
         
            if(eval(fecha) == 1)
            {  if(tecla <= "2")
                  ob.value=ob.value + tecla + "/" ;
            }         

            window.event.returnValue=0;
            return ;
         }

         if(ob.value.length == 6)
         {            
            tecla=String.fromCharCode(window.event.keyCode);         
            if(tecla == "1" || tecla == "2")
               ob.value=ob.value + tecla ;

            window.event.returnValue=0;
            return ;
         }
         
	}


	if (x==47)
   {
		if(ob.value.length<2)
      {
			window.event.keyCode = 0;
			window.event.returnValue=false;
         return ;
		}
      
		if(ob.value.length>2 && ob.value.length<5)
      {
			window.event.returnValue=0;
         return ;
		}
      
		if(ob.value.length>5)
      {
			window.event.returnValue=0;
         return ;
		}
	}
   
}


function keyValidaFecha()
{
/*
Descripcion	:	Valida en linea el ingreso de caracteres en campos tipo fecha.
*/

if(window.event.keyCode!=13)
{
	var Tecla;
	Tecla = String.fromCharCode(window.event.keyCode);
	if ( !((Tecla>="0"&&Tecla<="9")||(Tecla=="/")) )
		{
		window.event.keyCode = 0;
		}
	}	
}


function isValidDate(dateStr) { 
        if (dateStr.value==""){
                return true; 
        }
        var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/; // requires 4 digit year 

        var matchArray = dateStr.value.match(datePat); // is the format ok? 
        if (matchArray == null) { 
        alert(dateStr.value + " No es una fecha valida. Intentelo nuevamente.") 
        return false; 
        } 
        a = dateStr.value.split("/") 
                var day = a[0]; 
                var month = a[1]; 
                var year = a[2]; 

        if (month < 1 || month > 12) { // check month range 
        alert("El mes debe ser entre 1 y 12."); 
        return false; 
        } 
        if (day < 1 || day > 31) { 
        alert("Los días deben ser entre 1 y 31"); 
        return false; 
        } 
        if ((month==4 || month==6 || month==9 || month==11) && day==31) { 
       alert(""+month+" no tiene 31 días") 
        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 " + year + " no tiene " + day + " días"); 
                return false; 
                   } 
        } 
        return true; 
	} 

/* fin validar fechas*/

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0

  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];  
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function validaConsulta(form){
	if(form.A01_Nombres_y_apellidos.value == ''){
		alert('Ingrese su Nombre');
		form.A01_Nombres_y_apellidos.focus();
		return false;
	}
	if(form.A02_Telefono.value == ''){
		alert('Ingrese su Teléfono');
		form.A02_Telefono.focus();
		return false;
	}
	if(form.A03_email.value == ''){
		alert('Ingrese su Email');
		form.A03_email.focus();
		return false;
	}
	if(!verificaMail(form.A03_email)){
		form.A03_email.focus();
		return false;
	}
	
	if(form.A04_Consulta.value == ''){
		alert('Ingrese su consulta');
		form.A04_Consulta.focus();
		return false;
	}
	form.submit()
}


function verificaMail(mail){
	var cont = 0;
	    if(mail.value == ""){
		alert("El Campo e-mail es un campo obligatorio");
		mail.focus();
		return false;
	    }
	    for (i = 0; i < mail.value.length; i++){
		var c = mail.value.charAt(i);
		if (c == '@'){
		   cont = cont + 1;
		} 
	    }
	    if (cont != '1'){
		    alert("Ingrese una direccion de correo válida");
		    mail.focus();
		    return false;    	
	    }else{
		var s = mail.value;
		var filter=/^[A-Za-z][A-Za-z0-9_].*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
		if (s.length == 0 ){ 
		return false;
		}
		if (filter.test(s)){
		    return true;
		}
		else{
		    alert("Ingrese una direccion de correo válida");
		    mail.focus();
		    return false;
		}
	    }
	}
	
	function validatext(entrada,tipo) { 
	      tecla = (document.all) ? entrada.keyCode : entrada.which; 
	      if (tecla==8) return true;  //Tecla de retroceso (para poder borrar)                
	              switch (tipo)
	     {
	      case '1':   patron =/[A-Za-z ,]/; break// Solo acepta letras 
	      case '2':   patron = /\d/; break //Solo acepta números 
	      case '3':   patron = /\w/; break //Acepta números y letras 
	      case '4':   patron = /\D/; break//No acepta números 
	      case '5':   patron = /[\d]/;  break //Solo acepta números 
	      case '6':   patron = /[\dKk]/;  break //Solo acepta números y K
	      case '7':   patron = /[\dKk-]/;  break //Solo acepta números, K y guion
	     }
	      aux = String.fromCharCode(tecla); 
	    return patron.test(aux); 
	}
  
  
  
  
  