Template:2011FR/lp-form-GB-OneOffOptimised

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



 

 

 

<input type="checkbox" name="regular-please" id="regular-please-checkbox" onchange="changeType" /><label for="regular-please-checkbox">

* *  *

<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('regular-please-checkbox').checked == true) { // DirectDebit mode //$('#donate-head').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 $('#donate-head').html(' '); $('#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(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(' '.replace('$1', '£1') ); return false; } else if ( !( !(amount>250) || !(type=='DirectDebit') ) ) { alert('Sorry, you can not donate more than £250 by Direct Debit'); return false; } else { return true; }

}

function submitForm(type) { if ( validateForm(type) ) { 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 } );