Template:2012France/lp-form

 /* Conversion des virgules en points, interdiction des lettres */ function verificationsaisie { var amountGiven = document.getElementById('amountGiven'); var firstChar = amountGiven.value.charAt(0); if (('1' > firstChar) || ('9' < firstChar)) amountGiven.value = amountGiven.value.substr(1); amountGiven.value = amountGiven.value.replace(/[^0-9.,]/g, '').replace(/^([0-9]*[.,][0-9]*)[.,]*/g, '$1'); amountGiven.value = amountGiven.value.replace(/,/, '.'); return; }

function validateForm( form ) {

var error = true;

// Get amount selection var amount = null; for ( var i = 0; i < form.input_amount.length; i++ ) { if ( form.input_amount[i].checked ) { amount = form.input_amount[i].value; if ( amount == "Other" ) {     amount = form.amountGiven.value; }   }  }

// Check amount is a real number error = ( amount == null || isNaN( amount ) || amount.value <= 0 ); if ( amount < 5 || error ) { alert( ' ' ); error = true; } document.contribform.amount.value = Math.floor(eval(amount)*100) ; return !error; }

function redirectPayment(i) { var paymentType = "cc"; var action_url = "  ";

document.contribform.action = action_url; document.contribform.utm_source.value = getQuerystring( 'utm_source' ) + '.' + getLandingPage + '.' + paymentType;

if (validateForm(document.contribform)) { if (typeof(OWA) !== 'undefined') { OWATracker.shareStateByPost( document.contribform ); } document.contribform.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; }

document.contribform.utm_medium.value  = getQuerystring( 'utm_medium' ); document.contribform.utm_campaign.value = getQuerystring( 'utm_campaign' ); document.contribform.referrer.value    = document.referrer;