//----------------------------------------------------------------------------
//Definició de variables globals

//----------------------------------------------------------------------------
//Definició de funcions
function escriuData(idiom)
{
	var fecha=new Date();
	var diames=fecha.getDate();
	document.write(diames);
	mes=fecha.getMonth()
	if(mes==0) {
		if(idiom=='cat') document.write("-gener-");
		if(idiom=='esp') document.write("-enero-");
	}
	if(mes==1) {
		if(idiom=='cat') document.write("-febrer-");
		if(idiom=='esp') document.write("-febrero-");
	}
	if(mes==2) {
		if(idiom=='cat') document.write("-març-");
		if(idiom=='esp') document.write("-marzo-");
	}
	if(mes==3) {
		if(idiom=='cat') document.write("-abril-");
		if(idiom=='esp') document.write("-abril-");
	}
	if(mes==4) {
		if(idiom=='cat') document.write("-maig-");
		if(idiom=='esp') document.write("-mayo-");
	}
	if(mes==5) {
		if(idiom=='cat') document.write("-juny-");
		if(idiom=='esp') document.write("-junio-");
	}
	if(mes==6) {
		if(idiom=='cat') document.write("-juliol-");
		if(idiom=='esp') document.write("-julio-");
	}
	if(mes==7) {
		if(idiom=='cat') document.write("-agost-");
		if(idiom=='esp') document.write("-agosto-");
	}
	if(mes==8) {
		if(idiom=='cat') document.write("-setembre-");
		if(idiom=='esp') document.write("-septiembre-");
	}
	if(mes==9) {
		if(idiom=='cat') document.write("-octubre-");
		if(idiom=='esp') document.write("-octubre-");
	}
	if(mes==10) {
		if(idiom=='cat') document.write("-novembre-");
		if(idiom=='esp') document.write("-noviembre-");
	}
	if(mes==11) {
		if(idiom=='cat') document.write("-desembre-");
		if(idiom=='esp') document.write("-diciembre-");
	}
	var ano=fecha.getFullYear();
	document.write(ano);
}

/***********************************************************************
*	Funció per situar les capes segons els diferents navegadors
*	Paràmetre:
*		- nimatges: nombre total d'imatges
***********************************************************************/
function situarImatges(nimatges)
{
	var ie=(document.all) ? true:false;
	var ns6=(document.getElementById) ? true:false;
	var ns4=(document.layers) ? true:false;
/*	var xini = window.screen.left;
	var yini = window.screen.top;*/
	if (screen.width>1000)
		var xini = (250-nimatges*2);
	else
		var xini = (220-nimatges*2);
	var yini = (220-nimatges*3);
	var posx,posy;
	for(var i=0;i<nimatges;i++) {
		var nomcapa = "imatge" + i;
		posx = 10*i+xini;
		posy = 10*i+yini;
		var z = (nimatges - i);
		if (ie) {
			eval("document.all."+ nomcapa +".style.position='absolute'");
			eval("document.all."+ nomcapa +".style.left='"+ posx +"px'");
			eval("document.all."+ nomcapa +".style.top='"+ posy +"px'");
			eval("document.all."+ nomcapa +".style.width='220px'");
			eval("document.all."+ nomcapa +".style.zIndex='"+z+"'");
		}
		if (ns4) {
			eval("document.layers."+ nomcapa +".position='absolute'");
			eval("document.layers."+ nomcapa +".left='"+ posx +"px'");
			eval("document.layers."+ nomcapa +".top='"+ posy +"px'");
			eval("document.layers."+ nomcapa +".width='220px'");
			eval("document.layers."+ nomcapa +".zIndex='"+z+"'");
		}
		if (ns6 && !ie) {
			eval("document.getElementById('"+ nomcapa +"').style.position='absolute'");
			eval("document.getElementById('"+ nomcapa +"').style.left='"+ posx +"px'");
			eval("document.getElementById('"+ nomcapa +"').style.top='"+ posy +"px'");
			eval("document.getElementById('"+ nomcapa +"').style.width='220px'");
			eval("document.getElementById('"+ nomcapa +"').style.zIndex='"+z+"'");
		}
	}
}
/**********************************************************************
*	Funció que canvia l'ordre z(profunditat) de les capes que
*	contenen les imatges.
*	Paràmetres:
*		- iimatge: núm de la imatge que ha d'estar al davant.
*		- nimatges: nombre total d'imatges.
*
**********************************************************************/
function canviarOrdreImatges(iimatge,nimatges)
{
	var z=1;
	var t;
	var ie=(document.all) ? true:false;
	var ns6=(document.getElementById) ? true:false;
	var ns4=(document.layers) ? true:false;
	for(var i=nimatges-1;i>=iimatge;i--) {
		var nomcapa = "imatge" + i;
		z = (nimatges - i);
		if (ie) eval("document.all."+ nomcapa +".style.zIndex='"+z+"'");
		if (ns4) eval("document.layers."+ nomcapa +".zIndex='"+z+"'");
		if (ns6 && !ie) eval("document.getElementById('"+ nomcapa +"').style.zIndex='"+z+"'");
	}
	for(var j=0;j<iimatge+1;j++) {
		var nomcapa = "imatge" + j;
		t = (z + j);
		if (ie)	eval("document.all."+ nomcapa +".style.zIndex='"+t+"'");
		if (ns4) eval("document.layers."+ nomcapa +".zIndex='"+t+"'");
		if (ns6 && !ie) eval("document.getElementById('"+ nomcapa +"').style.zIndex='"+t+"'");
	}
}
/**********************************************************************
*	Funció que obre una finestra nova per mostrar una imatge
*	Paràmetres:
*		- fitxerImatge: fitxer de la imatge a mostrar.
*		- idiom: idioma actual del lloc
*
**********************************************************************/
function augmentarImatge(fitxerImatge,idiom)
{
	var caracteristiques = "directories=no,menubar=no,resizable=yes,status=no,toolbar=no,height=540,width=600,top=10,left=100,scrollbars=yes";
	window.open("mostrar_imatge.php?lang="+idiom+"&fimatge="+ fitxerImatge +"","",caracteristiques);
}
/**********************************************************************
*	Funció per dimensionar la finestra al màxim de la resolució de pantalla.
**********************************************************************/
function dimensionar_finestra() {
	var window_amplada = screen.availWidth;
	var window_alzada = screen.availHeight;
	self.resizeTo(window_amplada,window_alzada);
	self.moveTo(0,0);
	window.focus();
	return true;
}
/**********************************************************************
*	Funció per precarregar imatges per substitucions.
**********************************************************************/
function precarregaImatges() {
    impressora = new Image();
    impressora.src = "../imatges/print.gif";
    impressoraon = new Image();
    impressoraon.src = "../imatges/printon.gif";
}
/**********************************************************************
*	Funció per substituir la imatge de la impressora.
**********************************************************************/
function canviarPrinter(imgOriginal,imgSubs) {
    document.images[imgOriginal].src = eval(imgSubs + ".src")
}

