// JavaScript Document
function obtenerIdioma(){
	// recupera el valor de la variable del client_registry idioma
	var idioma;
	idioma = hcfRoot.Context_state();
	alert(idioma);
}
function cambiaIdioma(id){
	// esta función es llamada cuando se cambia de idioma

	// setup default listener - this will cause the
   // navigation panel to load once the map has loaded
   //top.registerContentListener('map', top.updateNavPanel, top.hcf_panel);
 	top.registerContentListener('map', top.updateNavPanel, top.hcf_panel);	
	
	var frame_menu='';
	var idioma_nv = 'es_ES';
	var idioma_sw = 'es_ES';
	if (id == null || id == '') {
		id = 'es';
	}
	
	
   switch (id) {
	      case 'es':
			  idioma_nv = 'es_ES';
			  idioma_sw = 'es_es';
			  top.registerParam('idioma', 'es_es');
			 top.L=0;
			  break;
		case 'en':
			  idioma_nv = 'en_US';
			  idioma_sw = 'en_gb';
			  top.registerParam('idioma', 'en_gb');
			 top.L=1;
			break;
		case 'fr':
			  idioma_nv = 'fr_FR';
			  idioma_sw = 'fr_fr';
			  top.registerParam('idioma', idioma_sw);
			  top.L=3;
			break;
			case 'de':
			  idioma_nv = 'de_DE';
			  idioma_sw = 'de_de';
			  top.registerParam('idioma', idioma_sw);
			  top.L=2;
			break;
			case 'it':
			  idioma_nv = 'it_IT';
			  idioma_sw = 'it_it';
			  top.registerParam('idioma', idioma_sw);
			   top.L=4;
			break;
		default:
		 	top.L=0;
			break;
		}
	

	// set up request
	aRequest =  '<request>'+
					'<name>client_state</name>'+
					'<command>add</command>'+
					'<client_state><state><idioma>'+idioma_sw+'</idioma></state></client_state>' +
					'</request>'+
	'<request>'+
					'<name>ace</name>'+
					'<format>xml</format>'+
				'</request>'+
				'<request>'+
					'<name>map</name>'+
					'<format>xml</format>'+
				'</request>';

//	var aStyleSheet = 'content_map.xsl';
	
   top.executeRequest(top.hcf_panel, aRequest); //, aStyleSheet);
    //top.executeRequest(top.hcf_content, aRequest, aStyleSheet);

	top.header.window.location.href = document.location.pathname + '?idioma=' + idioma_nv;
}

