//mostrar idiomas
function mostrarIdiomas(idiActual){
	switch (idiActual){
		case 'es':
			document.getElementById('en').style.display = 'block';
			document.getElementById('ct').style.display = 'block';
			break;
		case 'ct':
			document.getElementById('es').style.display = 'block';
			document.getElementById('en').style.display = 'block';
			break;
		case 'en':
			document.getElementById('es').style.display = 'block';
			document.getElementById('ct').style.display = 'block';
			break;
	}
	document.getElementById('idiomas').style.backgroundPosition = 'left top';
}

//ocultar idiomas
function ocultarIdiomas(idiActual){
	switch (idiActual){
		case 'es':
			document.getElementById('en').style.display = 'none';
			document.getElementById('ct').style.display = 'none';
			break;
		case 'ct':
			document.getElementById('es').style.display = 'none';
			document.getElementById('en').style.display = 'none';
			break;
		case 'en':
			document.getElementById('es').style.display = 'none';
			document.getElementById('ct').style.display = 'none';
			break;
	}
	document.getElementById('idiomas').style.backgroundPosition = '0 -48px';
}

//canvi d'idioma
function wmsCambioIdioma(idiCambio){
   var newPath="";
   var path=window.location.pathname;
   var ini=window.location.protocol+"//"+window.location.host;
   var fin="";

   if (window.location.hash!=""){
       fin+=window.location.hash;
   }

   if (window.location.search!=""){
       fin+=window.location.search;
   }

   if (path.indexOf(".")!=-1) {
       var pArray=path.split(".");
       var darrer=pArray.length-1;

       if (pArray[darrer-1].length==2){
           pArray[darrer-1]=idiCambio;
       }else{
           pArray[darrer]=idiCambio+'.'+pArray[darrer];
       }

       newPath=pArray.join(".");

   }else{

       if (path.charAt(path.length-1)!="/"){
           barra="/";
       }else{
           barra="";
       }

       newPath=path+barra+"index."+idiCambio+".html";

   }

   window.location.href=ini+newPath+fin;
}

//escribe una direccion de correo
function escribeMail( nom, dom, etiqueta){

    if (!etiqueta ){
        etiqueta = nom+'@'+dom;
    }
    document.write( '<a hr'+'ef="mai'+'lto:'+nom+'@'+dom+'">'+etiqueta+'</a>' );
}


