$(document).ready(function(){

$("#download-popup").load("stahnout.html #colourbox-stahnout-form", function(){
  //function executed when load is done.
  alert ("sdfdsf");
});


	$("#kontakt-popup").hide(0);
	
  $("#link-kontakt").click(function(){
    $("#kontakt-popup").slideDown(1000).show();
  });
	
	$("#page").click(function(){
    $("#kontakt-popup").slideUp(1000);
  });
  
  $("#kontakt-popup-close").click(function(){
    $("#kontakt-popup").slideUp(1000);
  });
  
  	$(document).keyup(function(event){
    if (event.keyCode == 27) {
        $("#kontakt-popup").fadeOut(1000);
    }
});
	
	// Form popup
	
   $('#link-form-popup').click(function(){
    $("#form-popup").fadeIn(1000).show();
	$("#popup-bg-full").fadeIn(1000).show();
    return false;
  });
	
	$(document).keyup(function(event){
    if (event.keyCode == 27) {
        $("#form-popup").fadeOut(1000);
		$("#popup-bg-full").fadeOut(1000);
    }
});
	
	$("#form-popup-close").click(function(){
    $("#form-popup").fadeOut(1000);
	$("#popup-bg-full").fadeOut(1000);
  });
  
  $("#form-popup").click(function(){
    $("#form-popup").fadeOut(1000);
	$("#popup-bg-full").fadeOut(1000);
  });	
  
  $("#popup-bg-full").click(function(){
    $("#form-popup").fadeOut(1000);
	$("#popup-bg-full").fadeOut(1000);
  });	
  
  // /Form popup
  
  
  // Newsletter popup
  
  $("#newsletter-info-popup-open").click(function(){
    $("#newsletter-info-popup").fadeIn(1000).show();
  });
  
  $("#newsletter-info-popup-close").click(function(){
    $("#newsletter-info-popup").fadeOut(1000);
  });
  
  $(document).keyup(function(event){
    if (event.keyCode == 27) {
        $("#newsletter-info-popup").fadeOut(1000);
    }
});

	// /Newsletter popup
	
	$('.link-colorbox-stahnout').click(function(){
		$("#download-popup").fadeIn(1000).show();
		$("#popup-bg-full").fadeIn(1000).show();
    return false;
  });
  
});
