 /////////////////////////////////////////////////////////////////
// variables que fixen origen i amplitud dels layers
//

posx=0; //origen x
posy=80;
ampx=0;
iniy=80;
inix=0;

incy=20; //increment y
incx=190; //increment x
ampy=0; //offset y

text_postbanners="";
/////////////////////////////////////////////////////////////////
// construeix cada item del menu
//    propietats:
//		estilc - fixa els colors de txt, on i off
//		estilt - fixa les propietats del mida i tipus de txt
//		txt    - text a ensenyar
//		lnk    - enllaç on porta (si no n'ha de tenir -> "")
//

function menu_item(codi_estilc, codi_estilt,text,enllac)
{
	this.estilc=codi_estilc;
	this.estilt=codi_estilt;
	this.txt=text;
	this.lnk=enllac;
	this.posx=0;
	this.posy=0;	
}

function estilst_tipus(vnom,vtxt,vini,vcolor,vinvcolor)
{
	this.nom=vnom;
	this.txt=vtxt;
	this.ini=vini;
	this.bgcolor=vcolor;
	this.invcolor=vinvcolor;
}





////////////////////////////////////////////////////////////////////////
// Crea les array dels estils de color i de text
//

estils_t=new Array();
estils_t["nivell1"]= new estilst_tipus("nivell1","font-size: 13px; font-family: Verdana; font-weight: bold; color:#333333; ","<img src=\"/home/jsp/imatges/1x1.gif\" width=2 height=19 align=left valign=center>","#f6d286","#f4e1ba");
estils_t["nivell2"]= new estilst_tipus("nivell2","font-size: 12px; font-family: Verdana; color:#333333; ","<img src=\"/home/jsp/imatges/1x1.gif\" width=10 height=19 align=left valign=center>","#f6d286","#f4e1ba");
estils_t["nivell1c"]= new estilst_tipus("nivell1c","font-size: 13px; font-family: Verdana; font-weight: bold; color:#333333;","<img src=\"/home/jsp/imatges/1x1.gif\" width=2 height=19 align=left valign=center>","dadada","#ffffff");
estils_t["nivell2c"]= new estilst_tipus("nivell2c","font-size: 12px; font-family: Verdana; color:#333333;","<img src=\"/home/jsp/imatges/1x1.gif\" width=10 height=19 align=left valign=center>","#f0f0f0","#ffffff");

/////////////////////////////////////////////////////////////////
// construeix els banners 
//
 
base=new Date();
num=base.getTime()*base.getSeconds();
lit=""+num;
lit2=lit.substring(0,12);


function escriu2()

{

 text="<a href=\"/cgibin/bannerccl.pgm?ONVA="+lit2;
 text=text+"\"><img srC=\"/cgibin/bannerimg.pgm?CODI="+lit2;
 text=text+"\" WIDTH=470 HEIGHT=60 ALIGN=BOTTOM BORDER=0 NATURALSIZEFLAG=3></a>";
 return text;

}

function escriu()

{
 text="<IFRAME WIDTH=468 HEIGHT=60 NORESIZE SCROLLING=No FRAMEBORDER=0 MARGINHEIGHT=0 ";
 text=text+" MARGINWIDTH=0 SRC=\"http://adforce.imgis.com/?adiframe|2.0|44|107672|1|1|MISC=";
 text=text+lit2+";\"><A HREF=\"http://adforce.imgis.com/?adlink|2.0|44|107672|1|1|MISC=";
 text=text+lit2+";loc=300;\" target=_top><IMG SRC=\"http://adforce.imgis.com/?adserv";
 text=text+"|2.0|44|107672|1|1|MISC="+lit2+";loc=300;\" BORDER=0 WIDTH=468 ";
 text=text+ " HEIGHT=60></A></IFRAME>"
 return text;
}



//102


////////////////////////////////////////////////////////////////
// escriu els diferents estils que calen pels layers
//
//

function escriu_estils()
{
var longitud=1;

str="<STYLE TYPE=\"text/css\">";

for(field2 in estils_t)
{	
str=str+ "\n";

str=str+ "."+estils_t[field2].nom+"{";
str=str+"background-color: "+estils_t[field2].bgcolor+";"+estils_t[field2].txt+"}\n";

}

document.write(str);

str="";
for(field2 in estils_t)
{	
str=str+ "\n";

str=str+ "."+estils_t[field2].nom+"t{";
str=str+estils_t[field2].txt+"}\n";

}
document.write(str);
str="";
ampy=incy*longitud;
if (document.all || document.getElementById)
{
str=str+ "\n#cist{display: show; position:absolute; top:40;left:0;color:#ffffff;font-family:Verdana;font-size:10pt;font-weight:bold;}\n"; 
}
else
{
str=str+ "\n#cist{visibility: show; position:absolute; top:40;left:0;color:#ffffff;font-family:Verdana;font-size:10pt;font-weight:bold;}\n"; 
}
if (document.all || document.getElementById)
{
str=str+ "\n#cist_scroll{display: show; position:absolute; top:0;left:0;color:#ffffff;font-family:Verdana;font-size:10pt;font-weight:bold;z-index:20}\n"; 
}
else
{
str=str+ "\n#cist_scroll{visibility: show; position:absolute; top:0;left:0;color:#ffffff;font-family:Verdana;font-size:10pt;font-weight:bold;z-index:20}\n"; 
}
if (document.all || document.getElementById)
{
str=str+ "\n#llistat{display: show; position:absolute;}\n"; 
}
else
{
str=str+ "\n#llista{visibility: show; position:absolute;}\n"; 
}

if (document.all || document.getElementById)
{
str=str+ "\n#mllnk2{display: show; position:absolute; top: "; 
}
else
{
str=str+ "\n#mllnk2{visibility: show; position:absolute; top: "; 
}
str=str+iniy+ ";left: "+ posx+";z-index: 10;width:"+incx+";height:"+ampy+";}\n";
if (document.all || document.getElementById)
{
str=str+ "\n#mllnk3{display: show; position:absolute; top: "; 
}
else
{
str=str+ "\n#mllnk3{visibility: show; position:absolute; top: "; 
}
str=str+iniy+ ";left: "+ posx+";z-index: 17;width:"+incx+";height:"+ampy+";}\n";
if (document.all || document.getElementById)
{
str=str+ "\n#mllnk{display: show; position:absolute; top: "; 
}
else
{
str=str+ "\n#mllnk{visibility: show; position:absolute; top: "; 
}
str=str+iniy+ ";left: "+ posx+";z-index: 20;width:"+incx+";height:"+ampy+";}\n";

if (document.all || document.getElementById)
{
str=str+ "\n#mllnk2s{display: show; position:absolute; top: "; 
}
else
{
str=str+ "\n#mllnk2s{visibility: show; position:absolute; top: "; 
}
str=str+"0"+ ";left:0;z-index: 10;width:"+incx+";height:"+ampy+";}\n";
if (document.all || document.getElementById)
{
str=str+ "\n#mllnk3s{display: show; position:absolute; top: "; 
}
else
{
str=str+ "\n#mllnk3s{visibility: show; position:absolute; top: "; 
}
str=str+"0;left:0;z-index: 17;width:"+incx+";height:"+ampy+";}\n";
if (document.all || document.getElementById)
{
str=str+ "\n#mllnks{display: show; position:absolute; top: "; 
}
else
{
str=str+ "\n#mllnks{visibility: show; position:absolute; top: "; 
}
str=str+"0;left:-5;z-index: 20;width:"+incx+";height:"+ampy+";}\n";
if (document.all || document.getElementById)
{
str=str+ "\n#mobil {display: none; position:absolute; top: 0;left:0;"; 
}
else
{
str=str+"\n#mobil {visibility: hide;position:absolute;top:0;left:0;"; 
}


str=str+"z-index: 15;width:"+incx+";height:"+incy+";background-color: #7cb1a1; layer-background-color: #7cb1a1}\n";
if (document.all || document.getElementById)
{
str=str+ "\n#mobil0 {display: none; position:absolute; top: 0;left:0;"; 
}
else
{
str=str+"\n#mobil0 {visibility: hide;position:absolute;top:0;left:0;"; 
}


str=str+"z-index: 15;width:"+incx+";height:"+incy+";background-color: #7cb1a1; layer-background-color: #7cb1a1}\n";
if (document.all || document.getElementById)
{
str=str+ "\n#mobil1 {display: none; position:absolute; top: 0;left:0;"; 
}
else
{
str=str+"\n#mobil1 {visibility: hide;position:absolute;top:0;left:0;"; 
}


str=str+"z-index: 15;width:"+incx+";height:"+incy+";background-color: #7cb1a1; layer-background-color: #7cb1a1}\n";
if (document.all || document.getElementById)
{
str=str+ "\n#mobil2 {display: none; position:absolute; top: 0;left:0;"; 
}
else
{
str=str+"\n#mobil2 {visibility: hide;position:absolute;top:0;left:0;"; 
}


str=str+"z-index: 15;width:"+incx+";height:"+incy+";background-color: #7cb1a1; layer-background-color: #7cb1a1}\n";
if (document.all || document.getElementById)
{
str=str+ "\n#mobil3 {display: none; position:absolute; top: 0;left:0;"; 
}
else
{
str=str+"\n#mobil3 {visibility: hide;position:absolute;top:0;left:0;"; 
}


str=str+"z-index: 15;width:"+incx+";height:"+incy+";background-color: #7cb1a1; layer-background-color: #7cb1a1}\n";


posb=iniy+(incy+1)*longitud+20;

if (document.all || document.getElementById)
{
str=str+ "\n#submenu0 {display: none; position:absolute; top: 0;left:0;cursor:'auto';}\n"; 
}
else
{
str=str+"\n#submenu0 {visibility: hide;position:absolute;top:0;left:0;}\n"; 
}
if (document.all || document.getElementById)
{
str=str+ "\n#submenu1 {display: none; position:absolute; top: 0;left:0;}\n"; 
}
else
{
str=str+"\n#submenu1 {visibility: hide;position:absolute;top:0;left:0;}\n"; 
}
if (document.all || document.getElementById)
{
str=str+ "\n#submenu2 {display: none; position:absolute; top: 0;left:0;}\n"; 
}
else
{
str=str+"\n#submenu2 {visibility: hide;position:absolute;top:0;left:0;}\n"; 
}
if (document.all || document.getElementById)
{
str=str+ "\n#submenu3 {display: none; position:absolute; top: 0;left:0;}\n"; 
}
else
{
str=str+"\n#submenu3 {visibility: hide;position:absolute;top:0;left:0;}\n"; 
}

//////////
// atenció -- estils del layer de banners
/////////
if (document.all || document.getElementById)
{
str=str+ "\n#colesq {display: block; position:absolute; top:"; 
}
else
{
str=str+"\n#colesq {visibility: show;position:absolute;top:";
}

//////////
// atenció -- fi  estils del layer de banners
/////////



str=str+posb+";left:0;z-index: 6;width:240;background-color: #1b6c51; layer-background-color: #f6d286;color: #ffffff}\n";
if (document.all || document.getElementById)
{
str=str+ "\n#taula {display: none; position:absolute; top: 61;left:239;"; 
}
else
{
str=str+"\n#taula {visibility: hide;position:absolute;top:61;left:239;"; 
}

str=str+"z-index:5;width:190;height:55;background-color: #1b6c51; layer-background-color: #1b6c51}\n</STYLE>";

document.write(str);


}


function escriu_submenu(vimenu)
{
var vmenu=top.menu[vimenu];

if (document.layers)
	escriu_estils();
var str;
str="<SPAN ID=\"mllnk3s\"><table cellpadding=0 cellspacing=0 border=0";
if (document.all)
	str=str+" STYLE=\"border-top:0;margin-top:0;\"";
str=str+"><tr><td><table border=0 cellpadding=0 cellspacing=1>";
for (i=0;i<vmenu.length;i++)
{
	str=str+"<tr><td width="+incx+" height="+incy+" valign=top  CLASS=\""+vmenu[i].estilt+"t\"  ><img src=\"/home/jsp/imatges/1x1.gif\" width="+incx+" height=1><br>"+estils_t[vmenu[i].estilt].ini+vmenu[i].txt+"</td></tr>";

	
}
str=str+"</table></td></tr></table></SPAN>";




str+="<SPAN ID=\"mllnk2s\"><table cellpadding=0 cellspacing=0 border=0";
if (document.all)
	str=str+" STYLE=\"border-top:0;margin-top:0;\"";
str=str+" >";



//menu
ampy=0;
for (i=0;i<vmenu.length;i++)
{
	ampy+=incy;
	if (i==0 || (estils_t[vmenu[i].estilt].invcolor!=estils_t[vmenu[i-1].estilt].invcolor))
	{ 	if (i!=0) str=str+"</table></td></tr>";
		str=str+"<tr><td bgcolor=\"#666666\"><table border=0 cellpadding=0 cellspacing=1 bgcolor=\"#666666\">";
		ampy++;
	}
	str=str+"<tr><td width="+incx+" height="+incy+" valign=top  CLASS=\""+vmenu[i].estilt+"\"  ><img src=\"/home/jsp/imatges/1x1.gif\" width="+incx+" height="+incy+" border=0></a></td></tr>";
	
	
	


}
str=str+"</table></td></tr>";
str=str+"</table></SPAN>";




str+="<SPAN ID=\"mllnks\"><table cellpadding=0 cellspacing=0 border=0";
if (document.all)
	str=str+" STYLE=\"border-top:0;margin-top:0;\"";
str=str+"><tr><td><img src=\"/home/jsp/imatges/1x1.gif\" width=5 height="+incy+" border=0></td><td><table border=0 cellpadding=0 cellspacing=1>";
for (i=0;i<vmenu.length;i++)
{
	str=str+"<tr><td width="+incx+" height="+incy+" valign=top  >";
	if (vmenu[i].lnk!="")
		str=str+"<a target=\"ftxt\" href=\""+vmenu[i].lnk+"\" onClick=\"top.espera(this,true)\" onMouseOver=\"canvism("+vimenu+","+i+",true)\" onMouseOut=\"canvism("+vimenu+","+i+",false)\">"
	str=str+"<img src=\"/home/jsp/imatges/1x1.gif\" width="+(incx-10)+" height="+incy+" border=0>";
	if (vmenu[i].lnk!="")
		str=str+"</a>";
	str=str+"</td></tr>";

	
}
str=str+"</table></td><td><img src=\"/home/jsp/imatges/1x1.gif\" width=5 height="+incy+" border=0></td></tr><tr><td colspan=3><img src=\"/home/jsp/imatges/1x1.gif\" width="+incx+" height=5 border=0></td></tr></table></a></SPAN>";

document.write(str);
str="<SPAN ID=\"mobil"+vimenu+"\"><img src=\"/home/jsp/imatges/1x1.gif\" width="+incx+" height="+incy+"  border=0></SPAN>";
document.write(str);
}






////////////////////////////////////////////////////////////////
// escriu les opcions del menú
//
//

function escriu_menu_h(vmenu)
{
var str;

str="<SPAN ID=\"mllnk3\"><table cellpadding=0 cellspacing=0 border=0";
if (document.all)
	str=str+" STYLE=\"border-top:0;margin-top:0;\"";
str=str+"><tr><td><table border=0 cellpadding=0 cellspacing=1><tr>";
for (i=0;i<vmenu.length;i++)
{
	str=str+"<td width="+incx+" height="+(incy-2)+" valign=top  CLASS=\""+vmenu[i].estilt+"t\"  ><img src=\"/home/jsp/imatges/1x1.gif\" width="+incx+" height=1><br>"+estils_t[vmenu[i].estilt].ini+vmenu[i].txt+"</td>";

	
}
str=str+"</tr></table></td></tr></table></SPAN>";

document.write(str);


str="<SPAN ID=\"mllnk2\"><table cellpadding=0 cellspacing=0 border=0";
if (document.all)
	str=str+" STYLE=\"border-top:0;margin-top:0;\"";
str=str+" >";



//menu
ampy=0;
for (i=0;i<vmenu.length;i++)
{
	ampx+=incx;
	if (i==0 || (estils_t[vmenu[i].estilt].invcolor!=estils_t[vmenu[i-1].estilt].invcolor))
	{ 	if (i!=0) str=str+"</tr></table></td>";
		str=str+"<td bgcolor=\"#666666\"><table border=0 cellpadding=0 cellspacing=1 bgcolor=\"#666666\"><tr>";
		ampx++;
	}
	str=str+"<td width="+incx+" height="+(incy-2)+" valign=top  CLASS=\""+vmenu[i].estilt+"\"  ><img src=\"/home/jsp/imatges/1x1.gif\" width="+incx+" height="+(incy-2)+" border=0></a></td>";
	
	if (vmenu[i].lnk!="")
	{
		vmenu[i].posy=posy+1;
		vmenu[i].posx=inix+ampx-incx+i;
	}
	


}
str=str+"</tr></table></td></tr>";
str=str+"</table></SPAN>";

document.write(str);



str="<SPAN ID=\"mllnk\"><table cellpadding=0 cellspacing=0 border=0";
if (document.all)
	str=str+" STYLE=\"border-top:0;margin-top:0;\"";
str=str+"><tr><td><table border=0 cellpadding=0 cellspacing=1><tr>";
for (i=0;i<vmenu.length;i++)
{
	str=str+"<td width="+incx+" height="+incy+" valign=top  >";
	if (vmenu[i].lnk!="")
		str=str+"<a target=\"ftxt\" href=\""+vmenu[i].lnk+"\" OnMouseOver=\"canvi("+i+",true)\" onMouseOut=\"canvi("+i+",false)\">"
	str=str+"<img src=\"/home/jsp/imatges/1x1.gif\" width="+incx+" height="+incy+" border=0>";
	if (vmenu[i].lnk!="")
		str=str+"</a>";
	str=str+"</td>";

	
}
str=str+"</tr></table></td></tr></table></SPAN>";
document.write(str);





str="<SPAN ID=\"mobil\"><img src=\"/home/jsp/imatges/1x1.gif\" width="+incx+" height="+incy+"  border=0></SPAN>";

document.write(str);



}


///////////////////////////////////////////////////////////////////////		
//  mou el layer mòbil
//

	
function canvi(index,biton,e)
{
if (!e && document.all)
	var e=top.ftr.window.event;
if (document.all ||document.getElementById)
{

	if (document.all)
		obj=top.ftr.document.all.mobil;
	else
		obj=top.ftr.document.getElementById('mobil');
	
	if (biton==true)
	{
		if (obj.style.display=='none')	
		{
			canviCapa(obj,top.menuh[index].posx,top.menuh[index].posy,estils_t[top.menuh[index].estilt].invcolor);
			obj.style.display='block';
		
		}
	}
	else
	{
		obj.style.display='none';

	}
}
else
{
	obj=document.layers['mobil'];
	if (biton==true)
	{
		if (obj.visibility=='hide')	
		{
			canviCapa(obj,top.menuh[index].posx,top.menuh[index].posy,estils_t[top.menuh[index].estilt].invcolor);
			obj.visibility='show';

		}

	}
	else
	{

		obj.visibility='hide';

	}
}
//	if (biton || (document.all && e.toElement) || (!document.all && e.target))
	if (biton)
		canviSubmenu(index,biton);
	else
		amagaSubmenu(index);

}


function canviCapa(vobj,vposx, vposy,vcolor)
{
	if (document.all)
	{
		vobj.style.pixelTop=vposy;
		vobj.style.pixelLeft=vposx;
		vobj.style.backgroundColor=vcolor;
	}
	else 
	{
		if (document.getElementById)
		{
			vobj=vobj.style;
			vobj.backgroundColor=vcolor;
		}
		else
		{
			vobj.document.bgColor=vcolor;
			vobj.bgColor=vcolor;
		}
		vobj.top=vposy;
		vobj.left=vposx;


	}
}

function canviCapaPos(vobj,vposx, vposy)
{
    if (vobj)
	if (document.all || document.getElementById)
	{
		if (document.all)
		{	
			vobj.style.pixelTop=vposy+top.ftxt.document.body.scrollTop;
			vobj.style.pixelLeft=vposx;
		}
		else
		{
			vobj.style.top=vposy+top.ftxt.pageYOffset;
			vobj.style.left=vposx;
		}

	}
	else
	{
		vobj.top=vposy+top.ftxt.pageYOffset;
		vobj.left=vposx;
	}
}
function canviRelatiuCapaPos(vobj,vincx, vincy)
{
	if (document.all || document.getElementById)
	{
		if (document.all)
		{	
			vobj.style.pixelTop+=vincy;
			vobj.style.pixelLeft+=vincx;

		}
		else
		{
			vobj.style.top+=vincy;
			vobj.style.left+=vincx;
		}

	}
	else
	{
		vobj.top+=vincy;
		vobj.left+=vincx;
	}
}
///////////////////////////////////////////////////////////////////////		
//  mou el layer mòbil
//

function canvismcapa(ipare,index,biton)
{

if (document.all || document.getElementById)
{
	if (document.all)
		obj=eval("top.ftxt.document.all.mobil"+ipare);
	else
		obj=top.ftxt.document.getElementById('mobil'+ipare);
	if (obj)
	if (biton)
	{
		if (document.all && obj.style.display=='none')	
		{
			
			obj.style.pixelTop=top.menu[ipare][index].posy;
			obj.style.pixelLeft=0;
			
			obj.style.backgroundColor=estils_t[top.menu[ipare][index].estilt].invcolor;
			obj.style.display='block';

		}
		else if (obj.style.display=='none')
		{
			
			obj.style.top=top.menu[ipare][index].posy;
			obj.style.left=0;
			
			obj.style.backgroundColor=estils_t[top.menu[ipare][index].estilt].invcolor;
			obj.style.display='block';

		}
	}
	else
	{
		if (obj.style)
			obj.style.display='none';
	}
}
else
{

	
	obj=top.ftxt.document.layers['submenu'+ipare].document;

	obj=obj.layers['mobil'+ipare];
	if (biton==true)
	{
		


		if (obj.visibility=='hide')	
		{
		
		
		obj.top=top.menu[ipare][index].posy;
		obj.left=0;
		
		obj.bgColor=estils_t[top.menu[ipare][index].estilt].invcolor;
		obj.document.bgColor=estils_t[top.menu[ipare][index].estilt].invcolor;
		
		obj.visibility='show';
		
		}

	}
	else
	{

		obj.visibility='hide';

	}
}


}
function canvism(ipare,index,biton)
{
	canvismcapa(ipare,index,biton);
	if (top.timeoutID[ipare])
	{
	top.clearTimeout(top.timeoutID[ipare]);
	top.timeoutID[ipare]=false;
	}
	if (!biton)
		amagaSubmenu(ipare);
}
function amagaSubmenu(ipare)
{

	if (!top.timeoutID[ipare])
		top.timeoutID[ipare]=top.setTimeout("top.ftxt.canviSubmenu("+ipare+",false)",500);

}


function canviSubmenu(vindex,biton)
{
	if (biton)
	{
	if (top.timeoutID[vindex])
	{
		top.clearTimeout(top.timeoutID[vindex]);
		top.timeoutID[vindex]=false;
	}
		for(var i=0;i<top.menuh.length;i++)
			if (i!=vindex && top.timeoutID[i])
			{
				top.clearTimeout(top.timeoutID[i]);
				top.timeoutID[i]=false;
				canviSubmenu(i,false);
			}
	}

	var vobj;
//if (biton)
	for (var i=0; i<top.menu[vindex].length;i++)
	{
		top.menu[vindex][i].posx=top.menuh[vindex].posx;
		top.menu[vindex][i].posy=0+i*(incy+1);

		canvism(vindex,i,true);
		canvismcapa(vindex,i,false);
// canvismcapa
	}


	if (document.all || document.getElementById)
	{
		if (document.all)
			vobj=eval("top.ftxt.document.all.submenu"+vindex);
		else
			vobj=top.ftxt.document.getElementById('submenu'+vindex);
	}
	else
	{
			vobj=top.ftxt.document.layers['submenu'+vindex];

	}
	if (vobj)
	{
	canviCapaPos(vobj,top.menuh[vindex].posx,0);
if (biton)
	if (document.all ||document.getElementById)
		vobj.style.display='block';
	else
		vobj.visibility='show';
else
	if (document.all ||document.getElementById)
		vobj.style.display='none';
	else
		vobj.visibility='hide';
	}


}



function pwderr(codierr)
{
	if (codierr=="1")
		alert("L'usuari i/o paraula de pas que heu introduït no són vàlids.\nUs mostrem els resultats de la cerca anterior sense els enllaços a la part de subscripxors.");
	if (codierr=="2")
		alert("La vostra subscripció no és vàlida actualment.\nUs mostrem els resultats de la cerca anterior sense els enllaços a la part de subscripxors.");
	if (codierr=="3")
		alert("L'adreça ip des d'on us connecteu no és correcta.\nUs mostrem els resultats de la cerca anterior sense els enllaços a la part de subscripxors.");

}

////////////////////////////////////////////////////////////////////////
// crea una llista per afegir els banners que es vulguin posar a l'esquerra

function banners_item(nom_gif,enllacb)
{
	this.gif=nom_gif;
	this.lnkurl=enllacb;
}

//////////////////////////////////////////////////////////////////////////
// escriu un layer amb els banners

function escriu_bannersp()
{
	slogan="<small><font color=\"#FFFFFF\" face=\"Verdana\"><strong>Grec.net, </strong><BR>cercar M&Eacute;S, con&egrave;ixer MOLT M&Eacute;S</font></small><br><br>";
	strb="<SPAN ID=\"colesq\"><center><img src=\"http://www.grec.net/home/jsp/imatges/1x1.gif\" width=240 height=1><br>";
	strb=strb+slogan;
	for(i=0;i<bannp.length;i++)
		strb=strb+"<a target=\"_blank\" href=\""+bannp[i].lnkurl+"\"><img src=\""+bannp[i].gif+"\" border=0></a><br><br>";
	strb=strb+"</CENTER>";
	strb=strb+text_postbanners+"</SPAN>";
	
	document.write(strb);
}

//////////////////////////////////////////////////////////////////////////
// funcions que escriuen variables sensibles a si hi ha usuari i sessió
function escr_botousu()
{
	if (jsconsulta == ""){document.write("<a href=\"javascripx:ensenya()\"><img src=\"http://www.grec.net/home/jsp/imatges/usuari.gif\" border=0></a>");}
}
function escr_hiddenusu()
{
	if(jsusu!="" && jsses!="")
		document.write("<input type=\"hidden\" name=\"USUARI\" value=\""+jsusu+"\"><input type=\"hidden\" name=\"SESSIO\" value=\""+jsses+"\">");
	else
		document.write("<input type=\"hidden\" name=\"USUARI\" value=\"\">");
}
function escr_comsubs()
{
if (jsconsulta=="") {document.write("<img src=\"http://www.grec.net/home/jsp/imatges/subscrip.gif\" border=0 usemap=\"#subs\">");}
}

/////////////////
function titolm(num)
{
	document.write("<table width=\"100%\" border=0 cellpadding=0 cellspacing=0><tr><td bgcolor=\"#0b5b92\"><a href=\"#t\"><img src=\"http://www.grec.net/home/jsp/imatges/fletxa2.gif\" border=0 align=right></a><a name=\"t"+(num-5)+"\"></a><b><font color=\"#ffffff\">"+ titol[num-5]+"</font></b></td></tr></table>");
		
}

function sep()
{
	document.write("</td><td valign=top bgcolor=\"#ffffff\">");
		
}


function data(dtatxt)
{
	
}
function ensenya()
{
if (document.all)
{
	obj=document.all.taula;
	obj.style.display='block';
}
else
{
	obj=document.layers['taula'];
		obj.visibility='show';
}

}
function repcerca()

{


	if (document.forms.formc.CERCA.value!="")
	{

	
		document.forms.formc.submit();
	}
	else valida();

	

}

function valida()
{
	
	if (!formulari.USUARI || formulari.USUARI.value=="")
		alert("Heu d'introduir algun criteri per fer la cerca");
	else
		formulari.submit();
}

function ObreFin(vurl)
{
data=new Date();
data=data.getTime();
data="f"+data;
fill=window.open(vurl,data,"width=600,height=350,location=no,toolbar=no,directories=no,menubar=no,resizable=yes,scrollbars=yes,status=no,dependent=no,screenX=100,screenY=100");
if (navigator.appName.indexOf("Netscape")>-1)                                                                         
	fill.focus();
}                                                                                                                        


function escriu_cistella()
{
	var str="<span id=\"cist\">";
	str+="<div id=\"llista\">";
	if (top.itemsCistella.length>0)
		str+=top.llistaItemsCistella();
	else
		str+="<span class=\"txtcist\">Cistella buida</span>"
	str+="</div>";
		str+="</span>";
	document.write(str);
}
function clavarCistella()
{
	moureScrollCistella(0,0);
	moureCistella(0,40);

}
function mesCistella()
{
	mesCistella1();
	intervalID=setInterval('top.ftxt.mesCistella1()',50);
}
function mesCistella1()
{
	var vobj;
	if (document.all)
		vobj=document.all.cist;
	else
		vobj=document.getElementById("cist");
	canviRelatiuCapaPos(vobj,0,3);
}
function menysCistella()
{
	menysCistella1();
	intervalID=setInterval('top.ftxt.menysCistella1()',50);
}
function menysCistella1()
{
	var vobj;
	if (document.all)
		vobj=document.all.cist;
	else
		vobj=document.getElementById("cist");
	canviRelatiuCapaPos(vobj,0,-3);
}
function aturaCistella()
{
	clearInterval(intervalID);

}

function moureScrollCistella(vx,vy)
{
	var vobj;
	if (document.all)
		vobj=document.all.cist_scroll;
	else
		vobj=document.getElementById("cist_scroll");
	canviCapaPos(vobj,vx,vy);

}
function moureCistella(vx,vy)
{
	var vobj;
	if (document.all)
		vobj=document.all.cist;
	else
		vobj=document.getElementById("cist");
	canviCapaPos(vobj,vx,vy);
}

function norm(vnum,vdigits)
{
	vnum=""+vnum;
	while (vnum.length<vdigits)
		vnum="0"+vnum;
	return vnum;
}
function emula_event()
{	
	var obj;
	if (top.ftxt.event)
		obj=top.ftxt.event;
	else
		obj=event;

	if (obj.keyCode)
		this.which=obj.keyCode;
	this.pageX=obj.clientX+document.body.scrollLeft;
	this.pageY=obj.clientY+document.body.scrollTop;
	if (obj.srcElement)
	{
		this.target=obj.srcElement;
		this.target.name=obj.srcElement.name;
	}
}
function capturaIntro(e)
{
	if (!e)
	{var e= new emula_event();
	}
	if (e && e.which==13)
	{
		top.fcist.afegirCistell();
		return false;
	}
	else
	return true;
}
function plegarSubmenus()
{
	for (var i=0; i<top.menuh.length;i++)
	{
		canviSubmenu(i,false);
	}
}
function resize2(vthis){
function testImg(){
if(img.complete != null && img.complete == true){  
	var width=parseInt(vthis.width,10);
	var height=parseInt(vthis.height,10);
	if (Math.abs(width-height)<10)
		height=width;
	var difw=0;

	if (width>=height) {
		//horitzontal
		difw=Math.abs(width-190);
	}
	else {
		difw=Math.abs(width-149);
	}

	if (difw>30)
		if (width>=height)
			vthis.style.width="190px";
		else
			vthis.style.width="149px";
			}
else{setTimeout(testImg, 500);
return;}
}
}

 function resize1(vthis){

	var width=parseInt(vthis.width);
	var height=parseInt(vthis.height);
	if (Math.abs(width-height)<10)
		height=width;
	var difw=0;

	if (width>=height) {
		//horitzontal
		difw=Math.abs(width-190);
	}
	else {
		difw=Math.abs(width-149);
	}

	if (difw>30)
		if (width>=height)
			vthis.style.width="190px";
		else
			vthis.style.width="149px";
			
}
function resize(vthis){
var img=new Image();
img.src=vthis.src;
if(img.complete == null || img.complete != true){ 
//codi
setTimeout('resize(vthis)', 250); 
} 
else{ 
// Code to execute on completion of download 
	//var width=parseInt(vthis.width,10);
	//var height=parseInt(vthis.height,10);
	var width=img.width;
	var height=img.height;
	if (Math.abs(width-height)<10)
		height=width;
	var difw=0;

	if (width>=height) {
		//horitzontal
		difw=Math.abs(width-190);
	}
	else {
		difw=Math.abs(width-149);
	}

	if (difw>30)
		if (width>=height)
			vthis.style.width="190px";
		else
			vthis.style.width="149px";
			
}
}

 
