// JavaScript Document

		function menuOver(obj){
			obj.style.backgroundColor='#666666';
			obj.style.color='#ffffff';

		}
		function menuOut(obj){
			obj.style.backgroundColor='#c8c8c8';
			obj.style.color='#333333';
		}


function insImg(ruta,idf,altura){

 document.getElementById('mostrafoto').innerHTML="<br><br>";

	cadena="";//<div title='Galeria fotogràfica' style='cursor:pointer;position:relative;width:117px;height:25px;float:left;margin-right:1px;background-Color:#333333;padding-left:8px;padding-top:8px;color:#ef8402;' >&nbsp;Galeria fotogràfica</div>";
	
	

//<img style='position:absolute;float:right;margin-left:330px;margin-top:-40px;' src='imgweb/tanca.png'  onclick=\"document.getElementById('mostrafoto').style.height='2px';document.getElementById('mostrafoto').style.visibility='hidden';document.getElementById('gfotos').className='detallShow';self.scrollTo(0, 0);\">
if(fotos.length>1)
	{
		cadena="<div style='margin-left:190px;float:left;position:absolute;margin-top:20px;' ><img title='Fotografia anterior' onmousedown=\"canviafotoant("+idf+");\" src='imgweb/esq.png'><img title='Següent fotografia' onmousedown=\"canviafotoseg("+idf+");\" src='imgweb/dret.png'></div>";
//		cadena+="<div title='Fotografia anterior' style='position:relative;margin-right:1px;cursor:pointer;width:115px;height:25px;float:left;background-Color:#666666;text-align:center;padding-top:8px;color:#FFFFFF;' onmousedown=\"canviafotoant("+idf+");\">Anterior fotografia</div>";
//		cadena+="<div title='Següent fotografia' style='position:relative;margin-right:1px;width:115px;height:25px;float:left;background-Color:#666666;text-align:center;padding-top:8px;color:#FFFFFF;cursor:pointer;' onmousedown=\"canviafotoseg("+idf+");\">Següent fotografia</div>";
	}
	
//	cadena+="<div title='Tancar la galeria' style='position:relative;margin-right:1px;width:33px;height:25px;float:left;background-Color:#666666;color:#FFFFFF;cursor:pointer;' onclick=\"document.getElementById('mostrafoto').style.height='2px';document.getElementById('mostrafoto').style.visibility='hidden';document.getElementById('gfotos').className='detallShow';self.scrollTo(0, 0);\"><img src='imgweb/bt_tancagaleria.gif'/></div>";
	cadena+="<div style='left:5px;margin-top:2px;top:"+parseInt(altura-3)+"px;position:absolute;width:450px;height:28px;filter:alpha(opacity=80);opacity: .8;padding-top:9px;padding-left:8px;background-color:#333333;color:#ffffff;font-weight:bold;'>Imatge de "+(parseInt(idf)+1)+" de "+fotos.length+" - "+fotos[idf][4]+"</div><div></div>";
	
//	document.getElementById('mostrafoto').innerHTML="<table><tr height="+altura+"><td>"+cadena+"</td></tr></table>";




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

	var parent = document.getElementById('mostrafoto');
	parent.insertBefore(plantilla, null);


	var input = document.createElement('img');
	input.setAttribute('alt', fotos[idf][0]+'\nClica per tancar la foto');
    input.setAttribute('id', 'f3');

	input.onclick=function(){
		document.getElementById('mostrafoto').style.marginBottom="1px";
		document.getElementById('mostrafoto').style.height='2px';
		document.getElementById('mostrafoto').style.visibility='hidden';
		document.getElementById('gfotos').className='detallShow';
		self.scrollTo(0, 0);
		}


input.setAttribute('src', ruta);

parent.insertBefore(input, null);



document.getElementById('mostrafoto').style.marginBottom="75px";
document.getElementById('mostrafoto').style.height=altura+"px";
document.getElementById('mostrafoto').style.visibility='visible';//className='detallShow';

window.location.href='#img_galeria';
}
					



function canviafoto(actual){
		insImg(fotos[actual][3],actual,fotos[actual][1]);
	}


	function canviafotoseg(actual){
		seguent=parseInt(actual)+1;
		if(fotos[seguent]){
			insImg(fotos[seguent][3],seguent,fotos[seguent][1]);
		}
	}

	function canviafotoant(actual){
		seguent=parseInt(actual)-1;
		if(fotos[seguent]){
			insImg(fotos[seguent][3],seguent,fotos[seguent][1]);
		}
	}



function menuOver2(obj){
	obj.style.backgroundColor='#c8c8c8';
}

function menuOut2(obj)
{
	obj.style.backgroundColor='#666666';
}
		
		
function chg2(obj)
{

			document.getElementById("rss_h").className='detallHide';
			document.getElementById("rss").style.backgroundColor='#c8c8c8';
			document.getElementById("rss").style.color='#333333';

			document.getElementById("mitjans_h").className='detallHide';
			document.getElementById("mitjans").style.backgroundColor='#c8c8c8';
			document.getElementById("mitjans").style.color='#333333';


			document.getElementById("anuncis_h").className='detallHide';
			document.getElementById("anuncis").style.backgroundColor='#c8c8c8';
			document.getElementById("anuncis").style.color='#333333';


			document.getElementById("butlleti_h").className='detallHide';
			document.getElementById("butlleti").style.backgroundColor='#c8c8c8';
			document.getElementById("butlleti").style.color='#333333';


			dest=obj.id+"_h";
			document.getElementById(dest).className='detallShow';
			obj.style.color='#ffffff';
			obj.style.backgroundColor='#666666';		

		}




function chgtramit(obj,desti){
			document.getElementById(desti).style.color='#333333';
			obj.style.color='#ffffff';
			document.getElementById(desti).style.backgroundColor='#c8c8c8';
			obj.style.backgroundColor='#666666';		
			tmp=obj.id+"_h";
			document.getElementById(tmp).className='detallShow';
			tmp=desti+"_h";
			document.getElementById(tmp).className='detallHide';
		}
		
function amagamenu(){
	if(document.getElementById('menuturisme').innerHTML){
		document.getElementById('menuturisme').innerHTML="";
	}
}


function mostramenu(obj,idmenu){


//	document.getElementById('menuturisme').innerHTML=opcat+opesp+openg;
	document.getElementById('menuturisme').innerHTML="<div id=\"cat\" title=\"Turisme Termal · Català\" onclick=\"window.location.href='plana.php?idplana="+idmenu+"&amp;idioma=1';\" onmouseout=\"this.style.backgroundColor='#666666';\" onmouseover=\"this.style.backgroundColor='#ef8402';\" style=\"color:#ffffff;background-Color:#666666;padding:8px;cursor:pointer;text-align:center;width:90px;\">Català</div>";
	document.getElementById('menuturisme').innerHTML+="<div id=\"esp\" title=\"Turisme Termal · Castellano\" onclick=\"window.location.href='plana.php?idplana="+idmenu+"&amp;idioma=2';\" onmouseout=\"this.style.backgroundColor='#666666';\" onmouseover=\"this.style.backgroundColor='#ef8402';\" style=\"margin-top:1px;color:#ffffff;background-Color:#666666;padding:8px;cursor:pointer;text-align:center;width:90px;\">Castellano</div>";
	document.getElementById('menuturisme').innerHTML+="<div id=\"eng\" title=\"Turisme Termal · English\" onclick=\"window.location.href='plana.php?idplana="+idmenu+"&amp;idioma=3';\" onmouseout=\"this.style.backgroundColor='#666666';\" onmouseover=\"this.style.backgroundColor='#ef8402';\" style=\"margin-top:1px;color:#ffffff;background-Color:#666666;padding:8px;cursor:pointer;text-align:center;width:90px;\">English</div>";

}



		function canviaLletra(desti){
			document.getElementById('ndira').className='detallHide';
			document.getElementById('ndirb').className='detallHide';
			document.getElementById('ndirc').className='detallHide';
			document.getElementById('ndird').className='detallHide';
			document.getElementById('ndire').className='detallHide';
			document.getElementById('ndirf').className='detallHide';
			document.getElementById('ndirg').className='detallHide';
			document.getElementById('ndirh').className='detallHide';
			document.getElementById('ndiri').className='detallHide';
			document.getElementById('ndirj').className='detallHide';
			document.getElementById('ndirk').className='detallHide';
			document.getElementById('ndirl').className='detallHide';
			document.getElementById('ndirm').className='detallHide';
			document.getElementById('ndirn').className='detallHide';
			document.getElementById('ndiro').className='detallHide';
			document.getElementById('ndirp').className='detallHide';
			document.getElementById('ndirq').className='detallHide';
			document.getElementById('ndirr').className='detallHide';
			document.getElementById('ndirs').className='detallHide';
			document.getElementById('ndirt').className='detallHide';
			document.getElementById('ndiru').className='detallHide';
			document.getElementById('ndirv').className='detallHide';
			document.getElementById('ndirw').className='detallHide';
			document.getElementById('ndirx').className='detallHide';
			document.getElementById('ndiry').className='detallHide';
			document.getElementById('ndirz').className='detallHide';

			var tmp="ndir"+desti;
			document.getElementById(tmp).className='detallShow';
//			for(i=0;i<lletra.length;i++){
//				alert(lletra[i]);
//			}
		}
		
		
		function comprovaCerca(obj){
		if(obj.paraulab.value!="Cerca..."){
				if((obj.paraulab.value!="")&&(obj.paraulab.value.length>=3)){
				}else{
					alert("Has d'introduir un mínim de 3 lletres.");
					obj.paraulab.focus();
					return false;
				}

		}else{
			obj.paraulab.value="";
			obj.paraulab.focus();
			return false;	
		}

		}
		
		
		
	function goURLClick(obj,url){
		if((obj.style.backgroundColor=="#666666")||(obj.style.backgroundColor=="")){
			window.location.href=url;
		}
	}

	function goURLClick2(obj,url){

		if(obj.style.backgroundColor=="#666666"){
			window.location.href=url;
		}
	}


	

