Revision 82493 of "Template:2011FR/lp-form-GB-DDOptimised-GiftAid2" on foundationwiki

<html>
<style type="text/css">
#amount-box td {
  white-space: nowrap;
}
fieldset {
  border: 1px solid #5EAC58;
}
#donate-buttons input {
  padding: 4px 12px;
  cursor: pointer;
}

</style>
<form id="wmh_paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="[email protected]" />
<input type="hidden" name="item_name" value="Donation to Wikimedia UK" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="return" value="https://donate.wikimedia.org.uk/thanks-gift-aid" />
<input type="hidden" name="custom" value="" />
<input type="hidden" name="Payer_reference" value="" /> <!-- for Direct Debit -->

<fieldset id="amount-box">
  <legend style="font-weight: bold; font-size: 100%;"></html>{{{gift-amount-text|Select your gift amount}}}<html></legend>
  
  <div id="oneoff-amount-options" style="display: none;" >
    <table>
      <tr>
        <td>
          <label><input type="radio" name="amount" value="</html>{{{donate-amount-0|10}}}<html>" />£</html>{{{donate-amount-0|5}}}<html></label>
        </td>
        <td>
          <label><input type="radio" name="amount" value="</html>{{{donate-amount-1|20}}}<html>" />£</html>{{{donate-amount-1|10}}}<html></label>
        </td>
        <td>
          <label><input type="radio" name="amount" value="</html>{{{donate-amount-2|50}}}<html>" />£</html>{{{donate-amount-2|20}}}<html></label>
        </td>
      </tr>
      <tr>
        <td>
          <label><input type="radio" name="amount" value="</html>{{{donate-amount-3|100}}}<html>" />£</html>{{{donate-amount-3|50}}}<html></label>
        </td>
        <td>
          <label><input type="radio" name="amount" value="</html>{{{donate-amount-4|200}}}<html>" />£</html>{{{donate-amount-4|100}}}<html></label>
        </td>
        <td>
          <label><input type="radio" name="amount" value="" id="other_button" /></html>{{{donate-amount-other|Other}}}<html>: £</label>
          <input size="2" name="customAmount" id="other_amount" onfocus="this.form.other_button.checked=true;" onchange="this.form.other_button.value = this.form.other_amount.value" />
        </td>
      </tr>
    </table>
    
    <br />
    <a href="#" onclick="changeType('regular'); return false;" id="regular-please" class="donate-body-small"></html>{{{prefer-regular|I'd prefer to make a regular donation}}}<html></a>    
  </div>

  <div id="regular-amount-options" >
    <table style="width: 16em;">
      <tr>
        <td><label><input type="radio" name="amount" id="dd-amount-0" value="</html>{{{dd-amount-0|3}}}<html>" />£</html>{{{dd-amount-0|2}}}<html></label></td>
        <td><label><input type="radio" name="amount" id="dd-amount-1" value="</html>{{{dd-amount-1|5}}}<html>" />£</html>{{{dd-amount-1|3}}}<html></label></td>
        <td><label><input type="radio" name="amount" id="dd-amount-2" value="</html>{{{dd-amount-2|10}}}<html>" />£</html>{{{dd-amount-2|5}}}<html></label></td>
      </tr>
      <tr>
        <td colspan="3">
          <label><input type="radio" name="amount" value="" id="dd_other_button" /></html>{{{donate-amount-other|Other}}}<html>: £</label>
          <input size="2" name="customAmount" id="dd_other_amount" onfocus="this.form.dd_other_button.checked=true;" onchange="this.form.dd_other_button.value = this.form.dd_other_amount.value" />
        </td>
      </tr>
    </table>
    
    <div id="dd-frequency">
      </html>{{{frequency-label|Frequency:}}}<html>
      <input type="radio" value="M" name="frequency_type" id="frequency-type-M" checked="checked" />
      <label for="frequency-type-M"></html>{{{monthly-label|Monthly}}}<html></label>

      <input type="radio" value="Q" name="frequency_type" id="frequency-type-Q" />
      <label for="frequency-type-Q"></html>{{{quarterly-label|Quarterly}}}<html></label>
    </div>
    
    <a href="#" onclick="changeType('oneoff'); return false;" id="oneoff-please" class="donate-body-small"></html>{{{prefer-oneoff|I'd prefer to make a one off donation}}}<html></a>
  </div>
  
</fieldset>

<fieldset class="donate-body-small">
  <legend style="font-weight: bold; font-size: 100%;">Make your donation go 25% further with Gift Aid:</legend>
  <input type="checkbox" name="giftaid-opt" id="input_giftaid" />
  <label for="input_giftaid">I am a UK taxpayer. Please claim Gift Aid on all donations I have made to Wikimedia UK since 3 November 2011 and in future.</label><br />
  <small>By asking us to claim Gift Aid on your donations, you agree that you pay more UK Income Tax or Capital Gains Tax than the value of the tax we reclaim on your gifts. We will use the address you supply us while making your donation for our Gift Aid records. If your circumstances or address change please let us know.<br />
  You can <a href="http://www.hmrc.gov.uk/charities/gift_aid/basics.htm" target="_blank">find out more about Gift Aid</a> on the HMRC website.</small>
</fieldset>
  
<div id="donate-buttons">
  <input type="button" id="paypal-donate-button" value="</html>{{{paypal-label|Donate by PayPal/Credit Card}}}<html>" onclick="submitForm('PayPal');" style="display: none;" />
  <input type="button" id="dd-donate-button" value="</html>{{{dd-label|Donate by Direct Debit}}}<html>" onclick="submitForm('DirectDebit');" />
</div>
<br />
<div class="donate-body-small">
  <input type="checkbox" name="email-opt" id="input_email" checked="checked" />
  <label for="input_email"></html>{{{email-option|I agree to receive occasional updates from <br/>Wikimedia UK.}}}<html></label>
  <br /><br /></html>
{{{privacy-policy-text|<html>Your personal data is subject to our <a href="//uk.wikimedia.org/wiki/Donor_Privacy_Policy" target="_blank" >privacy policy</a>.</html>}}}<br />
{{{other-ways-text|<html>For more information on other ways to give, <a href="//uk.wikimedia.org/wiki/Other_Ways_to_Give" target="_blank" >click here</a>.</html>}}}<html>
</div>

</form>

</html>

{{{chapter-text|}}}

<html>
<script type="text/javascript">
var wmh_paypal = document.getElementById('wmh_paypal');

function changeType(donationType) {
  if (donationType === 'regular') {
    // DirectDebit mode
    $('#oneoff-amount-options').hide();
    $('#regular-amount-options').show();
    
    $('#dd-donate-button').show();
    $('#paypal-donate-button').hide();
    wmh_paypal.action = 'https://donate.wikimedia.org.uk/dd/index.php';
  } else {
    // Oneoff mode
    $('#oneoff-amount-options').show();
    $('#regular-amount-options').hide();
    
    $('#dd-donate-button').hide();
    $('#paypal-donate-button').show();
    wmh_paypal.action = 'https://www.paypal.com/cgi-bin/webscr';
  }
  
  // Reset selected amount
  for ( var i = 0; i < wmh_paypal.amount.length; i++ ) {
    wmh_paypal.amount[i].checked = "";
  }
  
}

function validateForm(type) {
  var amount = null;
  for ( var i = 0; i < wmh_paypal.amount.length; i++ ) {
    if ( wmh_paypal.amount[i].checked ) {
      amount = wmh_paypal.amount[i].value;
    }
  }
  if (amount == null || amount < 1) {
      alert('</html>{{{validation-error-minimum|You must contribute at least £1}}}<html>'.replace('$1', '£1') );
      return false;
  } else if ( !( !(amount>250) || !(type=='DirectDebit') ) ) {
      alert('Sorry, you can not donate more than £250 by Direct Debit. Please contact [email protected] if you have questions.');
      return false;
  } else {
      return true;
  }
}

function submitForm(type) {  
  if ( validateForm(type) ) {
    var check_email = document.getElementById('input_email');
    var check_giftaid = document.getElementById('input_giftaid');
    var infostring = getQuerystring( 'utm_medium' ) + '.' + getQuerystring( 'utm_campaign' ) + '.' + getQuerystring( 'utm_source' ) + '.' + getLandingPage() + '.email=' + check_email.checked + '.giftaid=' + check_giftaid.checked;
    
    if (type == 'DirectDebit') {
        wmh_paypal.Payer_reference.value = infostring;
        wmh_paypal.action = 'https://donate.wikimedia.org.uk/dd/index.php';
    } else {
        wmh_paypal.custom.value = infostring
        wmh_paypal.action = 'https://www.paypal.com/cgi-bin/webscr';
    }
    
    wmh_paypal.submit();
  }
}

function getQuerystring( key ) {
  key = key.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' );
  var regex = new RegExp( '[\\?&]' + key + '=([a-zA-Z0-9\_\-]*)' );
  var qs = regex.exec( window.location.search );
  return qs == null ? '' : qs[1];
}

function getLandingPage() {
  var path = "</html>{{{landing-page|default}}}<html>";

  if( path == "default"){
     pathArray = window.location.pathname.split( '/' );
     return pathArray[2];
  }
  else return path;
}

jQuery(document).ready( function( $ ) {
  changeType('regular')
} );
</script>
</html><noinclude>
[[Category:Fundraising templates|{{PAGENAME}}]]
</noinclude>