// wait for the DOM to be loaded 
jQuery(document).ready(function() {
	set_ajax_forms();
});

function set_ajax_forms() {
	
	/**
     * Waarneming upload formulier
     */	 	 
    jQuery("#nvs-popup-form[name='waarneming']").ajaxForm({
        // target identifies the element(s) to update with the server response 
        target: '#form_holder',
 		
        // success identifies the function to invoke when the server response 
        // has been received; here we apply a fade-in effect to the new content 
        success: function() {
        	jQuery('#form_holder').fadeIn('slow');
		}
    });
    
    /**
     * Video upload formulier
     */	 	 
    jQuery("#frm_upload[name='frm_video']").ajaxForm({
        // target identifies the element(s) to update with the server response 
        target: '#overlay_content_wrapper',
 		
        // success identifies the function to invoke when the server response 
        // has been received; here we apply a fade-in effect to the new content 
        success: function() {
			jQuery('#overlay_content_wrapper').fadeIn('slow');
		}
    });
    
    
    /**
     * Redactie waarschuwen formulier
     */	 	 
    jQuery("#frm_redactie_waarschuwen").ajaxForm({
        // target identifies the element(s) to update with the server response 
        target: '#form_holder',
 		
        // success identifies the function to invoke when the server response 
        // has been received; here we apply a fade-in effect to the new content 
        success: function() {
        	jQuery('#form_holder').fadeIn('slow');
		}
    });
    
    /**
     * Redactie waarschuwen formulier
     */	 	 
    jQuery("#nvs-popup-form[name='route']").ajaxForm({
        // target identifies the element(s) to update with the server response 
        target: '#form_holder',
 		
        // success identifies the function to invoke when the server response 
        // has been received; here we apply a fade-in effect to the new content 
        success: function() {
        	jQuery('#form_holder').fadeIn('slow');
		}
    });
    
    
    /**
     * Foto upload formulier
     */	 	 
    jQuery("#frm_upload[name='frm_foto']").ajaxForm({
        // target identifies the element(s) to update with the server response 
        target: '#overlay_content_wrapper',
 		
        // success identifies the function to invoke when the server response 
        // has been received; here we apply a fade-in effect to the new content 
        success: function() {
			jQuery('#overlay_content_wrapper').fadeIn('slow');
		}
    });
    
    
    
    jQuery("#reageerknop").click(function () {
		if (jQuery("#reageerform").is(":hidden")) {
			show_captcha('captcha_reageer');
			jQuery("#reageerform").slideDown("slow");
		} else {
			jQuery("#reageerform").slideUp("slow");
		}
	});
 
	jQuery("#toon_alle_berichten_link").click(function () {
		if (jQuery("#dezeweek_berichten").is(":hidden")) {
			jQuery("#dezeweek_berichten").slideDown("slow");
			return false;
		} else {
			jQuery("#dezeweek_berichten").slideUp("slow");
			return false;
		}
	});
   
}


function load_homepage_player(video_nr) {
	jQuery('#home-video-player').load('/ajax/laad_homepage_player.ajax.php', { video_nr: video_nr });
}
