	
	// annual appeal
	function annualAppeal() {
		document.getElementById('Designated').style.display = 'none';
		document.getElementById('Tribute').style.display = 'none';
	}
	
	// designated gift
	function designatedGift() {
		document.getElementById('Designated').style.display = document.getElementById('dg').checked ? 'block' : 'none';
		document.getElementById('Tribute').style.display = 'none';
	}
	
	// tribute {
	function tribute() {
		document.getElementById('Tribute').style.display = document.getElementById('tg').checked ? 'block' : 'none';
		document.getElementById('Designated').style.display = 'none';
	}
	
	
	//validation
	
	function ValidationGroup() {
		this.fields = new Array();
	}
	
	ValidationGroup.prototype.validate = function () {
		for(var i = this.fields.length - 1; i >= 0; i--) {
			var field = document.getElementsByName(this.fields[i])[0];
			if(field.tagName == 'INPUT') {
				if(field.value == '')
					return false;
			} else if(field.tagName == 'SELECT') {
				if(field.selectedIndex == 0)
					return false;
			}
		}
		
		return true;
	}

	function validate() {
		
		if(!document.getElementById('tg').checked)
			return true;
		
		if(!(inMemoryOf.validate() || inHonorOf.validate())) {
			alert('Please complete the requested Tribute information.');
			return false;
		}
		
		return true;
	}
	
	function otherEntered(ev) {
		document.getElementById('amountOther').checked = true;
	}
	
	function init() {
		EventDefs.get('#amountOtherValue', 'onfocus').bind(otherEntered);
	
		inMemoryOf = new ValidationGroup();
		inMemoryOf.fields = [
			'tributeMemoryName',
			'tributeMemoryNextofKin',
			'tributeMemoryAddress',
			'tributeMemoryCity',
			'tributeMemoryZip'
			];
		
		inHonorOf = new ValidationGroup();
		inHonorOf.fields = [
			'tributeHonorName',
			'tributeHonorAddress',
			'tributeHonorCity',
			'tributeHonorZip'
			];
			
		var onSubmit = EventDefs.get('input[type=submit]','onclick');
		onSubmit.bind(validate);
		
		//onloadList.push(disableField);
	}
	
	init();
