// 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="";
/*
	document.getElementById('gfotos').className='detallHide';
	var nwimg=new Image();
	nwimg.src=ruta;
	document.getElementById('mostrafoto').style.height=altura+"px";
	document.getElementById('mostrafoto').style.height=nwimg.height;
*/
	cadena="<div style='position:relative;width:120px;height:25px;float:left;margin-right:1px;background-Color:#333333;padding-left:8px;padding-top:8px;color:#ef8402;' >Gestor d'imatges</div>";
	if(fotos.length>1)
	{
		cadena+="<div title='Fotografia anterior' style='position:relative;margin-right:1px;cursor:pointer;width:115px;height:25px;float:left;background-Color:#666666;padding-left:8px;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;padding-left:8px;padding-top:8px;color:#FFFFFF;cursor:pointer;' onmousedown=\"canviafotoseg("+idf+");\">Següent fotografia</div>";
	}
	cadena+="<div title='Tancar el gestor' 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>";
	if(fotos.length<=1)
	{
		cadena+="<div style='float:left;width:300px; height:33px;'></div>";
	}
	cadena+="<div style='left:0px;top:"+parseInt(altura-3)+"px;position:absolute;width:592px;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][0]+"</div><div></div>";

/*
	cadena="<div title='Galeria fotogràfica' style='cursor:pointer;position:relative;width:200px;float:left;margin-right:1px;background-Color:#333333;padding-left:8px;padding-right:8px;height:33px;color:#ef8402;' ><img src='imgweb/imagegallerygif.gif' align=\"absmiddle\"	/> Imatges</div>";
	if(fotos.length>1)
	{
		cadena+="<div title='Fotografia anterior' style='position:relative;margin-right:1px;cursor:pointer;float:left;background-Color:#666666;padding-left:6px;padding-right:6px;color:#FFFFFF;height:33px;' onmousedown=\"canviafotoant("+idf+");\"><img src='imgweb/back.gif'/></div>";
		cadena+="<div title='Següent fotografia' style='position:relative;margin-right:1px;float:left;background-Color:#666666;padding-left:6px;padding-right:6px;height:33px;color:#FFFFFF;cursor:pointer;' onmousedown=\"canviafotoseg("+idf+");\"><img src='imgweb/foward.gif'/></div>";
	}
	
	cadena+="<div title='Tancar la galeria' style='position:relative;margin-right:1px;width:33px;height:25px;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';\"><img src='imgweb/bt_tancagaleria.gif'/></div>";
	cadena+="<div style='left:0px;top:"+parseInt(altura-3)+"px;position:absolute;width:592px;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+"</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', 'Clica per tancar la foto');
	input.onclick=function()
	{
		document.getElementById('mostrafoto').style.height='2px';
		document.getElementById('mostrafoto').style.visibility='hidden';
		document.getElementById('gfotos').className='detallShow';
	}
	input.setAttribute('src', ruta);
    parent.insertBefore(input, null);

	document.getElementById('mostrafoto').style.height=altura+"px";
	document.getElementById('mostrafoto').style.visibility='visible';//className='detallShow';
	//alert(document.getElementById('mostrafoto').style.posHeight);
	//self.scrollTo(0, document.getElementById('mostrafoto').style.posHeight+250);
	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>";
	document.getElementById('menuturisme').innerHTML+="<div onmouseover=\"amagamenu();\" style=\"height:30px;margin-top:1px;color:#ffffff;padding:8px;cursor:pointer;text-align:center;width:90px;\"></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;	
		}

		}
		
	
