Template:2010/Donate-nowGB-DDTest2

        Select your gift amount

Frequency:

 One-time

 Monthly

 Quarterly

 <input type="button" id="directdebit-donate-button" value="Donate by Direct Debit" style="margin: 0 auto;" onclick="submitForm('DirectDebit');" />

<input type="checkbox" style="margin:0;" name="email-opt" id="input_email" checked="checked" /> <label for="input_email">

* *  *

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

<script type="text/javascript">

function updateButtons { if (document.getElementById('frequency-type-O').checked) { $('#paypal-donate-button').show; $('#directdebit-donate-button').hide; wmh_paypal.action = 'https://www.paypal.com/cgi-bin/webscr'; } else { $('#paypal-donate-button').hide; $('#directdebit-donate-button').show; wmh_paypal.action = 'http://donate.wikimedia.org.uk/dd/index.php'; } }

function submitForm(type) { // Validate 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('You must contribute at least £1'); return; }

var check_email = document.getElementById('input_email'); wmh_paypal.custom.value = getQuerystring( 'utm_medium' ) + '.' + getQuerystring( 'utm_campaign' ) + '.' + getQuerystring( 'utm_source' ) + '.' + getLandingPage + '.' + check_email.checked; if (type == 'DirectDebit') { wmh_paypal.Payer_reference.value = getQuerystring( 'utm_medium' ) + '.' + getQuerystring( 'utm_campaign' ) + '.' + getQuerystring( 'utm_source' ) + '.' + getLandingPage; wmh_paypal.action = 'http://donate.wikimedia.org.uk/dd/index.php'; } else { 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 = " ";

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

jQuery(document).ready( function( $ ) { updateButtons; } );