// jQuery page load function
$(document).ready(function() {
	if( $("#donationForm").length > 0 )
	{
		$("#donationForm").validate();

		if( $("#donationForm #amOther").attr('checked') )
		{
			$("#donationForm #otherAmountWrapper").show();
			$("#donationForm #amount").focus();  
		}

		// Honor of text
		$("#donationForm #No").click(function() {
			$("#donationForm #cn").val("");
		});
		$("#donationForm #InMemory").click(function() {
			$("#donationForm #cn").val("In Memory of:");
		});
		$("#donationForm #InHonor").click(function() {
			$("#donationForm #cn").val("In Honor of:");
		});

		// Amounts
		$("#donationForm #am25").click(function() {
			$("#donationForm #amount").val("25");
			$("#donationForm #otherAmountWrapper").hide();
		});
		$("#donationForm #am50").click(function() {
			$("#donationForm #amount").val("50");
			$("#donationForm #otherAmountWrapper").hide();
		});
		$("#donationForm #am100").click(function() {
			$("#donationForm #amount").val("100");
			$("#donationForm #otherAmountWrapper").hide();
		});
		$("#donationForm #am250").click(function() {
			$("#donationForm #amount").val("250");
			$("#donationForm #otherAmountWrapper").hide();
		});
		$("#donationForm #am1000").click(function() {
			$("#donationForm #amount").val("1000");
			$("#donationForm #otherAmountWrapper").hide();
		});
		$("#donationForm #amOther").click(function() {
			$("#donationForm #amount").val("1000");
			$("#donationForm #otherAmountWrapper").show();
			$("#donationForm #amount").focus();  
		});
	}

    if( $("#search input.itxt").length > 0 )
    {
    	$("#search input.itxt").focus(function() {
    	    if ($(this).val() == "Search...") {
    	        $(this).val('');
    	    }
    	});

    	$("#search input.itxt").keydown(function(e) {
    	  var code = (e.keyCode ? e.keyCode : e.which);
    	  if(code == 13) {
    	    window.location = "/search.aspx?search=" + $("#search input.itxt").val();
   	    e.cancelBubble = true;
    	    return false;
    	  }
    	});

    	$("#search input.isub").click(function(e) {
    	  window.location = "/search.aspx?search=" + $("#search input.itxt").val(); 
    	});
    }

});
