/*contactar.tpl.php*/
function callGoogleMaps(address,texteglobus){ /*es configura i crida finestra de Google maps*/ 
  var map = null; 
  var geocoder = null;
  
  map = new GMap2(document.getElementById("Gmaps")); 
  geocoder = new GClientGeocoder(); 
  if(geocoder){ 
    geocoder.getLatLng( 
      address, 
      function(point) { 
        if (!point) { 
          alert(address + " not found"); 
        }else{ 
          map.setCenter(point, 13); 
          var marker = new GMarker(point); 
          map.addOverlay(marker); 
          //treure el globus
          //marker.openInfoWindowHtml(texteglobus); 
        } 
      } 
    ); 
  } 
}


/*nav.tpl.php*/
function slideImages(next,total){ /*es canvia el imatge que es mostra en slide*/ 
  for(var a=0;a<total;a++){
    if($('img'+a).style.display != 'none'){ $('img'+a).fade({ duration: 3.0 }); $('img'+a).className='slide_imatge'; }
  }
  $('img'+next).className='slide_imatge actiu';
  $('img'+next).appear({ duration: 3.0 });
  return false;	
}

function nextImage(total){ /*es busca el següent imatge a mostrar*/
  var canviat = 0;  
  for(var c=0;c<total;c++){
	if($('img'+c).className == "slide_imatge actiu") {
	  var next = (c == (total - 1)) ? 0 : c+1;
	  if(canviat==0) {
		slideImages(next,total);
		canviat=1;
	  }
	}
  }
}

function showImage(num,total){ /*es canvia l'imatge i l'opacitat*/
  var check=0;
  for(var a=0;a<total;a++){
    if($('imgb'+a).style.display != 'none' && a!=num){  /*entra si s'ha seleccionat imatge diferent de visualitzat. fa desepereixe aquest imatge*/
	  $('imgb'+a).fade({ duration: 0.3 });
	  $('imgb'+a).className='';
	  check=1;
	}
	if(a!=num){ $('imgs'+a).className='imagesOff'; } /*es posa la capa opaca en tots menys el seleccionat*/
  }
  $('imgs'+num).className='imagesOn';
  $('imgb'+num).className='actiu';
  $('imgb'+num).appear({ duration: 0.3 });
}
