function idioma(){
	// Buscamos la subcadena ".xx.html" para extraer el idioma.
	var i=location.href.search(/\...\.html$/)+1;
	
	// Devolvemos el idioma. Si no existe, el idioma por defecto es el espaņol.
	return (i==0) ? 'es' : location.href.substring( i, i+2 );
}

function escribeSelector(){
	var idActual=idioma();
	var idiomas=new Array('fr','de','en','es');
	var SEPARADOR='<td width="5"><img src="/img/sp.gif" width="5" height="1" border="0"></td>';		
	var estado,width,height;	
	var html='';
	html+='<div id="selectorIdioma">';
	html+='<table cellspacing="0" cellpadding="0" border="0"><tr>';
	
	for( var i=0; i < idiomas.length; i++ ){
		estado = ( idiomas[i]==idActual ) ? 'on' : 'off';

		if( i != 0 )html+=SEPARADOR;
		
		html+='<td valign="top">';
		if( estado == 'off' ){
			width='11';
			height='9';
			html+='<a href="javascript:wmsCambioIdioma(\''+idiomas[i]+'\')">';
		}
		else{
			width='18';
			height='16';
		}
		html+='<img src="img/band_'+idiomas[i]+'_'+estado+'.gif" width="'+width+'" height="'+height+'" border="0">';
		if( estado=='off' ){
			html+='</a>';
		}
		html+='</td>';	
	}
	
	html+='</tr></table>';
	html+='</div>';
	document.write( html );			
}