

function Texts() { 

    vxTTS.value = '';

    if ( vxSemanticInt.value == 'noticias' ) {
          vxTTS.value = ' Per escoltar la noticia completa, digui el número de la notícia. Per tornar a la pàgina principal digui, inici. ';
          vxConjuntoNoticias = document.getElementById('noticias');
          vxTituloNoticias = vxConjuntoNoticias.getElementsByTagName('A');
          for(i=1;i<vxTituloNoticias.length;i++) {
              vxTTS.value += 'Noticia ' + i + ': ' + vxTituloNoticias(i).innerText + '. ';
          }                        	
				  vxTTS.value += ' Per escoltar la resta de noticies digui, més noticies. Per tornar a la pàgina principal digui, inici. ';
						
		} else if ( vxSemanticInt.value == 'ayuntamiento' )  {
		      vxTTS.value = 'Està a la secció lajuntament. Digui el nom de la secció que desitgi 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 += ' Per sentir novament les opcions digui: repetir. També pot dir, ciutat. notícies. contacte. o altres. ';
						
		} else if ( vxSemanticInt.value == 'ciudad' ) {
		      vxTTS.value = ' Està a la secció La ciutat. Digui el nom de la secció que desitgi 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 += ' Per sentir novament les opcions, digui: repetir. També pot dir, ajuntament, noticies, contacte o altres. ';
						
		} else if ( vxSemanticInt.value == 'otros' ) {
		      vxTTS.value = ' Està a la secció Altres. Digui el nom de la secció que desitgi 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 += ' Per sentir novament les opcions, digui: repetir. També pot dir, ajuntament. ciutat. noticies. contacte. o altres. ';
						
		} else if ( vxSemanticInt.value == 'contacto' ) {
					vxTTS.value = '';
					vxTTS.value += ' Lajuntament de Castelló es troba a la Plaça Major, 1. ';
					vxTTS.value += ' El número de telèfon es el 964 35 51 00. ';
					vxTTS.value += ' Ladreça de correu electrònic es info, arroba, castelló punt es. ';
					vxTTS.value += ' Per tornar a sentir aquesta informació digui: repetir. També pot dir, ajuntament. ciutat. noticies. contacte. o altres. ';
							
		} else if ( vxSemanticInt.value == 'inicio' ) {
					vxTTS.value = '';
					vxTTS.value += ' Benvingut a lajuntament de Castelló. ';
	        vxTTS.value += ' Vostè es troba a la pàgina principal. ';
	        vxTTS.value += ' Digui el nom de la secció que desitgi consultar: ';
	        vxTTS.value += ' Noticies. Ajuntament. Ciutat. Contacte. O, Altres. ';
						
		} else {
					vxTTS.value = '';
					vxTTS.value += ' Benvingut a lajuntament de Castelló. ';
	        vxTTS.value += ' Vostè es troba a la pàgina principal. ';
	        vxTTS.value += ' Digui el nom de la secció que desitgi consultar: ';
	        vxTTS.value += ' Noticies. Ajuntament. Ciutat. Contacte. O, Altres. ';
    }
    
    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 += 'Notícia ' + vxNot + '==' + vxNotInterpretation + '#####';
    }


    vxASR.value += 'notícies==noticias#####';
    vxASR.value += 'més notícies==masnoticias#####';
    vxASR.value += 'ajuntament==ayuntamiento#####';
    vxASR.value += 'lajuntament==ayuntamiento#####';
    vxASR.value += 'ciutat==ciudad#####';
    vxASR.value += 'la ciutat==ciudad#####';
    vxASR.value += 'altres==otros#####';
    vxASR.value += 'contacte==contacto#####';
    vxASR.value += 'contacta==contacto#####';
    vxASR.value += 'inici==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 += ' Vostè es trova novament a la pàgina principal. ';
    vxTTS.value += ' A continuació llegirem els titulars de les últimes notícies: ' + vxTextoNoticias + '. ';
	vxTTS.value += ' Si vol informació sobre lajuntament, disposa de les següents seccions: ' + vxSeccionesAyuntamiento + '. ';
    vxTTS.value += ' Si vol informació sobre la ciutat, disposa de les següents seccions: ' + vxSeccionesCiudad + '. ';
    vxTTS.value += ' Si vol un altre tipus dinformació, disposa de les següents seccions: ' + vxSeccionesOtros + '. ';
    return vxTTS.value;

}


