(function($) {
	$(document).ready( function() {
	    $('.feature-slider a').click(function(e) {
	        $('.featured-posts section.featured-post').css({
	            opacity: 0,
	            visibility: 'hidden'
	        });
	        $(this.hash).css({
	            opacity: 1,
	            visibility: 'visible'
	        });
	        $('.feature-slider a').removeClass('active');
	        $(this).addClass('active');
	        e.preventDefault();
	    });
	});
})(jQuery);

/* Author: Anders Aarsæther */

$(document).ready(function() {

  $('a#video-lightbox-button').fancybox({
    'speedIn'       :  600,
    'speedOut'      :  200,
    'overlayShow'   :  true 
  });

});


function submitNewsletter() {

  $.ajax({
    type: 'POST',
    url: 'wp-content/themes/discovertools/api.php',
    data: $('#newsletter-form').serialize(),
    error: function() { alert("Vennligst skriv inn en e-postaddresse i feltet.") },
    success: function() { 
      alert("Du er nå meldt på nyhetsbrevet!");
      window._gaq.push(['_trackEvent', 'Nyhetsbrev', 'Abonnert', '']);
    }
  });
}

function submitCompetition() {

  $.ajax({
    type: 'POST',
    url: 'wp-content/themes/discovertools/api.php',
    data: $('#competition-form').serialize(),
    error: function() { alert("Vennligst fyll ut begge feltene.") },
    success: function() { 
      alert("Du er nå meldt på konkurransen!");
      window._gaq.push(['_trackEvent', 'Konkurranse', 'Innmeldt', '']);
    }
  });
}

function submitCompetition2() {

  $.ajax({
    type: 'POST',
    url: 'wp-content/themes/discovertools/api.php',
    data: $('#competition2-form').serialize(),
    error: function() { },
    success: function() { 
      alert("Du er nå meldt på konkurransen!");
      window._gaq.push(['_trackEvent', 'Konkurranse', 'Innmeldt', '']);
    }
  });
}







































