function BrowserCheck() {
	var b = navigator.appName;
	var agente=(navigator.userAgent);
	this.platf = navigator.platform.toUpperCase();
	this.linux = (this.platf.indexOf('LINUX')!=-1);
}
is = new BrowserCheck();

function preloadimg(web){
	MM_preloadImages("/img/tic_arroba_p"+web+"_on.gif","/img/tic_arroba_s"+web+"_on.gif");
}
function MM_preloadImages() { //v3.0
  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 toggle(elemento){
	if(document.getElementById(elemento).style.display=="block"){
		document.getElementById(elemento).style.display="none";
		document.getElementById("a_"+elemento).style.backgroundImage="url('/img/sitemap_mes.gif')";
	}
	else{
		document.getElementById(elemento).style.display="block";
		document.getElementById("a_"+elemento).style.backgroundImage="url('/img/sitemap_menys.gif')";
	}
}
function toggle_list(elemento){
	if(document.getElementById(elemento).style.display=="block"){
		document.getElementById(elemento).style.display="none";
		document.getElementById("anchor_"+elemento).style.backgroundImage="url('/img/ico_temes_mes.gif')";
	}
	else{
		document.getElementById(elemento).style.display="block";
		document.getElementById("anchor_"+elemento).style.backgroundImage="url('/img/ico_temes_menys.gif')";
	}
}
function mostra(elemento){
	document.getElementById(elemento).style.display="block";
}
function amaga(elemento){
	document.getElementById(elemento).style.display="none";
}
function ventana(talla,pag,nom){
  aw=screen.availWidth-10;
  switch (talla){
    case 0://copyright, aviso legal, web accesible
	ancho=460;alto=450;
	xc=(aw-ancho)/2;
carac='status=yes,scrollbars=yes,menubar=no,toolbar=no,location=no,directories=no,resizable=yes,copyhistory=no,width='+ancho+',height='+alto+',left='+xc+',top=0,screenX='+xc+',screenY=0';
    break;
	case 3://enviar amigo
	ancho=460;alto=450;
	xc=(aw-ancho)/2;
carac='status=no,scrollbars=yes,menubar=no,toolbar=no,location=no,directories=no,resizable=yes,copyhistory=no,width='+ancho+',height='+alto+',left='+xc+',top=0,screenX='+xc+',screenY=0';
    break;
	case 8: //posters verticales
	ancho=370;alto=520;
    xc=(aw-ancho)/2;
carac='status=no,scrollbars=no,menubar=no,toolbar=no,location=no,directories=no,resizable=yes,copyhistory=no,width='+ancho+',height='+alto+',left='+xc+',top=0,screenX='+xc+',screenY=0';
	break;
	case 9: //posters horizontales
	ancho=404;alto=285;
    xc=(aw-ancho)/2;
carac='status=no,scrollbars=no,menubar=no,toolbar=no,location=no,directories=no,resizable=yes,copyhistory=no,width='+ancho+',height='+alto+',left='+xc+',top=0,screenX='+xc+',screenY=0';
	break;
	case 11: //bamboo
	ancho=920;alto=635;
	xc=(aw-ancho)/2;
	carac='status=no,scrollbars=yes,menubar=no,toolbar=yes,location=no,directories=no,resizable=yes,copyhistory=no,width='+ancho+',height='+alto+',left='+xc+',top=0,screenX='+xc+',screenY=0';
	break;
	default:
	ancho=650;alto=450;
	xc=(aw-ancho)/2;
	carac='status=no,scrollbars=yes,menubar=no,toolbar=yes,location=no,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 amic(){
	url=document.location;	
	ventana(3,'form_friend.jsp?url='+escape(url),'Vamic');
}
function toggle(){
	arLayers=toggle.arguments;
	for(i=0;i<arLayers.length;i++){
		estilo=document.getElementById(arLayers[i]).style.display;
		if(estilo=="block") document.getElementById(arLayers[i]).style.display="none";
		else document.getElementById(arLayers[i]).style.display="block";
	}
}

/*window.onload = function (e) {
  if (!document.getElementsByTagName) return;
  searchquestionmarks();
}

function searchquestionmarks(){
	 if (!document.getElementsByTagName) return; 
 	 var anchors = document.getElementsByTagName("a"); 
 	 for (var i=0; i<anchors.length; i++) { 
   		var anchor = anchors[i]; 
   		stitle=new String(anchor.getAttribute("title"));
   		if (stitle.indexOf("???")!=-1){ 
		     anchor.className = "questionmarks";
 		} 
	 }
	 var imatges = document.getElementsByTagName("img"); 
 	 for (var i=0; i<imatges.length; i++) { 
   		var imatge = imatges[i]; 
   		salt=new String(anchor.getAttribute("alt"));
		stitle=new String(anchor.getAttribute("title"));
   		if (salt.indexOf("???")!=-1 || stitle.indexOf("???")!=-1){ 
		     imatge.className = "questionmarks";
 		} 
	 }
	 var metas = document.getElementsByTagName("meta"); 
 	 for (var i=0; i<metas.length; i++) { 
   		var meta = metas[i]; 
   		scontent=new String(meta.getAttribute("content"));
		sname=new String(meta.getAttribute("name"));
   		if (scontent.indexOf("???")!=-1){ 
		    alert("meta "+sname+": "+scontent);
 		}
		else if (scontent==""){
			alert("meta "+sname+" vac�o");
		}
	 }
}*/

/* mida letra */

function writebig(){
	document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"/styles/big.css\"/>");
}

function mirafont(){
      var iBase = TextResizeDetector.addEventListener(onFontResize,null);
	  canviaestils(iBase);
}
function canviaestils(pixelsize){
	if(pixelsize >= 18){
		writealternativestyle("biggest");
	}
	else if(pixelsize > 15){
		writealternativestyle("big");
	}
	else if(pixelsize <= 15){
		writealternativestyle("");
	}
	
}
function onFontResize( e, args ){
	var msg = "\nThe base font size in pixels: " + args[0].iBase;
	canviaestils(args[0].iSize);
}
function writealternativestyle(quin){
	for(i=1;i<3;i++){
		
		el=document.getElementById("recursos"+i);
		if (el){
			h2r=el.getElementsByTagName("h2");
			for (j = 0; j < h2r.length; j++) {
				h2r[j].className = quin;
			}
		}
	}
	tabcont=document.getElementById("tablewebquest");
	if(tabcont){
		tabcont.className=quin;
	}
	tic=document.getElementById("activities_tic");
	if(tic){
		tic.className=quin;
	}
	leg=document.getElementById("resourceslegend");
	if(leg){
			leg.className=quin;
	}
}


