$(function(){

	$('#donation_amount').focus();
	
	if(document.location.hash.slice(1).length && !isNaN(document.location.hash.slice(1))){
		hashindex=document.location.hash.slice(1)-1;
		$('.casestudy, .shoppinglist').removeClass("active");
		$('.casestudy:eq('+hashindex+'), .shoppinglist:eq('+hashindex+')').addClass("active");
	}

	$('form.donation').submit(function(){
		$(this).attr("action",$(this).find('input:checked').val());
		if($(this).find('donation_frequency_monthly:checked').length){
			pageTracker._trackPageview('/donation/external_direct_debit_donation_form.rm');
		}		
		return true;
	});
	
	$('.donation .input').bind("click",function(){
		$(this).find('input.amount').focus();
	});
	
	$('.donation input.amount').bind("change keydown",function(){
		$(this).val($(this).val().replace(/[^0-9]/g,''));
	});
	
	$('.exampleamount span').click(function(){
		$('.donation input.amount').val($(this).html().replace(/[^0-9]/g,''));
	});
	
});
