// JavaScript Document

function Salta(value, domain, path, planaweb) {
  var name = "Idioma";
  var expires ="";
  var secure = "";

  var curCookie = name + "=" + escape(value) +
	  ((expires) ? "; expires=" + expires.toGMTString() : "") +
	  ((path) ? "; path=" + path : "") +
	  ((domain) ? "; domain= " + domain : "") +
	  ((secure) ? "; secure" : "");
  document.cookie = curCookie;

top.location.href = "http://"+domain+path+"/"+planaweb;
}

// Apareixer i desapareixer capas PERGAMI, menú dreta

var capa_en_curso='capa0';
var antiga_capa_en_curso='capa0';
var Titolcapa= new Array();
var NumCapas = 40;

for(j=0;j<NumCapas; j++)
	Titolcapa[j]='capa'+j;


function MostrarCapa(i) { //v3.0
/*afegit per a softecnia, fem apareixer la capa  */
var capa= new Array();

if (Titolcapa[i] != capa_en_curso)
	{

	IE7=false;

	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))  //test for MSIE x.x;
		{
		var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
		if (ieversion>=7)
			{IE7 = true;}
		}	
	
	
	for(j=0;j<NumCapas; j++)
		{
		capa[j]=document.getElementById(Titolcapa[j]);
	
		if (Titolcapa[j] != capa_en_curso)
			{	
			capa[j].style.visibility='hidden';   //amagem les no actives
			}
		 else
			{// activem la capa en curso
	//		capa[j].style.visibility='visible';
			if (!IE7) capa[j].style.filter = "alpha(Opacity=100)"; // ??	
	//		capa[j].style.filter = "alpha(Opacity=100)";	
			if (!IE7) capa[j].style.opacity =  1;	
			capa[j].style.visibility='visible';  //ho fa dues vegades ??

			capa_en_curso = Titolcapa[j]; // ??
			}
		}
				
	// tractem la capa triada 
	
	if (!IE7) capa[i].style.filter = "alpha(Opacity=0)";	
	if (!IE7) capa[i].style.opacity =  0;	
	capa[i].style.visibility='visible';
		
	antiga_capa_en_curso = capa_en_curso;
	capa_en_curso = Titolcapa[i];  // canviem la capa en curso
	
	desapareixer(antiga_capa_en_curso, 100);
	apareixer(capa_en_curso,0);
	}
}

function desapareixer(ID, Opacity)
{

objecte=document.getElementById(ID);

IE7=false;
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))
	{ //test for MSIE x.x;
 	var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
 	if (ieversion==7)
		{
		IE7 = true;
		}
	}	

if (ID==antiga_capa_en_curso)
	{
	if (Opacity>=0 && !IE7)
		{
		objecte.style.filter = "alpha(Opacity=" + Opacity + ")";	
		objecte.style.opacity =  Opacity/100;	
		Opacity-=10;
		the_timeout = setTimeout("desapareixer('"+ID +"', " + Opacity + ");", 20);
		}
	else
		{
		if (!IE7) objecte.style.filter = "alpha(Opacity=0)";	
		if (!IE7) objecte.style.opacity =  0;	
		objecte.style.visibility='hidden';
		}	
	}
else
	{
	if (!IE7) objecte.style.filter = "alpha(Opacity=0)";	
	if (!IE7) objecte.style.opacity =  0;	
	objecte.style.visibility='hidden';
	}	
}

function apareixer(ID, Opacity)
{
objecte=document.getElementById(ID);

IE7=false;
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))
	{ //test for MSIE x.x;
 	var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
 	if (ieversion==7) 
		{
		IE7 = true;
		}
	}	

if (ID==capa_en_curso)
	{
	if ((Opacity<100) && !IE7)
		{
		objecte.style.filter = "alpha(Opacity=" + Opacity + ")";	
		objecte.style.opacity =  Opacity/100;	
		Opacity+=10;
		the_timeout = setTimeout("apareixer('"+ID+"' , " + Opacity + ");", 20);
		}
	else
		{
		if (!IE7) objecte.style.filter = "alpha(Opacity=100)";	
		if (!IE7) objecte.style.opacity =  1;	
		}	
	}
else
	{ // ha cambiado la capa, desaparecer 
	if (!IE7) objecte.style.filter = "alpha(Opacity=0)";	
	if (!IE7) objecte.style.opacity =  0;	
	objecte.style.visibility='hidden';
	}	
}


