
$(document).ready(function() {

  $('a.top').click(function(){
    $('html,body').animate({scrollTop:0},'slow');
    return false;
  });

  $('#language').change(function() {
    location.href= $('#language option:selected').attr('title');
  });

  $('.send_form').click(function() {
    $('#'+$(this).parents("form").attr("id")).submit();
  });


  $('.check_form').click(function(evento) {
    if(check_form()) {
      $('#'+$(this).parents("form").attr("id")).submit();
    } else {
      evento.preventDefault();
    }
  });

  $('.delete_form').click(function(evento) {
    delete_form();
    evento.preventDefault();
  });

  //colorbox per a mapa contacte
    $("a[rel='colorbox-html']").colorbox({width:"650",height:"650", iframe:true});
  

  // Shadowbox

    /*ShadowBox*/
Shadowbox.init({
continuous: true,
overlayColor: "#fff",
overlayOpacity: 0.9
});

  $('a.open_gal').click(function() {
    var gal = document.getElementById('firstInGallery');
    Shadowbox.open(gal);
    return false;
  });


  // Slider
  $('.anythingSlider').anythingSlider({
    easing:"easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
    autoPlay:true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
    delay:2500,                    // How long between slide transitions in AutoPlay mode
    startStopped:false,            // If autoPlay is on, this can force it to start stopped
    animationTime:600,             // How long the slide transition takes
    buildNavigation:true           // If true, builds and list of anchor links to link to each slide
  });


}); 
/**
 * Enviar formulari
 */

function send_form(name) {
document.getElementById(name).submit();
}

