jQuery.noConflict(); function form_swap_values(){ swapValues = []; jQuery(".swap_value").each(function(i){ swapValues[i] = jQuery(this).val(); jQuery(this).focus(function(){ if (jQuery(this).val() == swapValues[i]) {jQuery(this).val("");} }).blur(function(){ if (jQuery.trim(jQuery(this).val()) == "") {jQuery(this).val(swapValues[i]);} }); }); } function form_input_classes(){ jQuery('input[name=email]').addClass('input_email'); jQuery('input[name=firstname]').addClass('input_firstname'); jQuery('input[name=lastname]').addClass('input_lastname'); jQuery('input[name=addr1]').addClass('input_addr1'); jQuery('input[name=addr2]').addClass('input_addr2'); jQuery('input[name=city]').addClass('input_city'); jQuery('input[name=zip]').addClass('input_zip'); jQuery('select[name=state_cd]').addClass('select_state_cd'); jQuery('select[name=country]').addClass('select_country'); jQuery('input[name=phone]').addClass('input_phone'); jQuery('input[type="text"]').addClass('text'); jQuery('input[type="password"]').addClass('text'); jQuery('input[type="checkbox"]').addClass('checkbox'); jQuery('input[type="radio"]').addClass('radiobutton'); jQuery('input[type="submit"]').addClass('submit'); jQuery('input[type="image"]').addClass('buttonImage'); } jQuery(function() { jQuery('div.bodies > div').slideUp(0); jQuery('div.bodies > div').slideUp(0); jQuery('div.bodies > h3').click(function() { jQuery(this).next('div').slideDown('fast') .siblings('div:visible').slideUp('fast'); }); }); jQuery(function($) { form_swap_values(); form_input_classes(); }); jQuery(function(){ var urlDonate = window.location; var donatePage = /\.ie\/page\/content\/donate/; if(donatePage.test(urlDonate)){ //assign a name to the main domate form jQuery('form[action=https://www.paypal.com/cgi-bin/webscr]').attr('name', 'mainDonate'); //create a variable for the submit button var submit = jQuery('form[name=mainDonate] input[type=submit]'); //create a variable for the radio group var radios = jQuery('input[name=amount]'); //create a variable for the other amount input var otherAmnt = jQuery('form[name=mainDonate] input[type=text]'); //set the submit button to 50% opacity jQuery(submit).animate({ opacity: .4 }, 0); //set the submit button to do nothing when clicked submit.onclick = function(){ return false; } function validate(){ var radiosChecked = 0; var amount = 0; var checks = 0; for(var i = 0; i < radios.length; i++){ if(radios[i].checked){ radiosChecked = 1; }; } if(radiosChecked == 1 || otherAmnt.value != undefined || otherAmnt.value != '' || otherAmnt.value != null){ amount = 1; } if(document.getElementById('citizen').checked && document.getElementById('maximum').checked){ checks = 1; } if(amount == 1 && checks == 1){ jQuery(submit).animate({ opacity: 1 }, 0); submit.onclick = function(){ return true; } } else{ jQuery(submit).animate({ opacity: .4 }, 0); submit.onclick = function(){ return false; } } } jQuery('input[value=5],input[value=10],input[value=25],input[value=50], input[name=is_citizen], input[name=is_maximum]').click(function(){ validate(); }); jQuery('input[type=text][name=amount]').blur(function(){ validate(); }); }; });