	var danDonovan = new Image(); danDonovan.src = 'images/dan_donovan.png';
	$(document).ready( function(){
		$('#confirm_amount').html('<p></p>');
		$(".colorbox").colorbox();	
		$('.specified_donation').change(function() {
			var selectedValue = $('select.specified_donation option:selected').val();
			$('#amount').attr("value",selectedValue);
			var formated_value = $().number_format(selectedValue, {
				numberOfDecimals:2,
				decimalSeparator: '.',
				thousandSeparator: ',',
				symbol: '$'});
			$('#entered_amount').attr("value",'');
			$('#confirm_amount').html('<h1>I would like to make a donation to the Donovan for DA campaign in the amount of ' + formated_value + '.</h1>');
		});
		$('#entered_amount').keyup(function() {
			var enteredValue = $('#entered_amount').val();
			var field = $('.specified_donation');
		 		field.val($('option:first', field).val());
			if ($(this).val() != "")
			     $(this).val( $(this).val().replace(/[^0-9\.$]/g, "") );
			$('#amount').attr("value",enteredValue);
			
			var formated_value = $().number_format(enteredValue, {
				numberOfDecimals:2,
				decimalSeparator: '.',
				thousandSeparator: ',',
				symbol: '$'});
			
			$('#confirm_amount').html('<h1>I would like to make a donation to the Donovan for DA campaign in the amount of ' + formated_value + '.</h1>');
		});
		
		
		$('#dan-donovan,#donate-now').delay(500).fadeIn({duration:500});
		$('#testimonials').innerfade({ 
			animationtype: 'fade',
			speed: 'slow',
			timeout: 12000,
			type: 'random',
			containerheight: '110px'
		});
		$("#slider").easySlider({
				auto: true,
				pause: 5000,
				speed: 400,
				continuous: true,
				numeric: true
			});
			$("#donate_btn").click(function() {
					// validate and process form
					// first hide any error messages
			    $('.error').hide();

				var first_name = $("input#first_name").val();
				if (first_name == "") {
			      $("label#first_name_error").show();
			      $("input#first_name").focus();
			      return false;
			    }
				var last_name = $("input#last_name").val();
				if (last_name == "") {
			      $("label#last_name_error").show();
			      $("input#last_name").focus();
			      return false;
			    }
				var address = $("input#address").val();
				if (address == "") {
			      $("label#address_error").show();
			      $("input#address").focus();
			      return false;
			    }
				var city = $("input#city").val();
				if (city == "") {
			      $("label#city_error").show();
			      $("input#city").focus();
			      return false;
			    }
				var state = $("input#state").val();
				if (state == "") {
			      $("label#state_error").show();
			      $("input#state").focus();
			      return false;
			    }
				var zip_code = $("input#zip_code").val();
				if (zip_code == "") {
			      $("label#zip_code_error").show();
			      $("input#zip_code").focus();
			      return false;
			    }
				var email = $("input#email").val();
				var confirm_email = $("input#confirm_email").val();
				if (email == "") {
			      $("label#email_error").show();
			      $("input#email").focus();
			      return false;
			    }
				if (email != confirm_email) {
			      $("label#confirm_email_error").show();
			      $("input#email").focus();
			      return false;
			    }
				var phone = $("input#phone").val();
				if (phone == "") {
			      $("label#phone_error").show();
			      $("input#phone").focus();
			      return false;
			    }
				var employer = $("input#employer").val();
				if (employer == "") {
			      $("label#employer_error").show();
			      $("input#employer").focus();
			      return false;
			    }
				var occupation = $("input#occupation").val();
				if (occupation == "") {
			      $("label#occupation_error").show();
			      $("input#occupation").focus();
			      return false;
			    }
				var amount = $("input#amount").val();
				if (amount == "") {
			      $("label#amount_error").show();
			      $("input#specified_donation").focus();
			      return false;
			    }
				});

			$(".button").click(function() {
					// validate and process form
					// first hide any error messages
			    $('.error').hide();

				  var name = $("input#name").val();
					if (name == "") {
			      $("label#name_error").show();
			      $("input#name").focus();
			      return false;
			    }
					var email = $("input#email").val();
					if (email == "") {
			      $("label#email_error").show();
			      $("input#email").focus();
			      return false;
			    }
					var phone = $("input#phone").val();
					if (phone == "") {
			      $("label#phone_error").show();
			      $("input#phone").focus();
			      return false;
			    }

var dataString = 'name='+ name + '&address=' + address + '&city=' + city + '&state=' + state + '&zip=' + zip + '&email=' + email + '&phone=' + phone + '&volunteer=' + volunteer + '&visiting=' + visiting;
				});
	});
