/**
 * @file
 */

(function ($) {

/**
 *  
 */
Drupal.behaviors.donate = {
  attach: function (context, settings) {   
        $('div.donate-sponsor-div-radio-form input.form-radio', context).click(function () {
            if (this.value == "Sponsor Sarv Jvar Har Churna") {
                var pouch = 1;
                var amt = pouch * 20;
                $('div.donate-sarvjhc', context).show();
                $('div.donate-sarvjhc-no-pouch', context).show();
                $('div.donate-sarvjhc-no-pouch input', context).val(pouch);
                $('div.donate-amount-value input', context).val(amt);
                $('div.donate-amount-value input', context).attr("readonly", true);
            } else {
                var empty = "";
                $('div.donate-sarvjhc', context).hide();
                $('div.donate-sarvjhc-no-pouch', context).hide();
                $('div.donate-sarvjhc-no-pouch input', context).val(empty);
                $('div.donate-amount-value input', context).val(empty);
                $('div.donate-amount-value input', context).attr("readonly", false);
            }
        }); 
        
        $('div.donate-sarvjhc-no-pouch input.form-text', context).keyup(function () {
                var noofpouches = this.value;
                var amount = noofpouches * 20;
		$('div.donate-amount-value input', context).val(amount);  
        }); 
  }
};
 

})(jQuery);



