/*

    Plugin: fn.qanda  - question and answer

    Image in question will toggle answer in following block. 

    Optional image in answer will hide answer.

    Examples:

   
    $(document).ready(function() {
        $(".formSectionQuestion").qanda();
    });
 

    1.

    <p class="formSectionQuestion ">Is this a single application or a group application?<img src="/images/icons/Info2.png" height="20" width="20" class="moreinfo" /></p>
            
    <div>Group applications attract a fee of £99 plus VAT per member of the group awarded the Mark <img src="/images/icons/Cancel.png" height="16" width="16" class="closepopup" /></div>


    2.
    
    <div  class="formSectionQuestion">Is this alright? ?<img src="/images/icons/Info2.png" height="20" width="20" class="moreinfo" /></div>

    <p>YES!!!!!!!!!!!</p>



    Author: Stephen Fenwick-Paul
*/




(function($) {

    $.fn.qanda = function(options) {

          options = $.extend({
                    debug : 0
                    }, options || {});

           $(this).each( function () {

                var question = this; // This the question - would expect this to be a block. E.g. <div> or a <p>
        
                var answer = $(this).next(); // The next entity after the question - wouild expect this to be block. E.g. <div> or <p> etc.

                // Hide it as we have javascript running
                answer.hide();

                $(question).find("img").css("cursor", "pointer").bind("click", function() {
                        answer.toggle();
                });

                $(answer).find("img").css("cursor", "pointer").bind("click", function() {
                        answer.hide();
                 });


           });
    };

 })(jQuery);

