	function cerca(){
		if((document.getElementById('paraulab').value=="")||(document.getElementById('paraulab').value=="Busca...")){
			document.getElementById('paraulab').focus();
	//	$objRespuesta->addAssign("bt_cerca","src","imgweb/lupaCercador.gif");

return false;
			return event.returnValue=false;

		}
	}

function tanca(){
	document.getElementById('paraulab').value='Busca...';
//	document.getElementById('cerca').style.visibility='hidden';

document.getElementById('cerca').className='detallHide';
}


function esenter(e){
	if(e.keyCode==13){
		net();
		xajax_getCerca(document.getElementById('paraulab').value);
		document.getElementById('bt_cerca').src='imgweb/working2.gif';
	}
}

function net()
{
	if((document.getElementById('paraulab').value=="")||(document.getElementById('paraulab').value=="Busca...")){
		document.getElementById('bt_cerca').src='imgweb/lupa.gif';
		document.getElementById('cerca').style.visibility='hidden';
	}
}


var ind=0;
function tecles(valor,e){




if(valor!="Busca..."){

		if(e.keyCode==13){
		//	window.location.href=document.getElementById('url'+(ind-1)).value+"&cerc=1";
		}


		var totals=document.getElementById('tcerca').value;
		for(j=0;j<totals;j++){
			document.getElementById('res'+j).style.backgroundColor='#e1e1e1';				
			document.getElementById('res'+j).style.color='#65635d';	
		}

		


		if((e.keyCode==40)||(e.keyCode==38)||(e.keyCode==39)||(e.keyCode==37)){


			
			if((e.keyCode==38)||(e.keyCode==37)){
				if(ind>1){
					ind=ind-2;
					document.getElementById('res'+ind).style.backgroundColor='#65635d';	
					document.getElementById('res'+ind).style.color='#ffffff';	
					ind++;
				}else{
					document.getElementById('res0').style.backgroundColor='#65635d';				
					document.getElementById('res0').style.color='#ffffff';	
				}
			}


			if((e.keyCode==40)||(e.keyCode==39)){
				if(ind<totals){
					document.getElementById('res'+ind).style.backgroundColor='#65635d';	
					document.getElementById('res'+ind).style.color='#ffffff';	
					ind++;
				}else{
					document.getElementById('res'+(totals-1)).style.backgroundColor='#65635d';				
					document.getElementById('res'+(totals-1)).style.color='#ffffff';	
				}
			}



		}else{
			ind=0;
			xajax_getCerca(valor);
		}

		}

	}
	
	function selecciona(obj) {
  if (obj.value=='-')
    obj.value = obj.getAttribute('sele');
  else
    obj.setAttribute('sele',obj.value);
}


function mostraImg(foto,txt,alcada){

	var input = document.createElement('img');
	input.style.cursor='pointer';
	input.setAttribute('alt', 'Cerrar fotografia');

var plantilla = document.createElement('div');
    plantilla.setAttribute('id', 'plantilla');

	var parent = document.getElementById('foto');


		input.onclick=function(){
			document.getElementById('frmmimatge').className='detallHide';
			document.getElementById('foto').innerHTML="<img style='margin-bottom:300px;' src='imgweb/ajax-loader.gif' />";
		}



	input.setAttribute('src', foto);
	document.getElementById('foto').innerHTML="";
	parent.insertBefore(input, null);




	document.getElementById('frmmimatge').className='detallShow';
	document.getElementById('mf').style.left="50%";
	document.getElementById('mf').style.marginLeft="-320px";
	document.getElementById('mf').style.top="50%";


//	document.getElementById('imgpreview').alt="Haz click para cerrar la foto";
//	document.getElementById('imgpreview').style.cursor='pointer';

//	document.getElementById('imgpreview').onclick=function(){
//		document.getElementById('frmmimatge').className='detallHide';
//		document.getElementById('imgpreview').src="imgweb/ajax-loader.gif";
//	}
	
	alt=parseInt(alcada/2)+50;
		document.getElementById('mf').style.marginTop="-"+alt+"px";


	if(txt){
	   document.getElementById('txtfoto').innerHTML=txt;
	}else{
	   document.getElementById('txtfoto').innerHTML="Galeria fotografica";
	}
}


function mostraVideo(codi,txt,alcada){





cadena="	  <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='425' height='353' id='video' align='middle'>";
cadena+="	    <param name='allowScriptAccess' value='sameDomain' />";
cadena+="	    <param name='allowFullScreen' value='false' />";
cadena+="	    <param name='movie' value='http://www.youtube.com/v/"+codi+"' />";
cadena+="	    <param name='quality' value='high' />";
cadena+="	    <param name='bgcolor' value='#000000' />";
cadena+="	    <embed src='http://www.youtube.com/v/"+codi+"' quality='high' bgcolor='#000000' width='425' height='353' name='video' align='middle' allowScriptAccess='sameDomain' allowFullScreen='false' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
cadena+="      </object>";



			/*cadena="<object width='425' height='353'>";
            cadena+="      	<param name='movie' value='http://www.youtube.com/v/"+codi+"'></param>";
            cadena+="        <param name='wmode' value='transparent'></param>";
            cadena+="        <embed src='http://www.youtube.com/v/"+codi+"' type='application/x-shockwave-flash' wmode='transparent' width='425' height='353'></embed>";
            cadena+="</object>";
			*/


	document.getElementById('srcvideo').innerHTML=cadena;
	document.getElementById('frmmvideo').className='detallShow';
	document.getElementById('mfvideo').style.left="50%";
	document.getElementById('mfvideo').style.marginLeft="-230px";

	document.getElementById('mfvideo').style.top="50%";

			
	alt=parseInt(alcada/2)+50;
		document.getElementById('mfvideo').style.marginTop="-"+alt+"px";


	document.getElementById('txtfotovideo').innerHTML=txt;
}


