
/* ---------------------------------------------------------------------------------- */
/* ----- Functies: onLoad ----------------------------------------------------------- */
/* ---------------------------------------------------------------------------------- */

$(document).ready(function() {
  initCarousel();     // Carousel activeren
  initPrintButton();  // Print-knop activeren
  initOverviews();    // Volledig aanklikbare overzicht-items activeren

  if ($("#validateSummary").is(":visible")) {
      $('html, body').animate({
        scrollTop: $(document).height()
    },0);
  }
});


/* ---------------------------------------------------------------------------------- */
/* ----- Functies: Algemeen --------------------------------------------------------- */
/* ---------------------------------------------------------------------------------- */

// Zoekfunctie uitvoeren bij enter-toets
function submitenter(e, t) {
  if ((document.layers ? evt.which : e.keyCode) == 13) {
    document.location.href = "/pages/zoek.aspx?z=" + $("#tbxZoeken").val() + "&t=" + t;
    return false;
  }
  $("#imbZoeken").click(function() { document.location.href = "/pages/zoek.aspx?z=" + $("#tbxZoeken").val() + "&t=" + t; });
  return true;
}

// Carousels activeren (home en vervolg)
function initCarousel() {
  if ($.isFunction($.fn.innerFade) && ($("#carousel-top li").length > 1)) {
    $("#carousel-top").innerFade({
      timeout: "8000",
      startDelay: "8000",
      indexContainer: "#carousel-top-controls"
    });
  } else {
    $("#carousel-top-controls").hide();
  }
}

// Print-knop activeren
function initPrintButton() {
  $("#button-print").click(function () {
    window.print();
  });
}

// Volledig aanklikbare overzicht-items activeren
function initOverviews() {
  $("#main ul[class^='overview'] li").has("a").click(function(e) {
    e.stopPropagation();
    if ($(this).find("a:eq(0)").attr("target") != "_blank") {
      document.location.href = $(this).find("a:eq(0)").attr("href");
    } else {
      window.open($(this).find("a:eq(0)").attr("href"));
    }

  });
}






/* ------------------------------------------------------------------ */
/* --- Functies: Twitter -------------------------------------------- */
/* ------------------------------------------------------------------ */

function initTwitter() {
  if ($(".twitterberichten").length > 0) {
    $('.twitterberichten').jcarousel({
      vertical: true,
      scroll: 1,
      auto: 6,
      wrap: 'last',
      buttonNextHTML: null,
      buttonPrevHTML: null
    });
  }
}





$(document).ready(function() {
  // Get latest 6 tweets by jQueryHowto
    $(".twitterberichten").tweet({
        count: 4,
        query: "from:tielbeke_bv",
        loading_text: "Laden van tweets..."
      }); 
     setTimeout(function()
     {
      initTwitter();
     },5000);
	   
	   
});
