

function Texts() { 

    vxTTS.value = '';

    if ( vxSemanticInt.value == 'noticias' ) {
          vxTTS.value = ' Para escuchar la noticia completa diga el número de la noticia. Para volver a la página principal, diga: inicio. ';
          vxConjuntoNoticias = document.getElementById('noticias');
          vxTituloNoticias = vxConjuntoNoticias.getElementsByTagName('A');
          for(i=1;i<vxTituloNoticias.length;i++) {
              vxTTS.value += 'Noticia ' + i + ': ' + vxTituloNoticias(i).innerText + '. ';
          }                        	
				  vxTTS.value += ' Para escuchar el resto de las noticias diga, más noticias. Para volver a la página principal, diga: inicio. ';
						
		} else if ( vxSemanticInt.value == 'ayuntamiento' )  {
		      vxTTS.value = 'Está en la sección El Ayuntamiento. Diga el nombre de la sección que desee consultar. ';
          vxMenuAyuntamiento = document.getElementById('menuayuntamiento');
          vxSeccionesNivel1 = vxMenuAyuntamiento.getElementsByTagName('A');
          for(i=0;i<vxSeccionesNivel1.length;i++) {
              vxSeccionNivel1 = vxSeccionesNivel1(i).innerText;
              vxTTS.value += vxSeccionNivel1 + '. ';
          }
          vxTTS.value += ' Para oir de nuevo las opciones, diga: repetir. También puede decir, ciudad. noticias. contacto. u otros. ';
						
		} else if ( vxSemanticInt.value == 'ciudad' ) {
		      vxTTS.value = ' Está en la sección La Ciudad. Diga el nombre de la sección que desee consultar. ';
          vxMenuCiudad = document.getElementById('menuciudad');
          vxSeccionesNivel1 = vxMenuCiudad.getElementsByTagName('A');
          for(i=0;i<vxSeccionesNivel1.length;i++) {
              vxSeccionNivel1 = vxSeccionesNivel1(i).innerText;
              vxTTS.value += vxSeccionNivel1 + '. ';
          }
          vxTTS.value += ' Para oir de nuevo las opciones, diga: repetir. También puede decir, ayuntamiento. noticias. contacto. u otros. ';
						
		} else if ( vxSemanticInt.value == 'otros' ) {
		      vxTTS.value = ' Está en la sección Otros. Diga el nombre de la sección que desee consultar. ';
	        vxMenuOtros = document.getElementById('menuotros');
	        vxSeccionesNivel1 = vxMenuOtros.getElementsByTagName('A');
	        for(i=0;i<vxSeccionesNivel1.length;i++) {
	            vxSeccionNivel1 = vxSeccionesNivel1(i).innerText;
	            vxTTS.value += vxSeccionNivel1 + '. ';
	        }
	        vxTTS.value += ' Para oir de nuevo las opciones, diga: repetir. También puede decir, ayuntamiento. ciudad. noticias. contacto. u otros. ';
						
		} else if ( vxSemanticInt.value == 'contacto' ) {
					vxTTS.value = '';
					vxTTS.value += ' Los datos de contacto son: ';
					vxTTS.value += ' El Ayuntamiento de Castellón se encuentra en la Plaza Mayor, 1. ';
					vxTTS.value += ' El número de teléfono es el 964 35 51 00. ';
					vxTTS.value += ' La dirección de correo electrónico es info@castello.es. ';
					vxTTS.value += ' Para oir de nuevo las opciones, diga: repetir. También puede decir, ayuntamiento. ciudad. noticias. contacto. u otros. ';
							
		} else if ( vxSemanticInt.value == 'inicio' ) {
					vxTTS.value = '';
					vxTTS.value += ' Bienvenido al Ayuntamiento de Castellón. ';
	        vxTTS.value += ' Está usted en la página principal. ';
	        vxTTS.value += ' Diga el nombre de la sección que desee consultar: ';
	        vxTTS.value += ' Noticias. Ayuntamiento. Ciudad. Contacto. U Otros. ';
						
		} else {
					vxTTS.value = '';
					vxTTS.value += ' Bienvenido al Ayuntamiento de Castellón. ';
	        vxTTS.value += ' Está usted en la página principal. ';
	        vxTTS.value += ' Diga el nombre de la sección que desee consultar: ';
	        vxTTS.value += ' Noticias. Ayuntamiento. Ciudad. Contacto. U Otros. ';
    }
    
    return vxTTS.value;
  }


function VoiceCommands() { 

    vxASR.value = '';
    
    vxTabla = document.getElementById('colIzq');
    vxListaSecciones = vxTabla.getElementsByTagName('A');
    for(i=0;i<vxListaSecciones.length;i++) {
        vxASR.value += vxListaSecciones(i).innerText + '==' + i + '#####';
    }
    
    vxGrupoNoticias = document.getElementById('noticias');
    vxNoticias = vxGrupoNoticias.getElementsByTagName('A');
    for(i=0;i<vxNoticias.length-1;i++) {
        vxNot = i+1;
        vxNotInterpretation = i+1+1000;
        vxASR.value += vxNot + '==' + vxNotInterpretation + '#####';
        vxASR.value += 'Noticia ' + vxNot + '==' + vxNotInterpretation + '#####';
    }


    vxASR.value += 'noticias==noticias#####';
    vxASR.value += 'mas noticias==masnoticias#####';
    vxASR.value += 'ayuntamiento==ayuntamiento#####';
    vxASR.value += 'el ayuntamiento==ayuntamiento#####';
    vxASR.value += 'ciudad==ciudad#####';
    vxASR.value += 'la ciudad==ciudad#####';
    vxASR.value += 'otros==otros#####';
    vxASR.value += 'contacto==contacto#####';
    vxASR.value += 'contacta==contacto#####';
    vxASR.value += 'inicio==inicio#####';
    

    return vxASR.value;
  }


function Management() { 

	vxVoiceCommand.value = vxRC.value;
      	vxSemanticInt.value = vxRSI.value;
      
      return 'vxSemanticInt==' + vxSemanticInt.value + '#####';
    }


function Navigation() { 


					
		  if (vxSemanticInt.value == 'masnoticias') {
							//PULSAMOS EN EL ENLACE DE MAS NOTICIAS
							vxLinks = document.getElementById('masnoticias');
							vxLinks.getElementsByTagName('A')(0).click();
              return '1';
							
			} else if (vxSemanticInt.value == 'noticias') {	

          return '0';
		  } else if (vxSemanticInt.value == 'ayuntamiento') {
          return '0';
			} else if (vxSemanticInt.value == 'ciudad') {
          return '0';
		  } else if (vxSemanticInt.value == 'otros') {
          return '0';
		  } else if (vxSemanticInt.value == 'contacto') {
          return '0';
		  } else if (vxSemanticInt.value == 'inicio') {
          return '0';
						
		  } else {
							/* hacemos clic en la seccion1 seleccionada o bien en la noticia seleccionada*/ 
					if (vxSemanticInt.value > 1000) {
								vxNoticiaElegida = parseInt(vxSemanticInt.value) - 1000;
	              vxConjuntoNoticias = document.getElementById('noticias');
	              vxConjuntoNoticias.getElementsByTagName('A')(vxNoticiaElegida).click();
	        } else {
	              vxTabla=document.getElementById('colIzq');
                vxIdSeccion = parseInt(vxSemanticInt.value);
	              vxTabla.getElementsByTagName('A')(vxIdSeccion).click(); 
	        }
          return '1';
	   } 
     
     return '0';
    }



function visualTexts() { 

    vxTTS.value = '';

    //Obtenemos las noticias 
    vxConjuntoNoticias = document.getElementById('noticias');
    vxTituloNoticias = vxConjuntoNoticias.getElementsByTagName('A');
    vxTextoNoticias = '';
    for(i=1;i<vxTituloNoticias.length;i++) {
        vxTextoNoticias += 'Noticia ' + i + ': ' + vxTituloNoticias(i).innerText + '. ';
    }                        	
    //Obtenemos seccion ayuntamiento
    vxMenuAyuntamiento = document.getElementById('menuayuntamiento');
    vxSeccionesNivel1 = vxMenuAyuntamiento.getElementsByTagName('A');
    vxSeccionesAyuntamiento = '';
    for(i=0;i<vxSeccionesNivel1.length;i++) {
        vxSeccionNivel1 = vxSeccionesNivel1(i).innerText;
        vxSeccionesAyuntamiento += vxSeccionNivel1 + '. ';
    }
    //Obtenemos seccion ciudad
    vxMenuCiudad = document.getElementById('menuciudad');
    vxSeccionesNivel1 = vxMenuCiudad.getElementsByTagName('A');
    vxSeccionesCiudad = '';
    for(i=0;i<vxSeccionesNivel1.length;i++) {
        vxSeccionNivel1 = vxSeccionesNivel1(i).innerText;
        vxSeccionesCiudad += vxSeccionNivel1 + '. ';
    }
    //Obtenemos seccion otros
    vxMenuOtros = document.getElementById('menuotros');
	vxSeccionesNivel1 = vxMenuOtros.getElementsByTagName('A');
	vxSeccionesOtros = '';
	for(i=0;i<vxSeccionesNivel1.length;i++) {
	    vxSeccionNivel1 = vxSeccionesNivel1(i).innerText;
	    vxSeccionesOtros += vxSeccionNivel1 + '. ';
	}

	vxTTS.value = '';
    vxTTS.value += ' Está de nuevo en la página principal. ';
    vxTTS.value += ' A continuación leeremos los titulares de las últimas noticias: ' + vxTextoNoticias + '. ';
	vxTTS.value += ' Si quiere información sobre el Ayuntamiento, dispone de las siguientes secciones: ' + vxSeccionesAyuntamiento + '. ';
    vxTTS.value += ' Si quiere información sobre la Ciudad, dispone de las siguientes secciones: ' + vxSeccionesCiudad + '. ';
    vxTTS.value += ' Si quiere otro tipo de informaciones, dispone de las siguientes secciones: ' + vxSeccionesOtros + '. ';
    return vxTTS.value;

}

