/* XMB20080721 Eliminades refs a .net */ /*IPP20090219 Poso SORT tot en majuscules */

// Definicio de variables per les capes textos urls etc via objectes (de javascript)
// via contructor function Capa(id,left,top,width,zindex,bcolor,lbcolor,esPare,idPare,textes,ids,menus,urls)

// Poblacio
var textes=new Array("Recuentos","Sexo, edad y estado civil","Naturaleza de la poblaci&oacute;n","Estudios de la poblaci&oacute;n", "Censo linguistico","Relaci&oacute;n con la actividad","Flujos","Hogares y familias","Movilidad espacial","Estimaciones","Proyecciones","Onom&aacute;stica");
var ids=new Array(20,21,22,23,24,25,26,27,28,29,290,291);
var localURL=new Array("es/poblacio/poblrecomptes.html","es/poblacio/poblestructura.html","es/poblacio/poblnaturalesa.html","es/poblacio/poblestudis.html","es/poblacio/poblcensling.html","es/poblacio/poblactivitat.html","es/poblacio/poblfluxos.html","es/poblacio/poblllarsfam.html","es/poblacio/poblmobilitat.html","es/poblacio/poblestimacions.html","es/poblacio/poblprojeccions.html","es/poblacio/poblonomast.html");
ArrayCapas[0]=new Capa(1,152,46,185,3,fons.pob,fons.pob,true,1,textes,ids,ids,localURL);
ArrayCapas[0].esPare=false;
// Economia
var textes=new Array("Macromagnitudes","Sector agrario","Industria","Construcci&oacute;n","Servicios","Consumo y econom&iacute;a de los hogares","Inversi&oacute;n","Trabajo","Precios y salarios","Turismo","Sector exterior","Sector p&uacute;blico","Sector financiero","Empresas","I+D, innovaci&oacute;n y TIC");
var ids=new Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
var localURL=new Array("es/economia/ecomacro.html","es/economia/ecoagrari.html","es/economia/ecoindust.html","es/economia/ecoconstr.html","es/economia/ecoserveis.html","es/economia/ecoconsum.html","es/economia/ecoinversio.html","es/economia/ecotreball.html","es/economia/ecopreus.html","es/economia/ecotur.html","es/economia/ecosectext.html","es/economia/ecosectpub.html","es/economia/ecosectfinanc.html","es/economia/ecoempreses.html","es/economia/ecormesd.html");
ArrayCapas[1]=new Capa(2,228,46,230,2,fons.eco,fons.eco,false,2,textes,ids,ids,localURL);
// Societat
var textes=new Array("Educaci&oacute;n","Trabajo","Calidad y condiciones de vida","Cultura, ocio y deportes","Lengua","Salud y bienestar social","Viviendas y edificios","Participaci&oacute;n ciudadana","Justicia y seguridad ciudadana","Medio ambiente","Protecci&oacute;n social","Sociedad de la informaci&oacute;n");
var ids=new Array(31,32,33,34,35,36,37,38,39,390,391,392);
var localURL=new Array("es/societat/soceduc.html","es/societat/soctreball.html","es/societat/socqualit.html","es/societat/soccult.html","es/societat/soclleng.html","es/societat/socsalut.html","es/societat/sochabitat.html","es/societat/socpartic.html","es/societat/socjustic.html","es/societat/socmedi.html","es/societat/socprotec.html","es/societat/socinfo.html");
ArrayCapas[2]=new Capa(3,301,46,210,4,fons.soc,fons.soc,false,3,textes,ids,ids,localURL);
// Territori
var textes=new Array("Base de datos de municipios","Base de datos inframunicipal","Fichas municipales","Fichas comarcales","Atlas de los Pirineos","C&oacute;digos territoriales");
var ids=new Array(40,41,42,43,45,46);
var localURL=new Array("bemcat/","territ/BasicTerr?TC=16","territ/BasicTerr?TC=1&V0=1&V1=MUNICIPI","territ/BasicTerr?TC=1&V0=1&V1=COM","http://atlas.ctp.org/site_es/index_es.php?lang=es","es/territori/codis/");
ArrayCapas[3]=new Capa(4,374,46,190,5,fons.ter,fons.ter,false,4,textes,ids,ids,localURL);
//Idescat
var textes=new Array("El organismo","Sistema estad&iacute;stico","Publicaciones","Biblioteca","Clasificaciones","Formaci&oacute;n e investigaci&oacute;n","Perfil del contratante","Webs de inter&eacute;s", "Novedades");
var menus=new Array(51,52,53,54,56,57,59,58,55);
var ids=new Array(51,52,53,54,56,57,59,58,55);
var localURL=new Array("#","#","es/idescat/publicacions/cataleg/","es/idescat/biblioteca/","es/idescat/classif/","#","es/idescat/organisme/contractacio.html","es/idescat/altreswebs/","novetats/?lang=es");
ArrayCapas[4]=new Capa(5,447,46,180,6,fons.ide,fons.ide,true,5,textes,ids,menus,localURL);

// Menus de segon nivell pare idescat
var textes=new Array("Presentaci&oacute;n","Organizaci&oacute;n","Memoria","D&oacute;nde estamos");
var ids=new Array(5101,5102,5106,5103);
var localURL=new Array("es/idescat/organisme/presenta.html","es/idescat/organisme/organitz.html","es/idescat/organisme/memoria.html","es/idescat/organisme/on_som.html");
ArrayCapas[5]=new Capa(51,275,46,172,84,fons.ide,fons.ide,false,5,textes,ids,menus,localURL);

var textes=new Array("Legislaci&oacute;n","Plan estad&iacute;stico y programas","Ciudadanos");
var ids=new Array(5201,5202,5204);
var localURL=new Array("es/idescat/sistemaestadistic/legislacio/","es/idescat/sistemaestadistic/plaestadistic/","es/idescat/sistemaestadistic/ciutadans/");
ArrayCapas[6]=new Capa(52,247,60,200,71,fons.ide,fons.ide,false,5,textes,ids,menus,localURL);

var textes=new Array("Formaci&oacute;n y promoci&oacute;n","Proyectos de investigaci&oacute;n","Revista SORT");
var ids=new Array(5601,5602,5603);
var localURL=new Array("es/idescat/formaciorecerca/formacio/","es/idescat/formaciorecerca/recerca/recerca.html","sort/");
ArrayCapas[7]=new Capa(57,262,110,185,59,fons.ide,fons.ide,false,5,textes,ids,menus,localURL);

// Final de dades

var actual = 0;
var cambio = 0;
var actual2 = 0;
var ie = (document.all)? true:false;
var imgActual=0;
var imgActual2=0;
var on = new Array(1);
var off = new Array(1);
off[0] = new Image();
off[0].src=host+"/images/fletxa_02_eco.gif";
on[0] = new Image();
on[0].src=host+"/images/fletxa_02_ecob.gif";
function cambiaImg(cual) {
if(imgActual){
eval("document.images['cat_" + imgActual + "'].src = off[0].src");
}
eval("document.images['cat_" + cual + "'].src = on[0].src");
imgActual = cual;
}
function cambiaImg2(cual) {
if(imgActual2){
eval("document.images['cat_" + imgActual2 + "'].src = off[0].src");
}
eval("document.images['cat_" + cual + "'].src = on[0].src");
imgActual2 = cual;
}
function cambiaMenu(cambio) {
if (cambio) {
if( actual ){
MM_showHideLayers('DIV'+actual,'','hide');
}
if(cambio != 56 && cambio!=520 && cambio!=55 && cambio!=58 && cambio!=54 && cambio!=53)MM_showHideLayers('DIV'+cambio,'','show');
actual = cambio;
if(imgActual2){
eval("document.images['cat_" + imgActual2 + "'].src = off[0].src");
}
}
}
function cambiaPrincipal(cambio) {
if (cambio) {
if( actual ){
MM_showHideLayers('DIV'+actual,'','hide');
}
if( actual2 ){
MM_showHideLayers('DIV'+actual2,'','hide');
}
MM_showHideLayers('DIV'+cambio,'','show');
}
actual2 = cambio;
actual=0;
if(imgActual){
eval("document.images['cat_" + imgActual + "'].src = off[0].src");
}
}
function fueraMenus(){
if( actual ){
MM_showHideLayers('DIV'+actual,'','hide');
}
if( actual2 ){
MM_showHideLayers('DIV'+actual2,'','hide');
}
}
function showMenu(cambio, cambio2){
MM_showHideLayers('DIV'+cambio,'','show');
if( cambio2 ){
MM_showHideLayers('DIV'+cambio2,'','show');
}
}
function show2Menu(cambio){
MM_showHideLayers('DIV'+cambio,'','show');
if( actual ){
MM_showHideLayers('DIV'+actual,'','show');}
}
function init() {
	cambio = 1;
}
function creaCapa(capa)
{
	document.write("<div id=\"DIV"+capa.id+"\" style=\"position:absolute; left:"+capa.left+"px; top:"+capa.top+"px; width:"+capa.width+"px;  z-index:"+capa.zindex+"; background-color: "+capa.bcolor+"; layer-background-color: "+capa.lbcolor+"; border: 1px none #000000; visibility: hidden\" onmouseout=\"fueraMenus()\"  onmouseOver=\""+capa.fevento+"\" >"); 
	document.write("<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">"); 
	document.write("&nbsp;<BR>");
	if(! capa.esPare){
		for(var k=0; k < capa.textes.length; k++)
		{
			document.write("&nbsp;<img src=\""+host+"/images/fletxa_02_eco.gif\" width=\"11\" height=\"10\" name=\"cat_"+capa.ids[k]+"\"><a href=\""+capa.urls[k]+"\" onMouseOver=\"cambiaImg2("+capa.ids[k]+");\" class=\"ib\">"+capa.textes[k]+"</a>&nbsp;<br>");
		}
	}else{
		for(var k=0; k < capa.textes.length; k++)
		{
		   if(capa.ids[k] != 56 && capa.ids[k]!=520 && capa.ids[k]!=55 && capa.ids[k]!=59 && capa.ids[k]!=58 && capa.ids[k]!=54 && capa.ids[k]!=53)
				document.write("&nbsp;<img src=\""+host+"/images/fletxa_02_eco.gif\" width=\"11\" height=\"10\" name=\"cat_"+capa.ids[k]+"\"><a href=\"javascript:void(null)\" onMouseOver=\"cambiaMenu("+capa.menus[k]+");cambiaImg("+capa.ids[k]+");\" class=\"ib\">"+capa.textes[k]+"</a>&nbsp;<br>");
		   else 
				document.write("&nbsp;<img src=\""+host+"/images/fletxa_02_eco.gif\" width=\"11\" height=\"10\" name=\"cat_"+capa.ids[k]+"\"><a href=\""+capa.urls[k]+"\" onMouseOver=\"cambiaMenu("+capa.menus[k]+");cambiaImg("+capa.ids[k]+");\" class=\"ib\">"+capa.textes[k]+"</a>&nbsp;<br>");
		}
	}
	document.write("&nbsp;<BR>");
	document.write("</font></div>");
}
function Capa(id,left,top,width,zindex,bcolor,lbcolor,esPare,idPare,textes,ids,menus,urls)
{
   this.id=id;
   this.left=left;
   this.top=top;
   this.width=width;
   this.zindex=zindex;
   this.bcolor=bcolor;
   this.lbcolor=lbcolor;
   this.esPare=esPare;
   this.idPare=idPare;
   if(this.esPare == true)this.fevento="show2Menu("+this.id+")";
   else this.fevento="showMenu("+""+this.idPare+","+this.id+")";
   this.textes=textes;
   this.menus=menus;
   this.ids=ids;
   for ( i=0; i < urls.length; i++)
   {
      if(urls[i].indexOf("http") == -1&&urls[i].indexOf("abrirVentana")==-1)urls[i]=host+"/"+urls[i];
   }
      this.urls=urls;
}

function creaMenu(elTitol,trads) {
	//temporalment
	if (typeof trads=="undefined"){ trads=guess(elTitol); }

	var idiomes=Idiomes(trads);
	document.write("<div id=\"NavegacioJS\">"+idiomes+"<form action=\""+host+"/cercador/\"><a id=\"adalt\"></a><img src=\""+host+"/images/pix_transp.gif\" width=\"760\" height=\"20\" alt=\"\">");
	document.write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr align=\"left\" valign=\"bottom\">"); 
	document.write("<td><img src=\""+host+"/images/pix_transp.gif\" width=\"20\" height=\"26\" alt=\"\"></td>");
	document.write("<td><a href=\""+host+"/es/\" ><img src=\""+host+"/images/logo_Idescat_nostre_petit.gif\" width=\"120\" height=\"26\" alt=\"Idescat.cat\" title=\"\" border=\"0\"></a></td>");
	document.write("<td><img src=\""+host+"/images/pix_transp.gif\" width=\"12\" height=\"26\" alt=\"\"></td>");
	document.write("<td><a href=\"javascript:void(null)\" onMouseOver=\"cambiaPrincipal(1)\" onMouseOut=\"fueraMenus()\"><img src=\""+host+"/images/bot_petit_pobcast.png\" width=\"71\" height=\"14\" alt=\"Poblaci&oacute;n\" title=\"\" border=\"0\" alt=\"\"></a></td>");
	document.write("<td><img src=\""+host+"/images/pix_transp.gif\" width=\"5\" height=\"26\" alt=\"\"></td>");
	document.write("<td><a href=\"javascript:void(null)\" onMouseOver=\"cambiaPrincipal(2)\" onMouseOut=\"fueraMenus()\"><img src=\""+host+"/images/bot_petit_ecocast.png\" width=\"68\" height=\"14\" alt=\"Econom&iacute;a\" title=\"\" border=\"0\"></a></td>");
	document.write("<td><img src=\""+host+"/images/pix_transp.gif\" width=\"5\" height=\"26\" alt=\"\"></td>");
	document.write("<td><a href=\"javascript:void(null)\" onMouseOver=\"cambiaPrincipal(3)\" onMouseOut=\"fueraMenus()\"><img src=\""+host+"/images/bot_petit_soccast.png\" width=\"68\" height=\"14\" alt=\"Sociedad\" title=\"\" border=\"0\"></a></td>");
	document.write("<td><img src=\""+host+"/images/pix_transp.gif\" width=\"5\" height=\"26\" alt=\"\"></td>");
	document.write("<td><a href=\"javascript:void(null)\" onMouseOver=\"cambiaPrincipal(4)\" onMouseOut=\"fueraMenus()\"><img src=\""+host+"/images/bot_petit_terrcast.png\" width=\"68\" height=\"14\" alt=\"Territorio\" title=\"\" border=\"0\"></a></td>");
	document.write("<td><img src=\""+host+"/images/pix_transp.gif\" width=\"5\" height=\"26\" alt=\"\"></td>");
	document.write("<td><a href=\"javascript:void(null)\" onMouseOver=\"cambiaPrincipal(5)\" onMouseOut=\"fueraMenus()\"><img src=\""+host+"/images/bot_petit_idescat.png\" width=\"68\" height=\"14\" alt=\"Idescat\" title=\"\" border=\"0\"></a></td>");
	document.write("<td><img src=\""+host+"/images/pix_transp.gif\" width=\"5\" height=\"26\" alt=\"\"></td>");
	document.write("<td><a href=\""+host+"/es/mapa.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('Image31','','"+host+"/images/bot_dalt_mapa_dins_on.gif',1)\"><img name=\"Image31\" border=\"0\" src=\""+host+"/images/bot_dalt_mapa_dins.gif\" width=\"68\" height=\"14\" alt=\"mapa web\" title=\"\"></a></td>");
	document.write("<td><img src=\""+host+"/images/pix_transp.gif\" width=\"5\" height=\"26\" alt=\"\"></td>");
	document.write("<td><a href=\""+host+"/es/idescat/serveis/consultans.html?ref="+encodeURIComponent(url)+"\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('Image32','','"+host+"/images/bot_consult2cast_on.gif',1)\"><img name=\"Image32\" border=\"0\" src=\""+host+"/images/bot_consult2cast.gif\" width=\"68\" height=\"14\" alt=\"cons&uacute;ltanos\" title=\"\"></a></td>");
	document.write("<td><img src=\""+host+"/images/pix_transp.gif\" width=\"4\" height=\"26\" alt=\"\"></td>");
	document.write("<td><input type=\"text\" name=\"q\" size=\"10\" id=\"MotsCerca\"><input type=\"hidden\" name=\"lang\" value=\"es\"></td>");
	document.write("<td><img src=\""+host+"/images/pix_transp.gif\" width=\"4\" height=\"26\" alt=\"\"></td>");
	document.write("<td><input id=\"Image30\" type=\"image\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('Image30','','"+host+"/images/lupa_on.gif',1)\" border=\"0\" src=\""+host+"/images/lupa_of.gif\" width=\"18\" height=\"14\" alt=\"buscar\" title=\"buscar\"></td>");
	document.write("</tr></table>");
	document.write("<img src=\""+host+"/images/pix_transp.gif\" width=\"760\" height=\"20\" alt=\"\"></form></div>");
	for(var i=0; i < ArrayCapas.length; i++){creaCapa(ArrayCapas[i]);}
}

function demandes(){
	win=window.open("http://demandes.idescat.cat/serviceweb/consultans_esp.jsp","Demandas","scrollbars=1,resizable=1");
	win.window.focus();
}

function Idiomes(trads){
	if (typeof trads=="undefined" || trads==0){ return ""; }
	var EnllacCA, EnllacEN;	
	var jo=url.replace(/&/g,"&amp;");
	jo = jo.replace(/#(.*)$/,"");
	var par="lang";

	if(jo.indexOf("/es/") > -1){
		EnllacCA = 	jo.replace("/es/","/cat/");
		EnllacEN = 	jo.replace("/es/","/en/");
	}else{
		if (jo.indexOf("http://biblio.idescat.cat")>-1){ // biblio
			par="lng";
		}
		if (jo.indexOf(par+"=es")==-1){ return ""; } // per seguretat
		EnllacCA = 	jo.replace(par+"=es",par+"=ca");
		EnllacEN = 	jo.replace(par+"=es",par+"=en");
	}

	EnllacCA=blanqueig(EnllacCA,par);

	if (trads>1){
		return "<div id=\"Idiomes\"><a href=\""+EnllacCA+"\" tabindex=\"1\" hreflang=\"ca\">Catal&agrave;</a> | Castellano | <a href=\""+EnllacEN+"\" tabindex=\"3\" title=\"This page is completely or partially translated into English\" hreflang=\"en\">English</a></div>";
	}else{
		return "<div id=\"Idiomes\"><a href=\""+EnllacCA+"\" tabindex=\"1\" hreflang=\"ca\">Catal&agrave;</a> | Castellano</div>";
	}
}