catdesc = new Array();

catdesc[0] = "Multimedia";
catdesc[1] = "Ofimatica";
catdesc[2] = "Utilitats";
catdesc[3] = "Internet";
catdesc[4] = "Nateja";




//precargar imatges
	pic29= new Image(2,540);
	pic29.src='img/fondo.jpg';


	pic15= new Image(6,6);
	pic15.src='img/esq1.gif';

	pic16= new Image(6,6);
	pic16.src='img/esq2.gif';


	pic20= new Image(6,6);
	pic20.src='img/esq3.gif';

	pic21= new Image(6,6);
	pic21.src='img/esq4.gif';



	pic22= new Image(5,5);
	pic22.src='img/esqa1.gif';

	pic23= new Image(5,5);
	pic23.src='img/esqa2.gif';

	pic24= new Image(6,6);
	pic24.src='img/esqa3.gif';


	pic25= new Image(6,6);
	pic25.src='img/esqa4.gif';



	pic26= new Image(6,6);
	pic26.src='img/esqprim.gif';

	pic27= new Image(6,6);
	pic27.src='img/esqb2.gif';






	pic1= new Image(32,32);
	pic1.src='img/loading.gif';

	pic2= new Image(128,125);
	pic2.src='img/cub.gif';

	pic3= new Image(148,147);
	pic3.src='img/fons_com.jpg';

	pic4= new Image(145,152);
	pic4.src='img/fons_descargues.jpg';

	pic5= new Image(46,45);
	pic5.src='img/ico_descargues.gif';

	pic6= new Image(145,152);
	pic6.src='img/fons_wifi.jpg';

	pic7= new Image(11,7);
	pic7.src='img/esp.gif';


	pic8= new Image(251,133);
	pic8.src='img/top_root.gif';

	pic9= new Image(92,105);
	pic9.src='img/peu_root.gif';

	pic10= new Image(35,186);
	pic10.src='img/viciao2k3_logo.gif';




	pic11= new Image(16,16);
	pic11.src='img/ico_zoom.gif';


	pic12= new Image(28,59);
	pic12.src='img/fletxa_up.gif';

	pic13= new Image(16,15);
	pic13.src='img/ico_mapaftp.gif';

	pic14= new Image(11,15);
	pic14.src='img/ico_fav.gif';









	pic17= new Image(30,24);
	pic17.src='img/spanishFlag.png';

	pic18= new Image(30,24);
	pic18.src='img/englishFlag.png';


	pic19= new Image(80,15);
	pic19.src='img/blue_1.gif';








	pic30= new Image(91,91);
	pic30.src='img/stop.jpg';

	pic31= new Image(148,51);
	pic31.src='img/logotip.gif';









function getXHR(){
        var newReq = null;
		if(window.XMLHttpRequest) {
          try {
            newReq = new XMLHttpRequest();
          }
          catch(e) {
            newReq = false;
          }
        }
        else if(window.ActiveXObject) {
          try {
            newReq = new ActiveXObject("Msxml2.XMLHTTP");
          }
          catch(e) {
            try {
               newReq = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e) {
              newReq = false;
            }
          }
        }
	return newReq;
      }

      var req_fail_IE = getXHR();





function comprobarMail(){
		if (document.comments_form.nom != undefined)
				document.getElementById('nom').value = getCookie2('c_nom');
		if (document.comments_form.de != undefined)
				document.getElementById('de').value = getCookie2('c_de');
		if (getCookie2('c_nom') || getCookie2('c_de')) {
			document.comments_form.bakecookie.checked = true;
		} else {
			document.comments_form.bakecookie.checked = false;
		}

}





function quinIndex(ncat,npregunta,query){
	var nindex=0;
	var i=0;
	
	
	while(i !=(faq.length) ){// && nindex !=(npregunta+1)
	


	
			if(faq[i][2]==ncat){
			

				if(faq[i][0]==faq[npregunta][0]){
					valor=nindex;

				}
				nindex++;



				
		
			}
	
	i++;
	
	}





		MostrarPreguntes(ncat,1,query);




		mostrarTerme(npregunta,faq,valor,1,query);

	//return valor;
}


function obrirSeccio(url,tipus,conf,nom){
	//if(isDefined('slideshow2')) clearInterval(slideshow2);

	document.getElementById('divcontent').innerHTML='<div style="padding-top:50px;padding-bottom:50px;"><center><img src="img/loading.gif" width="32" height="32"><br><br>Carregant</center></div>';


//url+'?hash=' + Math.random();









	req_fail_IE.open('GET', url, true);



	req_fail_IE.onreadystatechange=function()
	{
		if (req_fail_IE.readyState==4)
		{
			if(req_fail_IE.status==200)
            {

				if((tipus==0) || (tipus==1) || (tipus==2) || (tipus==3) || (tipus==4)  || (tipus==5) || (url=='diccionari.html')   || (url=='faq.html')  || (url=='cp') || (url=='alta.html')  ){eval(req_fail_IE.responseText);}
				else{document.getElementById('divcontent').innerHTML=req_fail_IE.responseText;}

				if(url=='consulta.html')comprobarMail();


if(conf !=null){

	if(url=='diccionari.html' ){
		mostrarTerme(tipus,dic,tipus,1,nom);
	}else if(url=='faq.html' ){
quinIndex(conf,tipus,nom);



	}else{//descargues
	
	cambiarCatDesc(tipus,nom);
	}

}


			}else if(req_fail_IE.status==404){
				document.getElementById('divcontent').innerHTML='<div style="padding-top:50px;padding-bottom:50px;"><table cellspacing=0 cellpadding=0 align=center><td width=1 valign=top><img src="img/stop.jpg" width="91" height="91" hspace=20></td><td style="padding-right:91px" valign=top><font class="titol">Area clients</font><br><div style="padding-top:10px;">Estas intentant entrar en una area que nomes<br>poden accedir els clients de imm<br><br>Si no tens la clau per poder accedir a aquesta seccio<br>informet a la botiga imm mes propera</div></td></table></div>';
			}

		}
	}

	req_fail_IE.send('');




}

function isDefined(variable)
{
    return (typeof(window[variable]) == "undefined")?  false: true;
}

function IntrodueixPassword(catid,nom){
	pal=prompt('Introdueix la contrasenya','');

	if(catid==null)catid=0;

	if (pal) obrirSeccio(pal+'.html',catid,1,nom);




}



function AfegirPreferits() {
	var title = 'Informatica i molt mes';
	var url = 'http://www.infomoltmes.com';
	
	if (window.sidebar) {
		window.sidebar.addPanel(title, url,''); //Mozilla Firefox Bookmark
	}else if( window.external ) {
		window.external.AddFavorite( url, title); //IE Favorite
	}else if(window.opera && window.print) {
		return true; //Opera Hotlist
	}
}










function getPageSize(){

	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}






function MostrarCataleg(){


	cataleg1= new Image(400,500);
	cataleg1.src='cataleg/1.gif';

	cataleg2= new Image(400,500);
	cataleg2.src='cataleg/2.gif';

	cataleg3= new Image(400,500);
	cataleg3.src='cataleg/3.gif';

	cataleg4= new Image(400,500);
	cataleg4.src='cataleg/4.gif';



//var arrayPageSizex = getPageSize();

	document.getElementById('frameCataleg').innerHTML='<div style="position:absolute;z-index:5;padding:10px;"><a href="javascript:OcultarCataleg();" class="navigation">X Tancar</a></div><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"><tr><td align="center" id="taucataleg"><font color="yellow">Arrastre les pagines com si es tractes d\'un llibre<br>o fes un clic a la cantonada de la pagina per canviar de pagina</font><br><br><table style="border:2px white solid;padding:5px;width:1px;height:1px;"><td><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="800" height="500"><param name="movie" value="pageflip_v213_dynamic.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="wmode" value="transparent"><embed src="pageflip_v213_dynamic.swf" wmode="transparent" quality="high" bgcolor="#ffffff" width="800" height="500" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></td></table></td></tr></table>';


			//document.getElementById('taucataleg').height = arrayPageSizex[1];



			document.getElementById('frameCataleg').style.display='';
			document.getElementById('framePagina').style.display='none';
}












function carregarImatge(src,nom){

//var arrayPageSizex = getPageSize();

	document.getElementById('frameCataleg').innerHTML='<div style="position:absolute;z-index:5;padding:10px;"><a href="javascript:OcultarCataleg();" class="navigation">X Tancar</a></div><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"><tr><td align="center" id="taucataleg"><font color="yellow">'+nom+'</font><br><br><table style="border:2px white solid;padding:5px;width:1px;height:1px;"><td><img src="'+src+'"></td></table></td></tr></table>';


			//document.getElementById('taucataleg').height = arrayPageSizex[1];



			document.getElementById('frameCataleg').style.display='';
			document.getElementById('framePagina').style.display='none';

}









function OcultarCataleg(){
	document.getElementById('framePagina').style.display='';
	document.getElementById('frameCataleg').style.display='none';
	document.getElementById('frameCataleg').innerHTML='';
}

/*window.onload = function(){
	document.getElementById('carregant').style.display='none';
}*/






//----------------------------------------------






function getCookie2(name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1){return nullstring;}
    var cookieEndIndex = c.indexOf(';', cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1){cookieEndIndex = c.length;}
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}


function setCookie2 (name, value, expires, path, domain, secure) {
    var curCookie = name + '=' + escape(value) + (expires ? '; expires=' + expires : '') + (path ? '; path=' + path : '') + (domain ? '; domain=' + domain : '') + (secure ? 'secure' : '');
    document.cookie = curCookie;
}

function deleteCookie2 (name, path, domain) {
    if (getCookie2(name)){document.cookie = name + '=' + ((path) ? '; path=' + path : '') + ((domain) ? '; domain=' + domain : '') + '; expires=Thu, 01-Jan-70 00:00:01 GMT';}
}
function rememberMex (src,nomcookie) {



    var element = document.getElementById(src);


    var now = new Date();
    fixDatex(now);
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
    now = now.toGMTString();
    if (element.value != undefined){setCookie2(nomcookie, element.value, now, '/', '', '');}
}


function forgetMe (f) {
    deleteCookie2('c_de', '/', '');
    f.de.value = '';
    deleteCookie2('c_nom', '/', '');
    f.nom.value = '';
}

function fixDatex (date) {
    var base = new Date(0);
    var skew = base.getTime();
    if (skew > 0){date.setTime(date.getTime() - skew);}
}






function recordarsiono(){
	if (document.comments_form.bakecookie.checked == true){rememberMex('de','c_de');rememberMex('nom','c_nom');}else{forgetMe(document.comments_form);}
}
function comprobarc(){




	if(document.getElementById('nom').value==''){



		document.getElementById('nom').style.border = 'solid #ff0000 1px';
		alert('Introdueix el teu nom');
		document.getElementById('nom').focus(); 



	}else if(document.getElementById('de').value==''){
		alert('Introdueix el teu correu electronic');
		document.getElementById('nom').style.border = 'solid #00ff00 1px';
		document.getElementById('de').style.border = 'solid red 1px';
		document.getElementById('de').focus(); 



	}else if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.getElementById('de').value)){
		document.getElementById('de').style.border = 'solid #ff0000 1px';
		alert('Introdueix un correu electronic valid');
		document.getElementById('de').focus(); 









	}else if (document.getElementById('asunto').value==''){
		document.getElementById('nom').style.border = 'solid #00ff00 1px';
		document.getElementById('de').style.border = 'solid #00ff00 1px';

		document.getElementById('asunto').style.border = 'solid #ff0000 1px';
		alert('Introdueix l\'assumpte pel missatge');
		document.getElementById('asunto').focus(); 





	}else if (document.getElementById('mensaje').value==''){
		document.getElementById('nom').style.border = 'solid #00ff00 1px';
		document.getElementById('de').style.border = 'solid #00ff00 1px';
		
		document.getElementById('asunto').style.border = 'solid #00ff00 1px';
		document.getElementById('mensaje').style.border = 'solid #ff0000 1px';
		alert('Introdueix el missatge');
		document.getElementById('mensaje').focus(); 


	}else{
		document.getElementById('nom').style.border = 'solid #00ff00 1px';
		document.getElementById('de').style.border = 'solid #00ff00 1px';
		document.getElementById('asunto').style.border = 'solid #00ff00 1px';
		document.getElementById('mensaje').style.border = 'solid #00ff00 1px';


if (document.comments_form.bakecookie.checked == true){


rememberMex('de','c_de');
rememberMex('nom','c_nom');


}









document.comments_form.submit();







alert('Missatge enviat');
obrirSeccio('consulta.html');


		return true;
	}
}


contador=0;





















function mostrarTerme(index,taula,ara,mark,query){



	for (i=0;i<contador;i++){
		document.getElementById('link'+i).style.fontWeight = 'normal';
	}



	document.getElementById('link'+ara).style.fontWeight = 'bold';










if(mark==1){

paraula1 = query.toUpperCase();



//	document.getElementById('link'+ara).style.backgroundColor = 'yellow';
	texte = repStr(taula[index][1].toUpperCase(),paraula1,'<span style="background-color:yellow;">'+paraula1+'</span>');
}
else texte =taula[index][1];

texte = texte.toLowerCase();


texte = texte.charAt(0).toUpperCase() + texte.substring(1, texte.length);


	cadena ='';



	if(taula==dic && dic[index][2]!=null)cadena +='<a href="javascript:carregarImatge(\''+dic[index][2]+'\',\''+dic[index][0]+'\');" title="Fes clic per ampliar"><img src="'+dic[index][2]+'" style="padding:10px;border:1px #666666 solid;float:left;position:relative;margin-right:10px;width:50px;height:50px;" border="0"></a>';
	cadena +='<div style="float:left;position:relative;">'+texte+'</div>';


	document.getElementById('divDefinicio').innerHTML = cadena;
}





function MostrarPreguntes(com,mark,query){
contador=0;
cadena ='';


if(mark==1){
	paraula1 = query.toUpperCase();
}



if (com == 0){
	for(i=0;i<faq.length;i++){



if(mark==1){

	pregunta = repStr(faq[i][0].toUpperCase(),paraula1,'<span style="background-color:yellow;">'+paraula1+'</span>');

	pregunta = pregunta.toLowerCase();

	pregunta = pregunta.charAt(0).toUpperCase() + pregunta.substring(1, pregunta.length);

}else{
	pregunta = faq[i][0];

	pregunta = pregunta.toLowerCase();

	pregunta = pregunta.charAt(0).toUpperCase() + pregunta.substring(1, pregunta.length);

}
		cadena +='<b>&bull;</b> <A href="javascript:mostrarTerme('+i+',faq,'+contador+')" id="link'+contador+'">'+pregunta+'</a><br><br>';

		contador++;
	}
}else{


	for(i=0;i<faq.length;i++){




		if(faq[i][2]==com){


if(mark==1){
	pregunta = repStr(faq[i][0].toUpperCase(),paraula1,'<span style="background-color:yellow;">'+paraula1+'</span>');

	pregunta = pregunta.toLowerCase();

	pregunta = pregunta.charAt(0).toUpperCase() + pregunta.substring(1, pregunta.length);

}else{
	pregunta = faq[i][0];

	pregunta = pregunta.toLowerCase();

	pregunta = pregunta.charAt(0).toUpperCase() + pregunta.substring(1, pregunta.length);	
}

			cadena +='<b>&bull;</b> <A href="javascript:mostrarTerme('+i+',faq,'+contador+')" id="link'+contador+'">'+pregunta+'</a><br><br>';
			contador++;
		}
	}
}


cadena +='<div style="float:right;color:green;">';


if(com==0) cadena +=faq.length+' preguntes';
else cadena +='<font color="red">'+contador+'</font>/'+faq.length+' preguntes';

cadena +='</div><br>';

document.getElementById('divpreguntes').innerHTML = cadena;


	document.getElementById('divDefinicio').innerHTML = 'Selecciona una pregunta';




	for (i=0;i<catfaq.length;i++){
		document.getElementById('catlink'+i).style.fontWeight = 'normal';
	}



	document.getElementById('catlink'+com).style.fontWeight = 'bold';


}








function cambiarCatDesc(quin,programa){


	for (i=0;i<catdesc.length;i++){
		document.getElementById('catlink'+i).style.fontWeight = 'normal';
	}



	document.getElementById('catlink'+quin).style.fontWeight = 'bold';


switch(quin){
	case 0:
		taula = multimedia;
		break;

	case 1:
		taula = ofimatica;
		break;
	case 2:
		taula = utilitats;
		break;
	case 3:
		taula = internet;
		break;
	case 4:
		taula = nateja;
		break;
}














cadena ='                    <table cellspacing=0 cellpadding=0 width=100%>';
for(i=0;i<taula.length;i++){


	if(programa!=null){
		paraula1 = programa.toUpperCase();
		if(programa == taula[i][0]){
			nomPrograma = repStr(taula[i][0].toUpperCase(),paraula1,'<span style="background-color:yellow;">'+paraula1+'</span>');
		}
		else nomPrograma = taula[i][0];


	texte = repStr(taula[i][1].toUpperCase(),paraula1,'<span style="background-color:yellow;">'+paraula1+'</span>');



	}else{
		nomPrograma = taula[i][0];
		texte =taula[i][1];
	}



nomPrograma = nomPrograma.toLowerCase();
nomPrograma = nomPrograma.charAt(0).toUpperCase() + nomPrograma.substring(1, nomPrograma.length);

texte = texte.toLowerCase();
texte = texte.charAt(0).toUpperCase() + texte.substring(1, texte.length);

	if(taula[i][4]==null) traduccio='';
	else traduccio='<br><br><img src="img/esp.gif" width="11" height="7" align="absmiddle"> <a href="' + taula[i][4] + '">Descarregar traduccio a espanyol</a>';
	if(i==0)estil='padding-bottom:10px;';
	else estil='padding-bottom:10px;border-top:1px #C0C0C0 solid;padding-top:10px;';
	cadena +='                    <tr><td valign=top width=55 nowrap style=\"'+estil+'\"><a href="'+taula[i][2]+'" title="Descarregar"><img src="img/ico_descargues.gif" width="46" height="45" border="0"></a></td>';
	cadena +='                    <td valign=top style=\"'+estil+'\"><b>'+nomPrograma+'</b><br>';
	cadena +='                    '+texte+'<BR>';
	cadena +='                    <font color="#808080">'+taula[i][3]+'</font>'+traduccio+'</td></tr>';
}
cadena +='                    </table>';

document.getElementById('divdescargues').innerHTML = cadena;

}




function repStr(inStr, frStr, toStr) {
return inStr.split(frStr).join(toStr);
}








function mostrarResultats(){
strFaqs = new Array();
strDic = new Array();
strDesc = new Array();

contdic=0;
contfaqs=0;
contdesc=0;



if(document.getElementById('txtBuscar').value=='Escriu aqui el que vols buscar'  || document.getElementById('txtBuscar').value==''  || document.getElementById('txtBuscar').value==' '){
//	alert('Has d\'escriure alguna paraula per poder buscar');

	document.getElementById('btnclose').style.display='none';
	document.getElementById('spanResultats').style.display='none';

}else{

cadena = '';

var d=0;

paraula1 = document.getElementById('txtBuscar').value.toUpperCase();


paraula1 = repStr(paraula1,'-',' ');
paraula1 = repStr(paraula1,',',' ');



paraula2 = paraula1.split(' ');

if(paraula2.length==1)cont=1;
else{
	cont=paraula2.length+1;
//	if(paraula2[paraula2.length-1]=='')cont--;
}




for(j=0;j<cont;j++){

cadena2 = '';

if(j==0)buscar=paraula1;
else{
	buscar=paraula2[d];
	d++;
}






if(buscar !=''){
//	cont--;
//}else{





if( (j>1) || ( (j==1) && ((nDesc+nFaqs+nDic)>0) ) )cadena2+='<hr noshade size="1">';



var nDesc=0;
var nFaqs=0;
var nDic=0;






//descargues
//multimedia
for(i=0;i<multimedia.length;i++){
	if((multimedia[i][0].toUpperCase().match(buscar)!=null) ||
	   (multimedia[i][1].toUpperCase().match(buscar)!=null) ){
		//strDesc+=multimedia[i][0]+'<br>';

		strDesc[contdesc] = new Array();
		strDesc[contdesc][0]=multimedia[i][0];
		strDesc[contdesc][1]=j;
		strDesc[contdesc][2]=0;
		strDesc[contdesc][4]=buscar;
		contdesc++;
		nDesc++;
	}
}
//ofimatica
for(i=0;i<ofimatica.length;i++){
	if((ofimatica[i][0].toUpperCase().match(buscar)!=null) ||
	   (ofimatica[i][1].toUpperCase().match(buscar)!=null) ){
		//strDesc+=ofimatica[i][0]+'<br>';


		strDesc[contdesc] = new Array();
		strDesc[contdesc][0]=ofimatica[i][0];
		strDesc[contdesc][1]=j;
		strDesc[contdesc][2]=1;
		strDesc[contdesc][4]=buscar;
		contdesc++;
		nDesc++;
	}
}
//utilitats
for(i=0;i<utilitats.length;i++){
	if((utilitats[i][0].toUpperCase().match(buscar)!=null) ||
	   (utilitats[i][1].toUpperCase().match(buscar)!=null) ){
		//strDesc+=utilitats[i][0]+'<br>';


		strDesc[contdesc] = new Array();
		strDesc[contdesc][0]=utilitats[i][0];
		strDesc[contdesc][1]=j;
		strDesc[contdesc][2]=2;
		strDesc[contdesc][4]=buscar;
		contdesc++;
		nDesc++;
	}
}
//internet
for(i=0;i<internet.length;i++){
	if((internet[i][0].toUpperCase().match(buscar)!=null) ||
	   (internet[i][1].toUpperCase().match(buscar)!=null) ){
		//strDesc+=internet[i][0]+'<br>';

		strDesc[contdesc] = new Array();
		strDesc[contdesc][0]=internet[i][0];
		strDesc[contdesc][1]=j;
		strDesc[contdesc][2]=3;
		strDesc[contdesc][4]=buscar;
		contdesc++;
		nDesc++;
	}
}
//nateja
for(i=0;i<nateja.length;i++){
	if((nateja[i][0].toUpperCase().match(buscar)!=null) ||
	   (nateja[i][1].toUpperCase().match(buscar)!=null) ){
		//strDesc+=nateja[i][0]+'<br>';




		strDesc[contdesc] = new Array();
		strDesc[contdesc][0]=nateja[i][0];
		strDesc[contdesc][1]=j;
		strDesc[contdesc][2]=4;

		strDesc[contdesc][4]=buscar;
		contdesc++;
		nDesc++;
	}
}


//faqs
for(i=0;i<faq.length;i++){
	if((faq[i][0].toUpperCase().match(buscar)!=null) ||
	   (faq[i][1].toUpperCase().match(buscar)!=null) ){



		strFaqs[contfaqs] = new Array();
		strFaqs[contfaqs][0]=faq[i][0];
		strFaqs[contfaqs][1]=j;
		strFaqs[contfaqs][2]=i;
		strFaqs[contfaqs][3]=faq[i][2];
		strFaqs[contfaqs][4]=buscar;
		contfaqs++;
		nFaqs++;
	}
}

//diccionari
for(i=0;i<dic.length;i++){
	if((dic[i][0].toUpperCase().match(buscar)!=null) ||
	   (dic[i][1].toUpperCase().match(buscar)!=null) ){


		strDic[contdic] = new Array();
		strDic[contdic][0]=dic[i][0];
		strDic[contdic][1]=j;
		strDic[contdic][2]=i;
		strDic[contdic][4]=buscar;
		contdic++;
		nDic++;
	}
}








cadena2 +='<b>Resultats de "'+buscar+'"</b><br>';

if(nDesc>0)cadena2+='<a href="javascript:seleccioResultats(strDesc,'+j+',\'desc\');">Descarregues</a>: <b>'+nDesc+'</b><br>';
if(nFaqs>0)cadena2+='<a href="javascript:seleccioResultats(strFaqs,'+j+',\'faq\');">Preguntes frequents</a>: <b>'+nFaqs+'</b><br>';
if(nDic>0)cadena2+='<a href="javascript:seleccioResultats(strDic,'+j+',\'dic\');">Diccionari</a>: <b>'+nDic+'</b><br>';



if((nDesc+nFaqs+nDic)>0)cadena+=cadena2;




}
}




if((contdesc+contfaqs+contdic)==0){
	document.getElementById('spanResultats').innerHTML='<font color="red">No s\'han trobat resultats</font>';
}else{

cadena+='<br><font color="green">S\'han trobat '+(contdic+contdesc+contfaqs)+' coincidencies</font>';
	document.getElementById('spanResultats').innerHTML='<table width=100%><td width=50% valign=top style="padding-right:10px;">'+cadena+'</td><td width=50% style="padding-left:10px;border-left:1px #0369BC dotted" id="taulaResultatsOp"></td></table>';
	document.getElementById('taulaResultatsOp').style.textAlign='center';
	document.getElementById('taulaResultatsOp').style.verticalAlign='middle';
	document.getElementById('taulaResultatsOp').innerHTML='Selecciona una categoria<br>per mostrar els resultats';
}



	document.getElementById('spanResultats').style.display='';
	document.getElementById('btnclose').style.display='';
}
}












function seleccioResultats(taula,numero,tipus){


	document.getElementById('taulaResultatsOp').style.textAlign='left';
	document.getElementById('taulaResultatsOp').style.verticalAlign='top';


switch(tipus){
	case 'dic':

		cadena ='<b>Diccionari:</b><br>';
	break;
	case 'faq':

		cadena ='<b>Preguntes frecuents:</b><br>';
	break;
	case 'desc':

		cadena ='<b>Descarregues:</b><br>';
	break;
}





contres=0;


for(i=0;i<taula.length;i++){

	if(taula[i][1]==numero){

		query = taula[i][4];

		switch(tipus){
			case 'dic':
				enllas = 'obrirSeccio(\'diccionari.html\','+taula[i][2]+',1,\''+query+'\');';
		
			break;
			case 'faq':
				enllas = 'obrirSeccio(\'faq.html\','+taula[i][2]+','+taula[i][3]+',\''+query+'\');';
		
			break;
			case 'desc':
				enllas='IntrodueixPassword('+taula[i][2]+',\''+query+'\');';
		
			break;
		}


contres++;
		cadena+=contres+'- <a href="javascript:'+enllas+'">'+taula[i][0]+'</a><br>';
	}
}




	document.getElementById('taulaResultatsOp').innerHTML=cadena;

}





/*



function cambiarServei(quin){
for(i=1;i<6;i++){

if(i==quin){
	document.getElementById('serv'+i+'a').style.display='';
	document.getElementById('serv'+i).style.backgroundColor='#D7EDff';
	document.getElementById('serv'+i).style.borderColor='darkblue';
}else{


	document.getElementById('serv'+i+'a').style.display='none';
	document.getElementById('serv'+i).style.backgroundColor='white';
	document.getElementById('serv'+i).style.borderColor='white';
}}

}

*/
