<!--
var facetes=new Array();
function posiciona(vpos)
{

	if (top.fmenu.location.href.indexOf("#")<0)
	{
	top.fmenu.location.href=top.fmenu.location.href+"#"+vpos;
	}
	else
	{
	top.fmenu.location.href=top.fmenu.location.href.substring(0,top.fmenu.location.href.indexOf("#"))+"#"+vpos;
	}
}

function trimr(vstr)
{	
	if (vstr.substring(vstr.length-1,1)==' ' || vstr.charCodeAt(vstr.length-1)<33)
		vstr=trimr(vstr.substring(0,vstr.length-1));
	return vstr;
}
function trobats(vtrob)
{
	top.fcap.location.replace("/home/hec/sf/cap.html?menu="+escape(vtrob));
}

function menu_pos(vpos)
{
	top.fcap.location.replace("/home/hec/sf/cap_ll.html?menu="+vpos);

}

// seccions trobades (cos article, suplement, estructura, actualitat, arbre, vegeu, GGCC, Internet)

function troba(ind)
{
     indi=""+ind;

}

//capçaleres de secció
function separa(num)    
{
    if (ant==1) {document.write("</p></td></tr>");};
    if (indi.substring(num, num+1)=="1") 
    {
   txt="<tr><td valign=\"top\" width=\"100%\" bgcolor=\"#ffffff\"><p align=\"justify\">";
        if (ancores[num]!="")
        {
		txt=txt+ "<a name=\""+ ancores[num]+"\"></a>";
        }
        if (titols[num]!="")
        {
txt=txt+"<table width=\"100%\" border=0 cellpadding=0 cellspacing=0     ";
txt=txt+ "height=16><tr>";
txt=txt+ "<td valign=\"top\" class=\"titular"+ num +"\">" + titols[num]+"<br></td></tr></table>";
        }

     document.write(txt);
     ant=1;
    }
}


function escriu_iqua()
{
	////////////////////////////////////////////////////
	// segell de qualitat
	var lang1 = new Array(3);
	var lang2 = new Array(3);
	lang1[1] = "segell";
	lang2[1] = "L'Agència de la Qualitat d'Internet";
	lang1[2] = "sello";
	lang2[2] = "La Agencia de Calidad de Internet";
	lang1[3] = "seal";
	lang2[3] = "The Internet Quality Agency";
	var iqua_id=53;
	var iqua_lang=1;
	var dir_remoto="/home/jsp/imatges/";
	var striqua="<center><small><font color=\"#FFFFFF\" face=\"Verdana\"><strong>Segell de Qualitat:&nbsp;&nbsp;&nbsp;</strong></font></small><a href=\"http://www.iqua.net/segell/?id="+ iqua_id + "&lang=" + iqua_lang + "&url=" + escape(document.location.href) + "\" onclick=\"iqua_open(this.href,'iqua','600','450','no');return false;\"><img src=\""+dir_remoto+"segelliquafb.gif\" width=\"63\" height=\"49\" border=\"0\" alt=\"" + lang2[iqua_lang] + "\"></a></center>";


	
	
	document.write(striqua);
}

function iqua_open(mypage, myname, w, h, scroll) {
winl = (screen.width - w) / 2;
wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}


function parseqs(vqs, vkey)
{
	var vpos=0;
	var vfi=0;
	vkey=vkey+"=";
	if ((vpos=vqs.indexOf(vkey))>-1 && (vpos==0 || vqs.substring(vpos-1,vpos)=="&"))
	{
		vpos=vpos+vkey.length;
		vfi=vqs.indexOf("&",vpos);
		if (vfi<0)
			vfi=vqs.length;
		return vqs.substring(vpos,vfi);
	}
	return "";		
}

function traduc(vstr,vsbstr,vnsbstr)
{
	var vpos=0;
	
	while ((vpos=vstr.indexOf(vsbstr))>-1)
{
vstr=vstr.substring(0,vpos)+vnsbstr+vstr.substring(vpos+vsbstr.length);
}
return vstr;
}

strtop_t=top.location.href;
frase_cerca="";
if (strtop_t.indexOf("?")>-1)
{
qs_t=strtop_t.substring(strtop_t.indexOf("?")+1);
//qs_t=traduc(qs_t,"%26","&");
qs_t=traduc(qs_t,"+"," ");
qs_t=unescape(qs_t);

frase_cerca=parseqs(qs_t,"FRASE");
}

function recupera_cerca()
{
	document.write(frase_cerca);
}
function escr_patroc()
{

	if (usu=="XTC" || usu=="EDU" || usu.substring(0,4)=="xtec" || usu.substring(0,3)=="edu")
		document.write("<center><IMG SRC=\"/HOME/IMG2/LACAIXA.GIF\" BORDER=0></center>"); 

}
function escr_patroc2()
{

	if (usu.substring(0,2)=="b." || usu.substring(0,2)=="B." || usu.substring(0,6)=="gencat")
		document.write("<a href=\"http://www10.gencat.net/dursi/AppJava/home.jsp?area=0&idioma=\"><img src=\"/home/imgs/dursi_vert.jpg\" align=\"center\" border=\"1\" STYLE=\"border-color:#aaaaaa\"></a>");                                  
}
function obrefin(vfin)
{
window.open(vfin,"altres","width=600,height=400,location=no,toolbar=no,directories=no,menubar=no,resizable=YES,Scrollbars=YES,status=yes") 
}
function ffoto(vstr)
{
	window.open("http://www.grec.cat/cgibin/gec3cl2.pgm?"+vstr,"hecfoto","width=620,menubar=no,location=no,scrollbars=yes,resizable=yes");
}
function fquadre(vstr)
{
	window.open("http://www.grec.com/hiperenc/estaduni9.jsp?NDCHEC="+vstr,"estaduni","width=600,height=400,menubar=no,location=no,scrollbars=yes,resizable=yes");
}
function fquadre_HTM(vstr)
{
	window.open("http://www.grec.com/hiperenc/gran/"+vstr,"estaduni","width=600,height=400,menubar=no,location=no,scrollbars=yes,resizable=yes");
}

function mostra_img(vurl) 
{
img_g = new Image(); 
img_g.src=vurl;

ample=img_g.width;
alt=img_g.height;



var propietats="location=no,toolbars=no,width=" + ample + ",height=" +alt +",left=100,top=100,resizable=yes";
win=window.open("", "", propietats);
win.document.open();
win.document.write("<html><head><script>function resize(){if (document.images[0].width!=" + ample +" || document.images[0].height!="+ alt + ") window.resizeTo(document.images[0].width+10,document.images[0].height+10); }</script><title>foto gran</title><body  marginwidth=0 marginheight=0 topmargin=0 leftmargin=0><img src=\""+img_g.src+"\" onload=\"resize()\"></body></html>");
win.document.close();
}
function items(id)
{
	hideItems();
	var obj = document.getElementById('t' + id);
	if (obj.style.display == 'block')	obj.style.display = 'none';
	else								obj.style.display = 'block';
}

 function hideItems()
 {
	var titolVisible=0;
	if (window.titol)
		titolVisible=window.titol;
    list           = document.getElementById('sumari');
	if (window.list)
	{
		contenidors    = list.getElementsByTagName('div');
		numContenidors = contenidors.length;
    
		for (m=0; m < numContenidors; m++)
		{
			if (contenidors[m].id.indexOf('t') == 0 && contenidors[m].id!=('t'+titolVisible)) contenidors[m].style.display = 'none';
		}
	}

 }
 
  function activaFacetes()
 {
	var obj;
	for (var fac in facetes)
	{
		obj=document.getElementById(fac);
		if (obj.addEventListener)
			obj.addEventListener('click',function (e) { eClick=e; posicioFaceta();},true);
		else
			obj.attachEvent('onclick',	function () {eClick= new emula_event();posicioFaceta();});
	}
}
 
function posicioFaceta()
{
	var obj = top.document.getElementById('faceta');
	
	if (obj)
	{
		obj.style.display='none';
		mouObjA(eClick.pageX,eClick.pageY,obj);
	}
	
	var vndc=eClick.target.id;
	obj.style.display='block';
	faceta(vndc);

}
function faceta(vndc)
{
	var req = new XMLHttpRequest(); 
	if (req) { 
	req.onreadystatechange = function() {
			 if (req.readyState == 4 && (req.status == 200 || req.status == 304)) { var demo = document.getElementById('faceta'); demo.innerHTML=req.responseText; } };
		 req.open('GET', 'faceta.jsp?NDCHEC='+vndc);
		 req.send(null); 
	
	}

}


function emula_event()
{	
	this.which=window.event.button;
	this.pageX=window.event.clientX+document.body.scrollLeft;
	this.pageY=window.event.clientY+document.body.scrollTop;
	this.target=window.event.srcElement;
	this.target.id=window.event.srcElement.id;
}

function mouObjA(x,y,objecte)
{
	if (x < 0) x = 0;
	if (y < 0) y = 0;
	
	if (document.all || document.getElementById)
	{
		objecte.style.left = x;
		objecte.style.top  = y;
	}
	else
	{
		objecte.left = x;
		objecte.top = y;
	}
}
function amaga()
{
	var obj = top.document.getElementById('faceta');
	obj.style.display='none';
	obj.innerHTML="";
}
function novaFaceta(vfac)
{
	facetes[vfac]=true;
}
function iniFac()
{
	document.write("<table width=\"100%\"><tr><td class=\"SumariTitol\">");

}
function fiFac()
{
	document.write("<td align=\"right\"><a href=\"javascript:amaga()\"><img src=\"imgs/x.jpg\" border=\"0\"></a></td></tr></table>");
}

var arrossec=false;
function capa()
{
document.write("<SPAN ID=\"l1\"></SPAN>");
}
	


function mostraAltdef(vtxt)
{
	if (document.all)
	{
		document.all.l1.innerHTML="<table width=240 cellpadding=8 cellspacing=0 class=\"t_l1\"><tr><td><font face=\"Verdana\" size=-2>"+vtxt+"&nbsp;</font></td></tr></table>";
	}	
	else
	{
		if (document.getElementById)
			document.getElementById("l1").innerHTML="<table width=240 cellpadding=8 cellspacing=0 class=\"t_l1\"><tr><td><font face=\"Verdana\" size=-2>"+vtxt+"&nbsp;</font></td></tr></table>";
		else
		{
		document.layers["l1"].document.open();
		document.layers["l1"].document.write("<table width=240 cellpadding=8 cellspacing=0 class=\"t_l1\"><tr><td><font face=\"Verdana\" size=-2>"+vtxt+"&nbsp;</font></td></tr></table>");
		document.layers["l1"].document.close();
		}

	}
	// inicia moviment 
	activa_drag();
	
}
function amagaAltdef()
{
	if (document.all)
		document.all.l1.style.display="none";
	else
		if (document.getElementById)
			document.getElementById("l1").style.display="none";
		else
			document.layers["l1"].visibility="hide";
	desactiva_drag();
}


function activa_drag()
{
	if (arrossec==false)
	{
	if (!document.all)
		document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove=arrossega;


	arrossec=true;
	return true;
	}
	else return false;
}

function desactiva_drag()
{

	
	arrossec=false;
	if (!document.all)
		document.releaseEvents(Event.MOUSEMOVE);
	document.onmousemove=null;	
		
	return true;	
}


//------------------------------------------------------------------------------------------------------------------------
//  Moviment del layer
//
//------------------------------------------------------------------------------------------------------------------------



function arrossega(e)
{
	if (!e)
	{var e= new emula_event();
	}
		if (arrossec)
		{
			if (document.all)
				obj=document.all["l1"];
			else
				if (document.getElementById)
					obj=document.getElementById("l1");
				else
					obj=document.layers["l1"];
		var pos=new Array();
		pos=posicionaObj(obj,e.pageX,e.pageY);
		mouObjA(pos[0],pos[1],obj);
		if (document.all || document.getElementById)
		{
			if (obj.style.display!="block")
				obj.style.display="block";
		}
		else
		{
			if (obj.visibility!="show")
				obj.visibility="show";
		}
		return true;
		}
		else return false;
	
}


function posicionaObj(obj,x,y)
{

	var wh_body = new Array();
	wh_body     = mySize();
	var xy_scr = new Array();
	xy_scr     = getScrollXY();

	obj.style.display = 'block';
				
	var	w_div = obj.clientWidth+30;
	var	h_div = obj.clientHeight+30;

	if (x+w_div > wh_body[0]+xy_scr[0]) 
		x = wh_body[0]+xy_scr[0] - w_div;
				
	if (y+h_div > wh_body[1]+xy_scr[1])
		y = wh_body[1]+xy_scr[1] - h_div;
	return [x+5,y+12];
}



function mySize() 
{
  var myWidth = 0, myHeight = 0;
  
  if (typeof (window.innerWidth) == 'number') 
  {
    //Non-IE
    myWidth  = window.innerWidth;
    myHeight = window.innerHeight;
  } 
  else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) 
	{
		//IE 6+ in 'standards compliant mode'
		myWidth  = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} 
	else if (document.body && (document.body.clientWidth || document.body.clientHeight)) 
		{
			//IE 4 compatible
			myWidth  = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
  
    return [myWidth, myHeight];
}

function getScrollXY() 
{
  var scrOfX = 0, scrOfY = 0;

  if (typeof( window.pageYOffset ) == 'number') 
  {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } 
  else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) 
	{
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} 
	else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) 
		{
			//IE6 standards compliant mode
			scrOfY = document.documentElement.scrollTop;
			scrOfX = document.documentElement.scrollLeft;
		}
  
  return [scrOfX, scrOfY];
}





//-->