jQuery(document).ready(function() {

	jQuery("#donate-regular .frequency select").change(function() {
		var action = jQuery(this).val(),
		regular = [5,10,20],
		nonregular = [25,50,100];
		
		if ( action == "monthly" ) {
			
			jQuery('.donate-form .amount input').each(function(index) {
				if (index < 3) { 
					jQuery(this).val(regular[index]);
					jQuery(this).next('span').html('&pound;' + regular[index])
				}
			});
			
		} else {
			jQuery('.donate-form .amount input').each(function(index) {
				if (index < 3) {
					jQuery(this).val(nonregular[index]);
					jQuery(this).next('span').html('&pound;' + nonregular[index])
				}
			});
		}
		
	});
	
	jQuery("#customValue").keyup(function() {
		var customValue = jQuery(this).val();
		jQuery("#customAmount").val(customValue);
	});
	
	jQuery(".linklove").each(function() {
		jQuery(this).remove();
	});
	
	jQuery(".donationValues").each(function(i) { // this is for setting the amount on donations
		var values = this.id.split(" "),
		amount = values[0].split("-")[1],
		frequency = values[1].split("-")[1];
		
		jQuery('#cf2_field_4').val(amount);
		jQuery("#cf2_field_7 option[selected]").removeAttr("selected");
		jQuery("#cf2_field_7 option[value='"+frequency+"']").attr("selected", "selected"); 
		
		jQuery('#cf5_field_4').val(amount);	
	});
	

	
});
