$(document).ready(function() {

  $('.paginaFoto').lightBox();

  $('.gastenboekSchrijven').fancybox({
    overlayOpacity: 0.75
  });

  $("#schrijfFormulier").bind("submit", function() {
  	if (
      $("#naam").val().length < 1 ||
      $("#plaats").val().length < 1 ||
      $("#bericht").val().length < 1
    ) {
	    $("#schrijfFormulier .error").show();
	    $.fancybox.resize();
	    return false;
  	}

  	$.fancybox.showActivity();

	  $.ajax({
		  type		: "POST",
  		cache	: false,
	  	url		: "/php/verwerk/gastenboekSchrijven.php",
		  data		: $(this).serializeArray(),
  		success: function(data) {
	  		$.fancybox(data);
  		}
  	});

  	return false;
  });
  
  $('.itemsLijst .item .kop').click(function () {
    if(!$(this).hasClass('actief')) {
      $('.itemsLijst .item .actief').removeClass('actief');
      $(this).addClass('actief');
      //$('.itemsLijst .omschrijving:visible').slideToggle(20);
      //$(this).parent().find('.omschrijving').slideToggle(20);
			$('.itemsLijst .omschrijving:visible').fadeOut('fast');
      $(this).parent().find('.omschrijving').fadeIn('fast');
    } else {
      $('.itemsLijst .item .actief').removeClass('actief');
      //$('.itemsLijst .omschrijving:visible').slideToggle(20);
      $('.itemsLijst .omschrijving:visible').fadeOut('fast');
    }
  });
  
  $('.hoofdItem').hover(function () {
    $(this).find('.submenu').fadeIn('fast');
    $(this).addClass('extraActief');
  }, function () {
    $(this).find('.submenu').fadeOut('fast');
    $(this).removeClass('extraActief');
  });

});

function weergeefSWF(src, width, height) {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + width + '" height="' + height + '">');
		document.write('  <param name="movie" value="' + src + '">');
		document.write('  <param name=quality value=high>');
		document.write('  <param name="allowScriptAccess" value="always" />');
		document.write('  <param name="wmode" value="transparent" /><param name="SCALE" value="exactfit">');
		document.write('  <embed wmode="transparent" src="' + src + '" width="' + width + '" height="' + height + '" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit"></embed>');
		document.write('</object>');
}
