Template:2011FR/lp-form-GB-DDOptimised-GiftAid

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



 

 

 

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

* *  *

<fieldset style="border:1px solid #5EAC58;"> <legend style="font-weight: bold; font-size: 100%;"> <input type="checkbox" name="giftaid-opt" id="input_giftaid" /> <label for="input_giftaid">

<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('oneoff-please-checkbox').checked == false) { // 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('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(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'); 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 = " ";

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

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