var expreg=/^[6][0-9]{8}/
function esMsisdn(obj){
	if(obj.value!=""){
		if(!obj.value.match(expreg)){
			if (typeof(cargando2) != "undefined") {
					cargando2.visible('On');
					cargando2.display({
						descripcion: "El valor introducido tiene que ser un número de teléfono correcto",
						boton_visible: true,
						gif_visible: true,
						img: 'error'
					});
			} else {
			    alert ("El valor introducido tiene que ser un número");
	    	}
		    obj.focus();
			return false;
		}
	}
	return true;
}
function esNumero(obj){
	if (obj.value != "")
		if(isNaN(obj.value)){
			    if (typeof(cargando2) != "undefined") {
					cargando2.visible('On');
					cargando2.display({
						descripcion: "El valor introducido tiene que ser un número",
						boton_visible: true,
						gif_visible: true,
						img: 'error'
					});
				} else {
				    alert ("El valor introducido tiene que ser un número");
		    }
    	   obj.focus();
			   return false;
		}
  return true;
}

 
// FUNCION BASTANTE BUENA PARA EL FUNCIONAMINETO Y VALIDACION DE LAS FECHAS. MADE BY JUAN CARLOS PEGO
campo_validandose='';

hoy = new Date();
var d = hoy.getDate();
var m = hoy.getMonth() + 1;
var y = hoy.getYear();
if(parseInt(d,10)<10) d = "0"+d;
if(parseInt(m,10)<10) m = "0"+m;
var mihoy = d+'/'+m+'/'+y;

function validar_fecha(input) {

//	alert('actuando validar fecha');
  if (campo_validandose && campo_validandose!=input) return false; 
  campo_validandose=input;
	

	if ((input.value == "h") || (input.value == "H")){input.value = mihoy; campo_validandose=false; input.focus(); return true;}
	
  if (input.value.length==0) { campo_validandose=false; return true; }

	
	var matriz=input.value.split('-');
	var m1 = input.value.split('-');

 	if (matriz.length!=3) matriz=input.value.split('/');
	if (matriz.length!=3) matriz=input.value.split('.');

	
	if (matriz.length!=3 && input.value.length==6) {
		matriz[0]=input.value.substr(0,2);
		matriz[1]=input.value.substr(2,2);
		matriz[2]=input.value.substr(4,2);
	} else if (matriz.length!=3 && input.value.length==8) {
		matriz[0]=input.value.substr(0,2);
		matriz[1]=input.value.substr(2,2);
		matriz[2]=input.value.substr(4,4);
	} else if (matriz.length!=3) {

		var mi_fecha_pinyon = ""; 
		var error1 = 0;
		var error2 = 0;

		var longitud_input = input.value.length;
		if ((longitud_input == 2) || (longitud_input == 1)){
			var valor_input = parseInt(input.value,10);
			if ((valor_input <= 0) || (valor_input >= 32)){

				 if (typeof(cargando2) != "undefined") {
					  cargando2.visible('On');
					  cargando2.display({
						descripcion: 'Día incorrecto',
						boton_visible: true,
						gif_visible: true,
						img: 'error'
					});
				} else {
				   alert ('Día incorrecto');
		    } 
		   
		  }else{
        if(valor_input<10) valor_input = "0"+valor_input;
				if(parseInt(m,10)<10) m = "0"+parseInt(m,10);

				mi_fecha_pinyon = valor_input+'/'+m+'/'+y;
				input.value = mi_fecha_pinyon;
				campo_validandose=false;
				input.focus();
				return true;
			}
		}else if (longitud_input == 4){
			var valor_input = parseInt(input.value,10);
			m1[0]=input.value.substr(0,2);
			m1[1]=input.value.substr(2,2);

			var valor_input1 = parseInt(m1[0],10);
			if ((valor_input1 <= 0) || (valor_input1 >= 32)){

				if (typeof(cargando2) != "undefined") {
					cargando2.visible('On');
					cargando2.display({
						descripcion: 'Día incorrecto',
						boton_visible: true,
						gif_visible: true,
						img: 'error'
					});
				} else {
				alert ('Día incorrecto');
			
			}   	error1 = 1;
			}

			var valor_input2 = parseInt(m1[1],10);
			if ((valor_input2 <= 0) || (valor_input2 >= 13)){
        if (typeof(cargando2) != "undefined") {
					cargando2.visible('On');
					cargando2.display({
						descripcion: ' Mes incorrecto',
						boton_visible: true,
						gif_visible: true,
						img: 'error'
					});
				} else {
				  alert (' Mes incorrecto');
				}
        error2 = 1;
      }
			if ((error1 == 0) && (error2 == 0)){

				if(m1[0]<10) m1[0] = m1[0];
				if(m1[1]<10) m1[1] = m1[1];
				mi_fecha_pinyon = m1[0]+'/'+m1[1]+'/'+y;
				input.value = mi_fecha_pinyon;
				campo_validandose=false;
				input.focus();
				return true;
			}
			
		}else{
			
         if (typeof(cargando2) != "undefined") {
    					cargando2.visible('On');
    					cargando2.display({
    						descripcion: 'Fecha no valida',
    						boton_visible: true,
    						gif_visible: true,
    						img: 'error'
    					});
    				}
    				else {
    					alert('Fecha no valida');
    		}
        input.value='';
  			campo_validandose=false;
  			input.focus();
     		return false;
		}
	}
	var dia=parseInt(matriz[0],10);
	var mes=parseInt(matriz[1],10);
	var ano=parseInt(matriz[2],10);

  if (dia==0)
  {
    
    
    if (typeof(cargando2) != "undefined") {
					cargando2.visible('On');
					cargando2.display({
						descripcion: 'Fecha no valida'+":\n"+'DIA'+"="+dia+"\n"+'MES'+"="+mes+"\n"+'AÑO'+"="+ano,
						boton_visible: true,
						gif_visible: true,
						img: 'error'
					});
				}
				else {
					alert('Fecha no valida'+":\n"+'DIA'+"="+dia+"\n"+'MES'+"="+mes+"\n"+'AÑO'+"="+ano);
		}
      input.value='';
		  campo_validandose=false;
		  input.focus();
		  return false;
  }
	if (ano<100) { if (ano<50) ano+=2000; else ano+=1900; }
	if ((isNaN(dia) || isNaN(mes) || isNaN(ano)) || (dia<0 || dia>31 || mes<0 || mes>12 || ano<1900 || ano>3000) || (dia>longitud_del_mes(mes,ano))) {
		
      if (typeof(cargando2) != "undefined") {
					cargando2.visible('On');
					cargando2.display({
						descripcion: 'Fecha no valida'+":\n"+'DIA'+"="+dia+"\n"+'MES'+"="+mes+"\n"+'ANY'+"="+ano,
						boton_visible: true,
						gif_visible: true,
						img: 'error'
					});
				}
				else {
					alert('Fecha no valida'+":\n"+'DIA'+"="+dia+"\n"+'MES'+"="+mes+"\n"+'ANY'+"="+ano);
		}
    input.value='';
		campo_validandose=false;
		input.focus();
    return false;
	} else {
		if (dia<10) dia="0"+dia;
		if (mes<10) mes="0"+mes;

		input.value=dia+"/"+mes+"/"+ano;
		campo_validandose=false;
	}

	return true;

}
function longitud_del_mes(mes,ano) {
	var longitud_mes=new Array (0,31,28,31,30,31,30,31,31,30,31,30,31);
	if (mes==2 && (ano/4==Math.floor(ano/4) || ano/400==Math.floor(ano/400))) {
		return 29;
	}
	else return longitud_mes[mes];
}

// Funcion que valida que la fecha de inicio sea mayor que la fecha fi y que no disten en mas de max dias, si max es nul no valida por maximo de dias
function validar_rango_de_fechas(ini, fin, max){ 
	//Comprueba que la fecha inicial sea menor a la fecha final
	if (!menor(ini, fin)) 
		return false;
			
	//Comprueba que entre la fecha inicial y la fecha final del rango no haya más de max dias
	if(max != ''){
		fec1 = new Date(varr1[2],varr1[1],varr1[0]);
		fec2 = new Date(varr2[2],varr2[1],varr2[0]);
		if (((fec2 - fec1) / 86400000) > max){
			return false;
		}
	}
	return true;
}
		
	//Función que comprueba si la fec1 es menor o igual a la fec2
	function menor (fec1, fec2){
		varr1 = fec1.split('/');
		dat1=varr1[2]+varr1[1]+varr1[0];
		
		varr2 = fec2.split('/');
		dat2=varr2[2]+varr2[1]+varr2[0];
			
		if (dat1 <= dat2){
			return true;
		}
			
		return false;
}
// FIN VALIDACION DE LAS FECHAS. MADE BY JUAN CARLOS PEGO


// Validacion del digito de control de la cuenta corriente.
function obtenerDigito(valor){
  valores = new Array(1, 2, 4, 8, 5, 10, 9, 7, 3, 6);
  control = 0;
  for (i=0; i<=9; i++)
    control += parseInt(valor.charAt(i)) * valores[i];

  control = 11 - (control % 11);
  if (control == 11) 
		control = 0;

  else if 
		(control == 10) control = 1;

  return control;
}
//Fin validacion de los digitos de control de la cuenta corriente.


// David (12/12/2008)
//
// Funciones para validacion de NIF, NIE, CIF, Pasaporte..
function error_cif(msg) {
	if (typeof(cargando2) != "undefined") {
		cargando2.visible('On');

		cargando2.display({	descripcion:	msg,
							boton_visible:	true,
							gif_visible:	true,
							img: 			'error'});
	} else {
		alert(msg);
	}
}

function cif(obj, pais, tipdoc) {
	// Control inicial:
	if (tipdoc == '') tipdoc = 'NIF';
	if (pais == '') pais = 'ES';
	obj.value = obj.value.replace(' ', '');

	// Validacion de pasaporte (es suficiente con que este informado):
	if (tipdoc == 'PAS') {
		if (obj.value != '') {
			return true;
		} else {
			error_cif('El pasaporte debe estar informado.');
			return false;
		}
	}

	// Validacion de NIE:
	if (tipdoc == 'NIE') {
    	var nie = valida_tamano(obj.value,tipdoc);

		if (nie == '') {
			return false;
		}

		obj.value = nie;
		var par = 0;
		var non = 0;
		var letras = "ABCDEFGHKLMNPQS";
		var let = nie.charAt(0);

		if ((let == 'X') || (let == 'Y') || (let == 'Z')) {
			nie = nie.substring(0, nie.length-1).replace('X', '0') + nie.charAt(nie.length-1);         
			nie = nie.substring(0, nie.length-1).replace('Y', '1') + nie.charAt(nie.length-1); // David (13/01/2009)
            nie = nie.substring(0, nie.length-1).replace('Z', '2') + nie.charAt(nie.length-1); // Isabel(03/04/2009)
			if (!validar(nie, tipdoc)) {
				obj.focus();
				return false;
			} else {
				return true;
			}
		} else {
			error_cif('El NIE debe empezar con la letra X, Y o Z.');
			return false;
		}
	}

	// Validacion NIF/NIE:
	if (pais == 'ES' && obj.value != '') {
		var cif = valida_tamano(obj.value, tipdoc);

		if (cif == '') {
		    return false;
		}

		obj.value = cif;
		var par = 0;
		var non = 0;
		var letras = "ABCDEFGJHKLMNPQRS";
		var let = cif.charAt(0);

		if (!isNaN(let)) {
			nif = cif;

			if (!validar(nif, 'NIF')) {
				return false;				
			}

			return true;
		}

		if (cif.length != 9) {
			error_cif('El CIF debe tener 9 dígitos.');
			return false;
		}

		if (letras.indexOf(let.toUpperCase()) == -1) {
			error_cif('El comienzo del CIF no es válido');
			return false;
		}

		/*for (zz = 2; zz < 8; zz += 2) {
			par = par + parseInt(cif.charAt(zz));
		}

		for (zz = 1; zz < 9; zz += 2) {
			nn = 2 * parseInt(cif.charAt(zz));
			if (nn > 9) nn = 1 + (nn-10);
			non = non + nn;
		}

		parcial = par + non;
		control = (10 - (parcial % 10));

		if (control == 10) control = 0;

		if (control != cif.charAt(8)) {
			error_cif('El CIF no es válido.');
			return false;
		}

		return true; // CIF valido*/

		var temp = 0;
		var v1 = new Array(0,2,4,6,8,1,3,5,7,9);

		for (i = 2; i <= 6; i += 2) {
			temp += v1[parseInt(cif.substr(i-1, 1))];
			temp += parseInt(cif.substr(i, 1));
		}

		temp = temp + v1[parseInt(cif.substr(7,1))];
		temp = (10 - ( temp % 10));

		if (temp == 10 && (cif.charAt(cif.length-1) == 'J' || cif.charAt(cif.length-1) == 0)) {
			return true;
		} else {
			if (cif.charAt(cif.length - 1) == temp || cif.charAt(cif.length - 1) == String.fromCharCode(64 + temp)) {
				return true;
			} else {
				error_cif('El CIF no es válido.');
				return false;
			}
		}
	}
}

function validar(abc, tipo) {
	dni = abc.substring(0, abc.length-1);
	let = abc.charAt(abc.length-1);

	if (!isNaN(let)) {
		error_cif('Falta la letra del ' + tipo);
		return false;
	} else {
		cadena = "TRWAGMYFPDXBNJZSQVHLCKET";
		posicion = dni % 23;
		letra = cadena.substring(posicion,posicion+1);

		if (letra != let.toUpperCase()) {
			if (tipo == '') {
				tipo = 'NIF';
			}

			error_cif('La letra del ' + tipo + ' no es válida.');
			return false;
		}
	}

	return true;
}

function valida_tamano(numdoc, tipdoc) {
	if (numdoc.length == 0 || numdoc.length == 9) {
		return numdoc;   
	}
	
//	if (numdoc.length == 10 && tipdoc == 'NIE') {
//		return numdoc;   
//	}	

	if ((numdoc.length > 9)) {
		error_cif(tipdoc + ' no válido, debe tener 9 dígitos.');
		return '';
	}

	var mascara = '000000000';
	var primer_caracter = '';

	if (tipdoc == 'NIE') {
		primer_caracter = numdoc.charAt(0);

		if (numdoc.length > 0) {
			numdoc = numdoc.substring(1,numdoc.length);
		}
	}

	numdoc = mascara + numdoc;

	if (tipdoc != 'NIE') {
		numdoc = numdoc.substring(numdoc.length-9, numdoc.length);
	} else {
		numdoc = numdoc.substring(numdoc.length-8, numdoc.length);
	}  

	numdoc = primer_caracter + numdoc;
	return numdoc;
}
//-- Fin funciones validacion de NIF, NIE, CIF, Pasaporte.. --


// ------------ VALIDAR E_MAIL ---------------
	function isEmailAddress(obj){
		var s = obj.value;
		var filter=/^[A-Za-z0-9_.-][A-Za-z0-9_.-]*@[A-Za-z0-9_.-]+\.[A-Za-z0-9_.]+[A-za-z]$/;
		if (s.length == 0 ) return true;
		if (filter.test(s))
			return true;
		else
			if (typeof(cargando2) != "undefined") {
					cargando2.visible('On');
					cargando2.display({
						descripcion: "La dirección de correo es inválida",
						boton_visible: true,
						gif_visible: true,
						img: 'error'
					});
				}
				else {
				alert("La dirección de correo es inválida");
		}
 //		obj.focus();
		return false;
	}
// ------------ FIN VALIDAR E_MAIL ---------------
	

	// Validaciones de ICC - paso 2:
	function mensajeValidacion(datos) {
		icc_validado = true;
		msisdn_elegido = false;
		
		// Comprobar si se devuelve un nº de telefono valido:
		var msisdn = datos.consulta_icc.msisdn;
		var estado = datos.consulta_icc.estado;

		if ((msisdn != '') && (v_tippro=='POS')) {
			if (typeof(cargando2) != "undefined"){
				cargando2.visible('on');
				cargando2.display(
				{descripcion:	'Para realizar un alta de contrato debes elegir una tarjeta sin pegatina.',
				boton_visible:	true,
				gif_visible:	true,
				img:			'error'}
				);
			} else {
				alert('Para realizar un alta de contrato debes elegir una tarjeta sin pegatina.');
			}

			return false;
		}		

		if (msisdn != '') {
			tipsim = 'NOBLANCA';
		}

		if (estado == 'KO') {
			if (typeof(cargando2) != "undefined") {
				cargando2.display(
				{descripcion:	'El número de tarjeta introducido no es correcto, vuelva a introducirlo.',
				boton_visible:	true,
				gif_visible:	true,
				img:			'error'});
			} else{
				alert('El número de tarjeta introducido no es correcto, vuelva a introducirlo.');
			}

			return false;
		} 

		if (estado == 'KO1') {
			if (typeof(cargando2) != "undefined") {
				cargando2.display(
				{descripcion:	'La tarjeta ha sido cancelada y no puede ser usada para la contratación. Por favor utilice una tarjeta sin pegatina.',
				boton_visible:	true,
				gif_visible:	true,
				img:			'error'});
			} else{
				alert('La tarjeta ha sido cancelada y no puede ser usada para la contratación. Por favor utilice una tarjeta sin pegatina.');
			}

			return false;
		}
		if (estado == 'KO2') {
			if (typeof(cargando2) != "undefined") {
				cargando2.display(
				{descripcion:	'Esta tarjeta ya ha sido utilizada. Por favor, use otra tarjeta.',
				boton_visible:	true,
				gif_visible:	true,
				img:			'error'});
			} else{
				alert('Esta tarjeta ya ha sido utilizada. Por favor, use otra tarjeta.');
			}

			return false;
		}		

   		if ((document.getElementById('div_numeros_disponibles').style.display!='none')&& (document.foDatos.p_numero.value=='')) {
			if (typeof(cargando2) != "undefined") {
					cargando2.visible('On');
					//cargando2.onclick({func:'control_mensajeValidacion();'});
					cargando2.display({
						descripcion: 'Debes seleccionar un numero de teléfono',
						boton_visible: true,
						gif_visible: true,
						img: 'error'
					});
					return false;
				}
				else {
						alert('Debes seleccionar un numero de teléfono');
						//control_mensajeValidacion();
		    }     
  }  
 
		// Existe nº de telefono
		if (msisdn != '') {
			icc_valido = document.foDatos.p_icc.value;			
			document.foDatos.p_numero.value = msisdn;
			document.getElementById('div_numeros_disponibles').style.display="none";
			 if (document.getElementById('cuatroDigitos')){
           document.getElementById('cuatroDigitos').style.display="none";
       }
      document.getElementById('cuatroDigitos').style.display="none"; //
	
			if (typeof(cargando2) != "undefined") {
				cargando2.onclick({func:'actualiza();'});
				cargando2.display(
				{descripcion:	'ICC válido, su número asociado es '+msisdn,
				boton_visible:	true,
				gif_visible:	true,
				img:			'ok'});
			} else {
				alert('ICC válido, su número asociado es '+msisdn);actualiza();
			}
	
			return;
	
		} else {
			// NO existe el nº de telefono (= Tarjeta Blanca)
			
			if (typeof(cargando2) != "undefined"){
				cargando2.visible('off');
			}
		
			icc_valido = "";
		
			document.getElementById('icc_msisdn').innerHTML = "";
			document.getElementById('div_numeros_disponibles').style.display="inline";
			
      document.getElementById('cuatroDigitos').style.display="inline"; //
			 
       if (document.getElementById('cuatroDigitos')){
           document.getElementById('cuatroDigitos').style.display="inline";
       }
        
      document.getElementById('div_icc_numsel').style.display="none";
		}                      

		//If pasado a la funcion control_mensajeValidacion para poder controlarlo mediante el div cargando2
    if (v_pedsel == 'DISTRI'
		      && (document.getElementById('div_numeros_disponibles').style.display!='none')
		      && (document.foDatos.p_numero.value!='')) {    
       	    return actualiza();
		}/* else {
			if (typeof(cargando2) != "undefined"){
				cargando2.visible('off');
			}         
		} */   
	}

 
 
 
 /*function control_mensajeValidacion(){
   // alert(canal+' '+document.foDatos.p_numero.value+' '+document.getElementById('div_numeros_disponibles').style.display);
    if (((canal == 'LCR')||(canal == 'AGE'))
		      && (document.getElementById('div_numeros_disponibles').style.display!='none')
		      && (document.foDatos.p_numero.value!='')) {
			   
         alert('holaa');
           return actualiza();
		} else {
			if (typeof(cargando2) != "undefined"){
				cargando2.visible('off');
			} 
		} 
  } */ 


 


	// Validaciones de ICC - paso 1:
	function valida_icc() {
    if (v_pedsel == 'VIDISA') {
		    return actualiza();
	  }

		var icc = document.getElementById('icc').value;

   

		if (icc.length < 10) {
  		     if (typeof(cargando2) != "undefined") {
  					  cargando2.visible('On');
  				  	cargando2.display({
  						descripcion: 'Debe introducir los 10 digitos finales del numero ICC',
  						boton_visible: true,
  						gif_visible: true,
  						img: 'error'
  					});
  				}
  				else {
  						alert('Debe introducir los 10 digitos finales del numero ICC');
  		    }   
    } else {
			// Validamos el numero ICC:
			request2 = new PeticionBD ('xweb_sesion_operacion.consulta_icc.xml'
									,['p_icc','p_msisdn']
									,mensajeValidacion
									,errorBD);
			request2.Iniciar(['893456022' + document.foDatos.p_icc.value, '']);
		}
		
		
	}

//------------------------------------------------

  	function mensajeValidacionPortabilidad(datos) {
		// Comprobar si se devuelve un nÂº de telefono valido:
		var msisdn = datos.consulta_icc.msisdn;	
		var estado = datos.consulta_icc.estado;
		
		if (estado == 'KO') {
			if (typeof(cargando2) != "undefined"){
				cargando2.visible('on');
        		cargando2.display({descripcion:'El número de tarjeta introducido no es correcto, vuelva a introducirlo.',
                            		boton_visible:true,
                            		gif_visible:true,
                            		 img:'error'});
      		}else{
        		alert('El número de tarjeta introducido no es correcto, vuelva a introducirlo.');
      		}
		  	return false;
    	}
		
		if (estado == 'KO1') {
			if (typeof(cargando2) != "undefined") {
				cargando2.display(
				{descripcion:	'La tarjeta ha sido cancelada y no puede ser usada para la contratación. Por favor utilice una tarjeta sin pegatina.',
				boton_visible:	true,
				gif_visible:	true,
				img:			'error'});
			} else{
				alert('La tarjeta ha sido cancelada y no puede ser usada para la contratación. Por favor utilice una tarjeta sin pegatina.');
			}

			return false;
		}
		if (estado == 'KO2') {
			if (typeof(cargando2) != "undefined") {
				cargando2.display(
				{descripcion:	'Esta tarjeta ya ha sido utilizada. Por favor, use otra tarjeta.',
				boton_visible:	true,
				gif_visible:	true,
				img:			'error'});
			} else{
				alert('Esta tarjeta ya ha sido utilizada. Por favor, use otra tarjeta.');
			}

			return false;
		}
				
		// Existe nÂº de telefono = Tarjeta Normal 
		if (typeof(cargando2) != "undefined"){
        	cargando2.visible('off');
    	}
    	if (msisdn != '') {
      		if (typeof(cargando2) != "undefined"){
        		cargando2.visible('on');
        		cargando2.display({descripcion:'Para conservar el número debes elegir una tarjeta sin pegatina',
                             	   boton_visible:true,
                             	   gif_visible:true,
                             	   img:'error'});
      		}else{
        		alert('Para conservar el número debes elegir una tarjeta sin pegatina');
      		}
		} else {
		// Existe NO el nÂº de telefono = Tarjeta Blanca
		  document.getElementById('formulario_portabilidad').style.display="inline";
		  document.getElementById('formulario_previo').style.display="none";
		  document.getElementById('iccNueva').style.display="none";
		  document.foDatos.p_icc.readonly="readonly";
		  
		  if (document.getElementById('t_pospago')){
		  	if (document.foDatos.p_tprext.value == 'POS') {
				document.getElementById('t_pospago').style.display = 'inline';
			}
      	  }
    	}
    
	}

	function valida_portabilidad_icc() {
		var icc = document.getElementById('icc').value;

		if (icc.length < 10) {
			
         if (typeof(cargando2) != "undefined"){
            cargando2.visible('on');
            cargando2.display({descripcion:'Debe introducir los 10 digitos finales del numero ICC',
                                 boton_visible:true,
                                 gif_visible:true,
                                 img:'error'});
          }else{
            alert('Debe introducir los 10 digitos finales del numero ICC');
          } 
     	} else {
			// Validamos el numero ICC:
			request2 = new PeticionBD ('xweb_sesion_operacion.consulta_icc.xml'
									,['p_icc','p_msisdn']
									,mensajeValidacionPortabilidad
									,errorBD);
			request2.Iniciar(['893456022' + document.foDatos.p_icc.value, '']);
		}
	}

//------------------------------------------------------------------------------
// Solo Datos Agencia 
	function solo_datos_age(){
		
		// Validamos el ICC
		if (document.getElementById('icc').value.length < 10) {
  			cargando2.visible('On');
  			cargando2.display({descripcion: 'Debe introducir los 10 digitos finales del numero ICC',
  						       boton_visible: true,
  						       gif_visible: true,
  						       img: 'error'
  					         });
			return false;
  		}	

 		request_datos = new PeticionBD ('xweb_sesion_operacion.asigna_icc.xml'
					    			   ,['p_icc']
								       ,cargaSiguiente);
								       
		request_datos.Iniciar(['893456022' + document.getElementById('icc').value]);								    										       
		  }	

