function validateContactForm(){
	var msg = "";
	var first_name = trimAll(getObject('first_name').value);
	var last_name = trimAll(getObject('last_name').value);	
	var phone = trimAll(getObject('phone').value);
	var email = trimAll(getObject('email').value);
	var message = trimAll(getObject('message').value);
	
	msg += isEmpty(first_name) ? "First name is required.<br>" : "";
	msg += isEmpty(last_name) ? "Last name is required.<br>" : "";	
	msg += (isEmpty(phone) && isEmpty(email)) ? "Phone or Email is required.<br>" : "";		
	if (isNotEmpty(phone) || isNotEmpty(email)) {
		if (isNotEmpty(phone)) {
			msg += isUSPhone(phone) ? "" : "Invalid Phone.<br>";			
		}
		if (isNotEmpty(email)) {
			msg += isEmail(email) ? "" : "Invalid Email Address.<br>";			
		}
	}
	msg += (isEmpty(message) || (message == 'Message')) ? "Message is required.<br>" : "";
	
	if ( msg == "") {	
		getObject('errors').innerHTML =	"";	
		toggleLayer('errors',0);			
		getObject('contact_form').submit();
	}
	else {			
		toggleLayer('errors',1);
		getObject('errors').innerHTML = msg;
	}
}

function checkInterest(){

	// split the URL into URI & querystring
	var sURL = new String(document.location.href);
	var aHref = sURL.split("?");
	
	// this leaves the URI in aHref[0] and the querystring in aHref[1]
	
	// get an array of argument/value pairs
	var sQ = new String(aHref[1]);
	var aArgPairs = sQ.split("&");
	
	// this puts each "arg=val" pair into each array element
	
	// parse arg pairs
	for (var iArg = 0; iArg < aArgPairs.length; iArg++) {
		var sArgPair = new String(aArgPairs[iArg]);
		var aArg = sArgPair.split("=");
		var value = aArg[1];
		
//		alert(value);
		switch (value) {
			case "events":
			case "leadershipWorkshop":
			case "congregationalWorkshop":
			case "donate":
			case "leadership":
			case "volunteer":
				document.getElementById(value).checked = true;				
				break;																	
		}
		// this puts the parameter in aArg[0] and the value in aArg[1]
	}
}

function checkDonation(id){
	// split the URL into URI & querystring
	var sURL = new String(document.location.href);
	var aHref = sURL.split("?");
	
	// this leaves the URI in aHref[0] and the querystring in aHref[1]
	
	// get an array of argument/value pairs
	var sQ = new String(aHref[1]);
	var aArgPairs = sQ.split("&");
	
	// this puts each "arg=val" pair into each array element
	
	// parse arg pairs
	for (var iArg = 0; iArg < aArgPairs.length; iArg++) {
		var sArgPair = new String(aArgPairs[iArg]);
		var aArg = sArgPair.split("=");
		var value = aArg[1];
		
		switch (value) {
			case "general":
				getObject(id)[0].checked = true;
				break;								
			case "monthly":
				getObject(id)[1].checked = true;
				break;	
			case "tribute":
				getObject(id)[2].checked = true;
				break;					
			case "sponsership":
				getObject(id)[3].checked = true;
				break;				
			case "inkind":
				getObject(id)[4].checked = true;
				break;																		
		}
		// this puts the parameter in aArg[0] and the value in aArg[1]
	}
}
