function MM_preloadImages(){
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function precarrega(arImatges,path){
	for(i=0;i<arImatges.length;i++){
		MM_preloadImages(path+arImatges[i]);
	}
	return true;
}
function toggle(tipus){
	arCapas=toggle.arguments;
	if(tipus==0) sdisplay="inline";
	else sdisplay="block";
	for(i=1;i<arCapas.length;i++){
		if(document.getElementById(arCapas[i]).style.display==sdisplay) document.getElementById(arCapas[i]).style.display="none";
		else document.getElementById(arCapas[i]).style.display=sdisplay;
	}
}

/* scroll de les capes*/
var clipLeft = 0;
var clipHeight = 55;
var clipRight = 245;
var lefter = 50;
var lyrwidth = 0;
var time,amount,theTime,theWidth,DHTML;

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

function init(nomcapa)
{
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj(nomcapa);
	if (document.layers)
	{
		lyrwidth = x.style.clip.right;
		lyrwidth += 20;
		x.style.clip.left = clipLeft;
		x.style.clip.top = 0;
		x.style.clip.bottom = clipHeight;
		x.style.clip.right = clipRight;
		
	}
	else if (document.getElementById || document.all)
	{
		lyrwidth = x.obj.offsetWidth;
		lyrwidth += 20;
		x.style.clip = 'rect(0px,'+clipRight+'px,'+clipHeight+'px,'+clipLeft+'px)';
	}
	if(init.arguments.length>1){
		posicionador=init.arguments[1];
		clipLeft -= (posicionador - lefter);
		clipRight -= (posicionador - lefter);
		clipstring = 'rect(0px,'+clipRight+'px,'+clipHeight+'px,'+clipLeft+'px)';
		x.style.clip = clipstring;
		x.style.left = posicionador + 'px';
		lefter=posicionador;
	}
}


function scrollayer(layername,amt,tim)
{
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll();
}

function getPoint(layername,enllac){
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	document.location=enllac.href+"&pos="+lefter;
}

function realscroll()
{
	if (!DHTML) return;
	clipLeft += amount;
	clipRight += amount;
	lefter -= amount;
	if (clipLeft < 0 || clipRight > lyrwidth)
	{
		clipLeft -= amount;
		clipRight -= amount;
		lefter += amount;
		return;
	}
	if (document.getElementById || document.all)
	{
		clipstring = 'rect(0px,'+clipRight+'px,'+clipHeight+'px,'+clipLeft+'px)';
		thelayer.style.clip = clipstring;
		thelayer.style.left = lefter + 'px';
	}
	else if (document.layers)
	{
		thelayer.style.clip.left = clipLeft;
		thelayer.style.clip.right = clipRight;
		thelayer.style.left = lefter;
	}
	time = setTimeout('realscroll()',theTime);
}

function stopscroll()
{
	if (time) clearTimeout(time);
}

function ventana(talla,pag,nom){
  aw=screen.availWidth-10;
  switch (talla){
	default:
	ancho=600;alto=560;
	xc=(aw-ancho)/2;
	carac='status=no,scrollbars=yes,menubar=no,toolbar=no,location=yes,directories=no,resizable=yes,copyhistory=no,width='+ancho+',height='+alto+',left='+xc+',top=0,screenX='+xc+',screenY=0';
	break;
  }
  if(!nom)nom='FINESTRA';
  eval(nom+'=window.open("'+pag+'","'+nom+'","'+carac+'")');
  setTimeout("eval("+nom+".focus())",400);
}

function getURLParam(strParamName)
{
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 )
	{
		
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ )
		{
      if ( aQueryString[iParam].indexOf(strParamName + "=") > -1 )
			{
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return strReturn;
}

sprint = getURLParam("print");
if(sprint == 1)
{
	print();
}

