/*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); 
          /*marker.openInfoWindowHtml(texteglobus);*/ 
        } 
      } 
    ); 
  } 
}
function msgForm(formid)
{
  function formCallback(result, form) {
    window.status = "valiation callback for form '" + form.id + "': result = " + result;
  }

  var valid = new Validation(formid, {useTitles:true,immediate : true, onFormValidate : formCallback});
  Validation.addAllThese([]); 
}

/*inici.tpl.php*/
function activa(nbbh,total_botons,divimg) //2 següents funcions son per fer la trancicio d'imatges (sciptaculous)
{
  for(var t=1;t<=total_botons;t++) {
    if(t!=nbbh){
	  if($('img'+t).style.display != 'none'){ $('img'+t).fade();$('img'+t).className=divimg; }
	}
  }
  $('img'+nbbh).className='show '+divimg;
  $('img'+nbbh).appear();
  return false;
}

function activaNext(total_botons,divimg)
{
  var canviat = 0;
  for(var c=1;c<=total_botons;c++){
    if($('img'+c).className == "show "+divimg){
      var next = (c == total_botons) ? 1 : c+1;
      if(canviat==0){
        activa(next,total_botons,divimg);
         canviat=1;
      }
    }
  }
}

/*galeria.tpl.php*/
function imagesCarousel()
{
  vCarousel = new UI.Carousel("vertical_carousel", {direction: "vertical"});   
}

/*nishikiten.tpl.php*/
function clickSub(id,end) {
  for(var x=0;x<end;x++){ 
	if(x==id){
	  Effect.BlindDown('sub'+id, { duration: 0.8 });
	  //document.getElementById('notMAny'+id).className='notMAnyOn';
	}else{
	  Effect.BlindUp('sub'+x, { duration: 0.8 });
	  //document.getElementById('notMAny'+x).className='notMAny'; 
	}
  }
}
