var arrossec=false;

function capa()
{

str="<STYLE TYPE=\"text/css\">";
if (document.all)
{
str=str+ "\n#l1 {position:absolute;display: none;top:100px;left:100px;width:20;height:20;background-color: #ffeca0;layer-background-color:#ffeca0; }"; 
}
else
{
str=str+ "\n#l1 {position:absolute;top:100px;left:100px;width:20;height:20;visibility:hidden;background-color: #ffeca0;layer-background-color:#ffeca0;}"; 
}

str=str+"\n</STYLE>\n";

document.write(str);
document.write("<SPAN ID=\"l1\"></SPAN>");
}
	
function norma(vanum,vlon)
{	
	if (vanum.length<vlon)
	{	lim=vlon-vanum.length;
		for (i=0;i<lim;i++)
			vanum="0"+vanum;
	}
	return vanum;
}
function link(vlink)
{
	
	vlink=""+norma(""+vlink,7);
	window.location.href="http://www.grec.net/cgibin/escolx.pgm?USUARI="+jsusu+"&SESSIO="+jsses+"&GECART="+vlink;
}
function linklam(vlam,vtit)
{
	window.location.href="/home/cel/didac/lamines/"+vlam+".jsp?USUARI="+jsusu+"&SESSIO="+jsses+"&TITOL="+escape(vtit);
}
function mostra_capa(vtxt)
{
	if (document.all)
	{
		document.all.l1.innerHTML="<font face=\"Arial\">&nbsp;"+vtxt+"&nbsp;</font>";
	}	
	else
	{
		document.layers["l1"].document.open();
		document.layers["l1"].document.write("<font face=\"Arial\">&nbsp;"+vtxt+"&nbsp;</font>");
		document.layers["l1"].document.close();

	}
	// inicia moviment 
	activa_drag();
	
}
function amaga()
{
	if (document.all)
		document.all.l1.style.display="none";
	else
		document.layers["l1"].visibility="hide";
	desactiva_drag();
}

//------------------------------------------------------------------------------------------------------------------------
// Creem un nou objecte event per encapsular igual netscape i explorer
//
//------------------------------------------------------------------------------------------------------------------------

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.name=window.event.srcElement.name;
}
//-----------------	-------------------------------------------------------------------------------------------------------
// Situa x,y
//
//------------------------------------------------------------------------------------------------------------------------
function mouObjA(x,y,objecte)
{
	
	if (document.all)
	{
		objecte.style.left=x;
		objecte.style.top=y;
	}
	else
	{
		objecte.left=x;
		objecte.top=y;
	}

}

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
				obj=document.layers["l1"];
		mouObjA(e.pageX,e.pageY-20,obj);
		if (document.all)
		{
			if (document.all["l1"].style.display!="block")
				document.all["l1"].style.display="block";
		}
		else
		{
			if (document.layers["l1"].visibility!="show")
				document.layers["l1"].visibility="show";
		}
		return true;
		}
		else return false;
	
}
///////////////////////////////////////////////////////777
function escr_titol(vtext)
{
	if (vtext=="" && jstit!="")
		document.write(jstit)
	else
		document.write(vtext)
}
//-----------------------------------------------------------
function lamina(vjpg)
{
	document.write("<img src=\"");
	if (jspar=="") 
	{
		
		document.write(vjpg);

	}
	else
	{
		if (vjpg.length<9) vjpg=vjpg+"|";
		document.write("http://www.grec.com/cgibin/didac.exe?P="+vjpg+jspar+"&");
	}
	document.write("\" ");
}