Template:2010/Donate-nowGB-DDTest2-B

 white-space: nowrap; }        
 * 1) amount-box td {

Select your gift amount

Frequency:  Monthly

 Quarterly

 

<input type="checkbox" name="dd-please" id="dd-please-checkbox" onchange="changeType" /><label for="dd-please-checkbox">I'd prefer to make a regular donation

* *  *

<input type="checkbox" name="email-opt" id="input_email" checked="checked" /><label for="input_email">

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

function changeType { if (document.getElementById('dd-please-checkbox').checked) { // DirectDebit mode $('#Make_your_donation_now').html('Make a regular donation');

$('#oneoff-amount-table').hide; $('#dd-amount-table').show; $('#dd-frequency').show; $('#dd-donate-button').show; $('#paypal-donate-button').hide; wmh_paypal.action = 'https://donate.wikimedia.org.uk/dd/index.php'; } else { // Oneoff / PayPal mode $('#Make_your_donation_now').html('Make your donation now'); $('#oneoff-amount-table').show; $('#dd-amount-table').hide; $('#dd-frequency').hide; $('#dd-donate-button').hide; $('#paypal-donate-button').show; wmh_paypal.action = 'https://www.paypal.com/cgi-bin/webscr'; } // Reset selected for ( var i = 0; i < wmh_paypal.amount.length; i++ ) { wmh_paypal.amount[i].checked = "" } }

function validateForm { // 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 false; } else { return true; }

}

function submitForm(type) { if ( validateForm ) { 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 = 'https://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( $ ) { changeType } );