
	
function imprSelec(nombre)
{
  var ficha = document.getElementById(nombre);
  var ventimp = window.open(' ', 'popimpr');
  ventimp.document.write( ficha.innerHTML );
  ventimp.document.close();
  ventimp.print( );
  ventimp.close();
} 

function formSolPin(){
	
	document.RECARGA.submit();
	
}
	
function formSubmitRec(){
	
	if (document.RECARGA.TEL1.value.length!=9 || isNaN(document.RECARGA.TEL1.value)){
		alert("N\u00FAmero de tel\u00E9fono incorrecto. Debe introducir las 9 cifras sin espacios.");
		document.RECARGA.TEL1.focus();
		return;
	
	}else if (document.RECARGA.TEL1.value!=document.RECARGA.TEL2.value){
		alert("El n\u00FAmero de tel\u00E9fono y su confirmaci\u00F3n no coinciden. Por favor, rectifique los valores introducidos.");
		document.RECARGA.TEL1.focus();
		return;
	}else {
		conf=confirm(" SU SOLICITUD DE RECARGA:\n\n OPERADOR: " +  document.RECARGA.OPERADOR.value + "\n TELEFONO: " + document.RECARGA.TEL1.value+ "\n CANTIDAD: " + document.RECARGA.CANTIDAD.value + " Euros");				
		if (conf) document.RECARGA.submit();
	}
	
}
function formSubmitRect(){
	
	if (document.RECARGA.PIN_RECARGA.value.length<10 || isNaN(document.RECARGA.PIN_RECARGA.value)){
		alert("N\u00FAmero de pin incorrecto. Debe introducir todas las cifras sin espacios.");
		document.RECARGA.PIN_RECARGA.focus();
		return;
	
	}else {
		conf=confirm(" SU SOLICITUD DE RECARGA:\n\n PIN: " + document.RECARGA.PIN_RECARGA.value+ "\n CANTIDAD: " + document.RECARGA.CANTIDAD.value + " Euros");				
		if (conf) document.RECARGA.submit();
	}
	
}

function formSubmitRec2(){
	
	if (document.RECARGA.TEL1.value.length!=9 || isNaN(document.RECARGA.TEL1.value)){
		alert("N\u00FAmero de tel\u00E9fono incorrecto. Debe introducir las 9 cifras sin espacios.");
		document.RECARGA.TEL1.focus();
		return;
	
	}else if (document.RECARGA.TEL1.value!=document.RECARGA.TEL2.value){
		alert("El n\u00FAmero de tel\u00E9fono y su confirmaci\u00F3n no coinciden. Por favor, rectifique los valores introducidos.");
		document.RECARGA.TEL1.focus();
		return;
	}else {
		conf=confirm(" SU SOLICITUD DE RECARGA:\n\n OPERADOR: " +  document.RECARGA.OPERADOR.value + "\n TELEFONO: " + document.RECARGA.TEL1.value);				
		if (conf) document.RECARGA.submit();
	}
	
}


function formSubmitAut(){
	
	if (document.AUTENTIFICA.LOGIN.value.length!=9){
		alert("N\u00FAmero de cuenta incorrecto. Por favor, rectifique los datos introducidos.");
		document.AUTENTIFICA.LOGIN.focus();
		return;
	
	}else if (document.AUTENTIFICA.PASSW.value.length<6){
		alert("Su contrase\u00F1a debe tener al menos 6 caracteres.");
		document.AUTENTIFICA.PASSW.focus();
		return;
	}else {
		
		document.AUTENTIFICA.submit();
	}
	
}
function formSubmitAut2(){
	
	if (document.AUTENTIFICA2.LOGIN2.value.length!=9){
		alert("N\u00FAmero de cuenta incorrecto. Por favor, rectifique los datos introducidos.");
		document.AUTENTIFICA2.LOGIN2.focus();
		return;
	
	}else if (document.AUTENTIFICA2.PASSW2.value.length<6){
		alert("Su contrase\u00F1a debe tener al menos 6 caracteres.");
		document.AUTENTIFICA2.PASSW2.focus();
		return;
	}else {
		
		document.AUTENTIFICA2.submit();
	}
	
}
function  comprobarRecarga(){
	document.RECARGA.action="comprobarRecarga.php";
	document.RECARGA.submit();

}

function formSubmitERec(valor)
	
	{
	if (valor=='PIN')
		{
		if (document.ESTADO_RECARGA.ID_RECARGA.value.length<10 || isNaN(document.ESTADO_RECARGA.ID_RECARGA.value))
			{
			alert("N\u00FAmero de PIN incorrecto. Debe introducir las 10 cifras sin espacios.");
			document.ESTADO_RECARGA.ID_RECARGA.focus();
			return;
			}
		else 
			{
			document.ESTADO_RECARGA.operacion.value = "R";
			
			window.open('', 'foo', 'width=450,height=350,status=yes,resizable=yes,scrollbars=yes');
			document.ESTADO_RECARGA.submit();
			}
		}
	else
		{
		if (document.ESTADO_RECARGA2.IDENTIFICADOR.value=="" || isNaN(document.ESTADO_RECARGA2.IDENTIFICADOR.value))
			{
			alert("N\u00FAmero de IDENTIFICADOR incorrecto.");
			document.ESTADO_RECARGA2.IDENTIFICADOR.focus();
			return;
			}
		else 
			{
			
			document.ESTADO_RECARGA2.operacion2.value = "R";
			window.open('', 'foo', 'width=450,height=350,status=yes,resizable=yes,scrollbars=yes');
			document.ESTADO_RECARGA2.submit();
			}
		}
	}
	
function formSubmitAnular(){
	
	if (document.ANULAR_RECARGA.PIN_RECARGA.value.length<10 || isNaN(document.ANULAR_RECARGA.PIN_RECARGA.value)){
		alert("N\u00FAmero de pin incorrecto. Debe introducir todas las cifras sin espacios.");
		document.ANULAR_RECARGA.PIN_RECARGA.focus();
		return;
	
	}else if (document.ANULAR_RECARGA.REFERENCIA.value=="" || document.ANULAR_RECARGA.REFERENCIA.value<=0 || isNaN(document.ANULAR_RECARGA.REFERENCIA.value)){
		alert("N\u00FAmero de Referencia incorrecto. Debe introducir todas las cifras sin espacios.");
		document.ANULAR_RECARGA.REFERENCIA.focus();
		return;
	
	}else {
		conf=confirm(" SU SOLICITUD DE ANULACION DE RECARGA:\n\n PIN: " + document.ANULAR_RECARGA.PIN_RECARGA.value+ "\n REFERENCIA: " + document.ANULAR_RECARGA.REFERENCIA.value );				
		if (conf) document.ANULAR_RECARGA.submit();
	}
	
}

function formSubmitAnulaRec(valor)

{
if (valor=='PIN')
	{
	if (document.ESTADO_RECARGA.ID_RECARGA.value.length<10 || isNaN(document.ESTADO_RECARGA.ID_RECARGA.value))
		{
		alert("N\u00FAmero de PIN incorrecto. Debe introducir las 10 cifras sin espacios.");
		document.ESTADO_RECARGA.ID_RECARGA.focus();
		return;
		}
	else 
		{
			
		
		   document.ESTADO_RECARGA.operacion.value = "A";
		   window.open('', 'foo', 'width=450,height=350,status=yes,resizable=yes,scrollbars=yes');
			 document.ESTADO_RECARGA.submit();	
		}
	}
else
	{
	if (document.ESTADO_RECARGA2.IDENTIFICADOR.value=="" || isNaN(document.ESTADO_RECARGA2.IDENTIFICADOR.value))
		{
		alert("N\u00FAmero de IDENTIFICADOR incorrecto.");
		document.ESTADO_RECARGA2.IDENTIFICADOR.focus();
		return;	
		}
	else 
		{
		conf=confirm(" ż ANULAR RECARGA CON IDENTIFICADOR=" +  document.ESTADO_RECARGA2.IDENTIFICADOR.value + " ?\n");				
		if (conf)
			{
			
			document.ESTADO_RECARGA2.operacion2.value = "A";
			window.open('', 'foo', 'width=450,height=350,status=yes,resizable=yes,scrollbars=yes');
			document.ESTADO_RECARGA2.submit();	
			
			}
		}
	}
}

function formSubmitLista(){
	
	var fecha1=document.LISTA_RECARGAS.FECHA.value;
	var fecha2=document.LISTA_RECARGAS.FECHA2.value;
	
	//alert (fecha1.substring(0,2) + "  " +  fecha1.substring(3,5) + "  " +  fecha1.substring(6,10));
	if (fecha1=="" || fecha1=="") {
		alert("Debe elegir una fecha inicial y final para generar el informe");
		document.LISTA_RECARGAS.FECHA.focus();
		return;
	}else{
		var anio1=fecha1.substring(6,10);
		var anio2=fecha2.substring(6,10);	
		var mes1= fecha1.substring(3,5);
		var mes2= fecha2.substring(3,5);
		var dia1=fecha1.substring(0,2);
		var dia2=fecha2.substring(0,2);
		var fecha3=anio1*365 + mes1*30 + dia1;
		var fecha4=anio2*365 + mes2*30 + dia2;
		if (fecha4<fecha3) {
			alert ("La fecha final debe ser posterior a la inicial");
			document.LISTA_RECARGAS.FECHA.focus();
			return;
		}		
		document.LISTA_RECARGAS.FECHA_INI.value=anio1 + mes1 + dia1;
		document.LISTA_RECARGAS.FECHA_FIN.value=anio2 + mes2 + dia2;
		document.LISTA_RECARGAS.target="listaRecargas";
		window.open('', 'listaRecargas', 'width=580,height=750,status=yes,resizable=yes,scrollbars=yes');
    document.LISTA_RECARGAS.submit();
	}
	

}

function formSubmitLista_TARJ(){
	
	var fecha1=document.LISTA_RECARGAS_TARJ.FECHA1.value;
	var fecha2=document.LISTA_RECARGAS_TARJ.FECHA2.value;
	
	//alert (fecha1.substring(0,2) + "  " +  fecha1.substring(3,5) + "  " +  fecha1.substring(6,10));
	if (fecha1=="" || fecha1=="") {
		alert("Debe elegir una fecha inicial y final para generar el informe");
		document.LISTA_RECARGAS_TARJ.FECHA1.focus();
		return;
	}else{
		var anio1=fecha1.substring(6,10);
		var anio2=fecha2.substring(6,10);	
		var mes1= fecha1.substring(3,5);
		var mes2= fecha2.substring(3,5);
		var dia1=fecha1.substring(0,2);
		var dia2=fecha2.substring(0,2);
		var fecha3=anio1*365 + mes1*30 + dia1;
		var fecha4=anio2*365 + mes2*30 + dia2;
		if (fecha4<fecha3) {
			alert ("La fecha final debe ser posterior a la inicial");
			document.LISTA_RECARGAS_TARJ.FECHA1.focus();
			return;
		}		
		document.LISTA_RECARGAS_TARJ.FECHA_INI.value=anio1 + mes1 + dia1;
		document.LISTA_RECARGAS_TARJ.FECHA_FIN.value=anio2 + mes2 + dia2;
		document.LISTA_RECARGAS_TARJ.EXCEL_1.value= "FALSE";
		//document.LISTA_RECARGAS_TARJ.target="listaRecargas_tarj";
		//window.open('', 'listaRecargas_tarj', 'width=560,height=750,status=yes,resizable=yes,scrollbars=yes');
    document.LISTA_RECARGAS_TARJ.submit();
	}
	

}

function formSubmitLista_TARJ_EXCEL(){
	
	var fecha1=document.LISTA_RECARGAS_TARJ.FECHA1.value;
	var fecha2=document.LISTA_RECARGAS_TARJ.FECHA2.value;
	
	//alert (fecha1.substring(0,2) + "  " +  fecha1.substring(3,5) + "  " +  fecha1.substring(6,10));
	if (fecha1=="" || fecha1=="") {
		alert("Debe elegir una fecha inicial y final para generar el informe");
		document.LISTA_RECARGAS_TARJ.FECHA1.focus();
		return;
	}else{
		var anio1=fecha1.substring(6,10);
		var anio2=fecha2.substring(6,10);	
		var mes1= fecha1.substring(3,5);
		var mes2= fecha2.substring(3,5);
		var dia1=fecha1.substring(0,2);
		var dia2=fecha2.substring(0,2);
		var fecha3=anio1*365 + mes1*30 + dia1;
		var fecha4=anio2*365 + mes2*30 + dia2;
		if (fecha4<fecha3) {
			alert ("La fecha final debe ser posterior a la inicial");
			document.LISTA_RECARGAS_TARJ.FECHA1.focus();
			return;
		}		
		document.LISTA_RECARGAS_TARJ.FECHA_INI.value=anio1 + mes1 + dia1;
		document.LISTA_RECARGAS_TARJ.FECHA_FIN.value=anio2 + mes2 + dia2;
		document.LISTA_RECARGAS_TARJ.EXCEL_1.value= "TRUE";		
    document.LISTA_RECARGAS_TARJ.submit();
	}
	

}


function formSol(){
	
	if (document.SOL_ALTA.NOMBRE.value==""){
		alert("Es imprescindible cumplimentar todos los datos en negritas");
		document.SOL_ALTA.NOMBRE.focus();
		return;
	
	}else if (document.SOL_ALTA.NIF.value==""){
		alert("Es imprescindible cumplimentar todos los datos en negritas");
		document.SOL_ALTA.NIF.focus();
		return;
	}else if (document.SOL_ALTA.TEL.value==""){
		alert("Es imprescindible cumplimentar todos los datos en negritas");
		document.SOL_ALTA.TEL.focus();
		return;
	}else if (mail(document.SOL_ALTA.EMAIL.value)== false ){	
		
		alert("Debe introducir un email válido.");
		document.SOL_ALTA.EMAIL.focus();
		return;	
	}else if (document.SOL_ALTA.CALLE.value==""){
		alert("Es imprescindible cumplimentar todos los datos en negritas");
		document.SOL_ALTA.CALLE.focus();
		return;
	}else if (document.SOL_ALTA.CIUDAD.value==""){
		alert("Es imprescindible cumplimentar todos los datos en negritas");
		document.SOL_ALTA.CIUDAD.focus();
		return;
	}else if (document.SOL_ALTA.CP.value==""){
		alert("Es imprescindible cumplimentar todos los datos en negritas");
		document.SOL_ALTA.CP.focus();
		return;
	}else if (document.SOL_ALTA.PASSWORD1.value.length<4 || document.SOL_ALTA.PASSWORD1.value.length>10) {
			alert("Su contrase\u00F1a debe tener una longitud entre 4 y 10 d\u00EDgitos");
			document.SOL_ALTA.PASSWORD1.focus();
			return;	
	}else if (document.SOL_ALTA.PASSWORD1.value!=document.SOL_ALTA.PASSWORD2.value ) {
			alert("Su Contrase\u00F1a  y su confirmaci\u00F3n de Contrase\u00F1a no coinciden.\n Por favor introduzca la misma contrase\u00F1a en ambos campos.");
			document.SOL_ALTA.PASSWORD1.focus();
			return;
	}else {
		document.SOL_ALTA.action="confKTelecom.php";
		document.SOL_ALTA.submit();
	}

}
function mail(texto){ 

    var mailres = true;             
    var cadena = "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ1234567890@._-";
     
    var arroba = texto.indexOf("@",0); 
    if ((texto.lastIndexOf("@")) != arroba) arroba = -1; 
     
    var punto = texto.lastIndexOf("."); 
                 
     for (var contador = 0 ; contador < texto.length ; contador++){ 
        if (cadena.indexOf(texto.substr(contador, 1),0) == -1){ 
            mailres = false; 
            break; 
     } 
    } 

    if ((arroba > 1) && (arroba + 1 < punto) && (punto + 1 < (texto.length)) && (mailres == true) && (texto.indexOf("..",0) == -1)) 
     mailres = true; 
    else 
     mailres = false; 
                 
    return mailres; 
}



function formLoc(){
	
	if (document.SOL_LOC.NOMBRE.value==""){
		alert("Es imprescindible cumplimentar todos los datos en negritas");
		document.SOL_LOC.NOMBRE.focus();
		return;
	
	}else if (document.SOL_LOC.NIF.value==""){
		alert("Es imprescindible cumplimentar todos los datos en negritas");
		document.SOL_LOC.NIF.focus();
		return;
	}else if (document.SOL_LOC.TEL.value==""){
		alert("Es imprescindible cumplimentar todos los datos en negritas");
		document.SOL_LOC.TEL.focus();
		return;
	}else if (document.SOL_LOC.CALLE.value==""){
		alert("Es imprescindible cumplimentar todos los datos en negritas");
		document.SOL_LOC.CALLE.focus();
		return;
	}else if (document.SOL_LOC.CIUDAD.value==""){
		alert("Es imprescindible cumplimentar todos los datos en negritas");
		document.SOL_LOC.CIUDAD.focus();
		return;
	}else if (document.SOL_LOC.CP.value==""){
		alert("Es imprescindible cumplimentar todos los datos en negritas");
		document.SOL_LOC.CP.focus();
		return;
	}else if (document.SOL_LOC.LINEAS.value=="") {
			alert("Es imprescindible cumplimentar todos los datos en negritas");
			document.SOL_LOC.LINEAS.focus();
			return;	
	}else {
		document.SOL_LOC.action="confLoc.php";
		document.SOL_LOC.submit();
	}

}






function mostrartext(elemento){
	
if ( elemento == 'saldo' ){	
document.getElementById('rtext').value = 'RECARGAR SALDO';
}
if ( elemento == 'movil' ){
document.getElementById('rtext').value = 'RECARGAR MOVIL';
}
if ( elemento == 'hist' ){
document.getElementById('rtext').value = 'HISTORIAL DE COMPRAS';
}
}

//20101126

function formSubmitImTarj(){
	if(confirm("Va a realizar una compra, con su correspondiente gasto de saldo.\n żDesea continuar? ")) {
			document.IMTARJ.ticket.value = "0";
			window.open('', 'foo', 'width=690,height=215,status=NO,resizable=NO,scrollbars=NO,location=NO');				
			document.IMTARJ.submit();	
	}		
						
}
function formSubmitTiTarj(){
	 if(confirm("Va a realizar una compra, con su correspondiente gasto de saldo.\n żDesea continuar? ")) {
			document.IMTARJ.ticket.value = "1";			
			window.open('', 'foo', 'width=220,height=280,status=no,resizable=no,scrollbars=no');				
			document.IMTARJ.submit();		
			
	 }				
}


function formSubmitCaTarj(){									
	if(confirm("Va a proceder a cancelar una tarjeta\nżDesea continuar? ")) {		
		document.CATARJ.submit();	
	}						
}
function formSubmitCoTarj(){
	
			document.CATARJ.operacion.value="CO";									
			document.CATARJ.submit();				
}

function formSubmitReTarj(){
												
			document.RETARJ.submit();				
}
function formSubmitCaReTarj(){
												
			document.CARETARJ.submit();				
}



//RECARGAS MOVIL
function formSubmitReMovTarj(){												
			document.REMOVTARJ.submit();				
}

function formSubmitCaMovTarj(){
	
	if (document.CAMOVTARJ.movid.value=="" || isNaN(document.CAMOVTARJ.movid.value))
		{
		alert("N\u00FAmero de IDENTIFICADOR incorrecto.");
		document.CAMOVTARJ.movid.focus();
		return;	
		}
	else 
		{
		conf=confirm(" ż DESEA ANULAR LA RECARGA ?");				
		if (conf)
			{
			
			document.CAMOVTARJ.submit();		
			
			}
		}	
												
						
}

function formSubmitCoMovTarj(){
	
	if (document.CAMOVTARJ.movid.value=="" )
		{ //|| isNaN(document.CAMOVTARJ.movid.value)
		alert("N\u00FAmero de IDENTIFICADOR incorrecto.");
		document.CAMOVTARJ.movid.focus();
		return;	
		}
	else 
		{
											
			document.CAMOVTARJ.operacion.value = "CORM";
			document.CAMOVTARJ.submit();					
			
		}	
												
						
}



function formSubmitReSaldTarj(){
	
	document.RSALDTARJ.submit();		
	
}

function hideMe(){
	res = document.getElementById('resultado');
	res.style.display = 'none'; 
	over = document.getElementById('TB_over');		 		
	over.style.display = 'none';
}
function hideMe2(result,tbover){
	res = document.getElementById(result);
	res.style.display = 'none'; 
	over = document.getElementById(tbover);		 		
	over.style.display = 'none';
}
function showMe2(result,tbover){
	res = document.getElementById(result);
	res.style.display = 'block'; 
	over = document.getElementById(tbover);		 		
	over.style.display = 'block';
}

function showMe(){
	
	res = document.getElementById('resultado');
	res.style.display = 'block';
} 

function imprSelec(nombre)
{
  var ficha = document.getElementById(nombre);
  var ventimp = window.open(' ', 'popimpr');
  ventimp.document.write( ficha.innerHTML );
  ventimp.document.close();
  ventimp.print( );
  ventimp.close();
}


function formReqpass(){
	if ( mail(document.reqpass.mail1.value) == false ){
		alert("Debe introducir un correo válido");
		document.reqpass.mail1.focus();
		return;
	
	}else{
	if ( document.reqpass.mail1.value != document.reqpass.mail2.value ){
		alert("Es imprescindible que coincidan los correos");
		document.reqpass.mail1.focus();
		return;
	
	}else{		
		document.reqpass.submit();
	}
	}

}

function logout(){
if(confirm("żDesea salir de sesión?")) {			
	document.LOGOUT.submit();
  }	
}	

function verdestinos(){
	if(document.getElementById('dest').style.display == "none"){
	document.getElementById('konline').style.display = "none" ;
	document.getElementById('dest').style.display = "block" ;
	}else{
	document.getElementById('konline').style.display = "block" ;
	document.getElementById('dest').style.display = "none" ;
  }
}

function vertarif(){
	document.getElementById('tarif').value = "1" ;
	document.vertarif.submit();

	}
function	hideMeGlider(){
	
									 	over = document.getElementById("TB_over");
								 		res = document.getElementById("resultado");	
								 		hban0 = document.getElementById("ban0");							 		
								 		hban1 = document.getElementById("ban1");
								 		hban2 = document.getElementById("ban2");
								 		hban3 = document.getElementById("ban3");
								 		hban4 = document.getElementById("ban4");
								 		hban5 = document.getElementById("ban5");
								 		hban6 = document.getElementById("ban6");
								 		hban7 = document.getElementById("ban7");
								 		
								 		over.style.display = "none";
										res.style.display = "none"; 
										hban0.style.display = "block";
								 		hban1.style.display = "block";
								 		hban2.style.display = "block";
								 		hban3.style.display = "block";
								 		hban4.style.display = "block";
								 		hban5.style.display = "block";
								 		hban6.style.display = "block";
								 		hban7.style.display = "block";       								       						
}	
function	showMeGlider(){
	
								over = document.getElementById("TB_over");
						 		res = document.getElementById("resultado");		
						 		hban0 = document.getElementById("ban0");				 							 		
						 		hban1 = document.getElementById("ban1");
						 		hban2 = document.getElementById("ban2");
						 		hban3 = document.getElementById("ban3");
						 		hban4 = document.getElementById("ban4");
						 		hban5 = document.getElementById("ban5");
						 		hban6 = document.getElementById("ban6");
						 		hban7 = document.getElementById("ban7");
						 		
						 		over.style.display = "block";
								res.style.display = "block"; 	
								hban0.style.display = "none";								
						 		hban1.style.display = "none";
						 		hban2.style.display = "none";
						 		hban3.style.display = "none";
						 		hban4.style.display = "none";
						 		hban5.style.display = "none";
						 		hban6.style.display = "none";
						 		hban7.style.display = "none";    						
		       						
}

	
