$(document).ready(function(){

  var zoekDiv = $("#zoekDiv");
  $("#searchBox").validate({
		rules: {
			email: {
				required: true,
				email: true
			}
		},
		messages: {
			email: "Please enter your email address"
		}
	});
	function theaterTrigger() {
		var layer = $("#layer");
		var maskHeight = $(document).height();  
       	var maskWidth = $(window).width();
		
		if (layer.hasClass("donkerte")) {
			layer.removeClass("donkerte");
			layer.hide();
			$("#movieOptions").show();
		} else {
			var hoogte = $("#contentWide").height() + 400;
			layer.addClass("donkerte");
			layer.show();
 			$('#layer').css({'width':maskWidth,'height':maskHeight});  
			$("#movieOptions").hide();
		}
	}
	$("#layer").click(function() {
		theaterTrigger();
	});
	
	$("#theatreLink").click(function() {		
		theaterTrigger();
	});
	
	$(document).keydown( function( e ) { 
		var code = (e.keyCode ? e.keyCode : e.which);
		 if(code == 27 && $("#layer").hasClass("donkerte")) {
	   		theaterTrigger();
		 }
	 });
	
	$("#layer.donkerte p").click(function() {
		theaterTrigger();
	});
	
	$.localScroll({hash:true, duration:300 });
	$.localScroll.hash()
	
	var jumpitem = $(".jump-item");

	$(jumpitem).live('mouseover mouseout', function(event){
	  if (event.type == 'mouseover'){
		$(this).children('h3').children('a').addClass("hoverWhite");
		$(this).children('p').children('a').addClass("hoverGrey");
	  } else {
		$(this).children('h3').children('a').removeClass("hoverWhite");
  		$(this).children('p').children('a').removeClass("hoverGrey");
	  }
	});
	
	jumpitem.click(function() {
		var link = $(this).children('h3').children('a').attr("href");
		window.location.href = link;
	});

	$(".extmax").click(function(){
		alert('aaaa');
		alert( $('extframe').contents().get(0).location.href ); 
	});
	
	$("#searchBox").submit(function(){
		zoekDiv.fadeOut("slow", function() {
			var zoekWoord = $("#zoekVeld").val();
			$.get("/?s="+zoekWoord, function(data) {
				$("#zoekRes").html(data);
				zoekDiv.fadeIn("slow");
			});
		});
		return false;
	});
	
	$(".btn_share").click(function(){
    $(this).next(".box_share").fadeIn("slow");
	});
	
	$(".link_share").click(function(){
    this.select();
  });
});
