
/* hack del puto IE para evitar el parpadeo en los rollovers */
if(document.uniqueID && !window.XMLHttpRequest ){
	document.execCommand("BackgroundImageCache",false,true)
}


/* 
	esta función es un hack para I5+/IE6
	"añade" la capacidad de hover a los elementos LI, claseándolos
*/
startList = function()
{
	// hack para IE6, evitando que quite una imagen del menu si tienes el ratón sobre el menú, al cargar la página 
	//document.getElementById("nav1").style.display = "block";
	
	/*maxFoto = new Window('winMaxFoto', {
		width:300, height:200, 
		resizable: false, minimizable: false, maximizable: false
	})*/
	$(document).ready(function() {
		$("a.fancy_group").fancybox({
			'hideOnContentClick'	: false,
			'zoomOpacity'			: true,
			'zoomSpeedIn'			: 500,
			'zoomSpeedOut'			: 500
		});
	});
	
}

window.onload=startList;

function Pagina(npagg) {
	form = document.forms["miForm"];
	form.npag.value = npagg;
	form.submit();
}

function Foto(idd,ancho,alto) {
	maxFoto.setZIndex(9);
	maxFoto.setSize(ancho,alto);
	maxFoto.setURL('foto.asp?id='+escape(idd));
	maxFoto.showCenter();
}

function ChangeDate() {
	form = document.forms["miForm"];
	if (form.search_date.value == 'dd/mm/aaaa') {
		form.search_date.value = '';
	}
	document.getElementById("search_date").className = 'campoDate';
}

function ChangeToDate() {
	form = document.forms["miForm"];
	if (form.search_todate.value == 'dd/mm/aaaa') {
		form.search_todate.value = '';
	}
	document.getElementById("search_todate").className = 'campoDate';
}

function ChangeKeyword(sValue) {
	form = document.forms["miForm"];
	if (form.search_keyword.value == sValue) {
		form.search_keyword.value = '';
	}
	document.getElementById("search_keyword").className = 'campoKeyword';
}

function getObject(objectId) { 
		// cross-browser function to get an object's style object given its id
		 if(document.getElementById && document.getElementById(objectId)) return document.getElementById(objectId); 
		 // W3C DOM
		 else if (document.all && document.all(objectId)) return document.all(objectId); 
		 // MSIE 4 DOM
		 else if (document.layers && document.layers[objectId]) return document.layers[objectId];
		 // NN 4 DOM.. note: this won't find nested layers
		 else return false; 
 }


/*********************************
Funcions Galeria Imatges - Plano
**********************************/
function bajaOpacidad(){
if(opa >= 0){
	setOpacity(document.visor, opa);
	opa -=10
	setTimeout('bajaOpacidad()',10)
	}
else{presImagen()}
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function presImagen(){
document.visor.src= srcImage;
subeOpacidad()
}
function subeOpacidad(){
if(opa <= 100){
	setOpacity(document.visor, opa);
	opa += 10
	setTimeout('subeOpacidad()',10)
	}
}

function imatgeJS(nom,src,descripcion,ancho,alto)
{
	this.nom=nom;
	this.source=src;
	this.descripcion=descripcion;
	this.ancho=ancho;
	this.alto=alto;	
}
/*********************************
Fi Funcions Galeria Imatges Plano
**********************************/

function jsHidden(id){
	  var obj = getObject(id);
	  obj.className = "hidden";
 }

/*********************************
Funcions Ocutar Div's
**********************************/
 function items(id,sNomLLista){
      var obj = getObject('item_' + id);
	  obj.className = "contenidoItem";
	  ocultaItems(id, sNomLLista);
	  
 }
 
 //Oculta tots menys id
 function ocultaItems(id, sNomLLista){
      listado = getObject(sNomLLista);
      contenedores = listado.getElementsByTagName('div')
      numContenedores = contenedores.length
      for(m=0; m < numContenedores; m++){
		 if (contenedores[m].id != "item_"+id) {
	         if(contenedores[m].id.indexOf('item_') == 0)
				 contenedores[m].className = "contenidoItemHidden";
    	     //contenedores[m].style.display = 'none';
		 }
      }
  }

