jQuery(document).ready(function() {
	//Set default open/close settings
        jQuery('.acc_container').hide(); //Hide/close all containers
        jQuery('.acc_trigger:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container

        //On Click
        jQuery('.acc_trigger').click(function(){
            if( jQuery(this).next().is(':hidden') ) { //If immediate next container is closed...
                    jQuery('.acc_trigger').removeClass('active').next().slideUp(); //Remove all "active" state and slide up the immediate next container
                    jQuery(this).toggleClass('active').next().slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
            }
            return false; //Prevent the browser jump to the link anchor
        });

        //For ALL of the contact forms
        jQuery("#contactform").validationEngine({
            ajaxSubmit: true,
            ajaxSubmitFile: "/wp-content/plugins/af-portal/form-processor.php",
            ajaxSubmitMessage: "Thank you, we received your inquiry!",
            success :  false,
            failure : function() {
                jQuery('#uniform-contact_submit').show();
                jQuery('#contact_ajax_submit').hide();
            }
        });

        jQuery('#contact_submit').click(function() {
            jQuery('#uniform-contact_submit').hide();
            jQuery('#contact_ajax_submit').show();
        });

        //For the comment forms
        jQuery("#commentform").validationEngine();

        //for the mailchimp forms
        jQuery("#mc-embedded-subscribe-form").validationEngine();

        //for all forms
        jQuery("input, textarea, select, button").uniform();


});

