function verify(thisform) {
var themessage = "You are required to complete the following fields: ";

if (thisform.fullname.value=="") {
themessage = themessage + " - Full Name";
}
if (thisform.email.value=="") {
themessage = themessage + " -  E-mail Address";
}

//alert if fields are empty and cancel form submit
if (themessage == "You are required to complete the following fields: ") {
thisform.submit();
}
else {
alert(themessage);
return false;
   }
}

function UpdateForm (obj1) {
	if(getCheckedValue(obj1.dontype, null) == "monthly")
	{
		obj1.cmd.value="_xclick-subscriptions";
		obj1.item_name.value="Monthly Donation - Upendra Chivukula for Assembly";
		obj1.a3.value= getCheckedValue(obj1.amount, obj1.amount2);
	}
	else
	{
		obj1.cmd.value="_xclick";
		obj1.item_name.value="Upendra Chivukula for Assembly";
		if (obj1.amount[4].checked)
			obj1.amount[4].value = obj1.amount2.value;
	}

	obj1.state.value = obj1.state.value.toUpperCase();

	var themessage = "You are required to complete the following fields: ";
	if (obj1.first_name.value=="") {
	themessage = themessage + "First Name";
	}
	if (obj1.last_name.value=="") {
	themessage = themessage + " - Last Name";
	}
	if (obj1.address1.value=="") {
	themessage = themessage + " - Mailing Address";
	}
	if (obj1.city.value=="") {
	themessage = themessage + " - City"; 
	}
	if (obj1.state.value=="") {
	themessage = themessage + " - State";
	}
	if (obj1.zip.value=="") {
	themessage = themessage + " - Zip";
	}
	if (obj1.occupation.value=="") {
	themessage = themessage + " - Occupation";
	}
	if (obj1.company.value=="") {
	themessage = themessage + " - Employer";
	}
	if (obj1.emaddress1.value=="") {
	themessage = themessage + " - Employer Address";
	}
	if (obj1.emcity.value=="") {
	themessage = themessage + " - Employer City";
	}
	if (obj1.emstate.value=="") {
	themessage = themessage + " - Employer State";
	}
	if (obj1.emzip.value=="") {
	themessage = themessage + " - Employer Zip";
	}
	if (obj1.night_phone_a.value=="") {
	themessage = themessage + " - Area Code";
	}
	if (obj1.night_phone_b.value=="" || obj1.night_phone_c.value =="") {
	themessage = themessage + " - Phone";
	}
	if (obj1.amount2.value=="" && getCheckedValue(obj1.amount, obj1.amount2) == "") {
	themessage = themessage + " - Contribution Amount";	
	}
	if(obj1.night_phone_a.value.length + obj1.night_phone_b.value.length + obj1.night_phone_c.value.length !=10) {
	themessage = themessage + "\nPhone number must be 10 digits";
	}
	if(obj1.state.value.length !=2) {
	themessage = themessage + "\nState must be 2 letters";
	}
	if(obj1.emstate.value.length !=2) {
	themessage = themessage + "\nEmployer state must be 2 letters";
	}
	if(obj1.zip.value.length !=5 && obj1.zip.value.length !=9 && obj1.zip.value.length !=10) {
	themessage = themessage + "\nZip must be 5 or 9 digits";
	}
	if(obj1.emzip.value.length !=5 && obj1.zip.value.length !=9 && obj1.zip.value.length !=10) {
	themessage = themessage + "\nEmployer zip must be 5 or 9 digits";
	}

	//alert if fields are empty and cancel form submit
	if (themessage == "You are required to complete the following fields: ") {
	obj1.submit();
	}
	else {
	alert(themessage);
	return false;
	}
	obj1.os0.value = obj1.first_name.value  + " " + obj1.last_name.value + " - Address: " + obj1.address1.value + ", " + obj1.address2.value + ", " + obj1.city.value + ", " + obj1.state.value +  " " + obj1.zip.value + ", Occupation: " + obj1.occupation.value;
	obj1.os1.value = obj1.company.value + ", " + obj1.emaddress1.value + ", " + obj1.emcity.value + ", " + obj1.emstate.value +  " " + obj1.emzip.value + ", " + obj1.partner1.value + ":" + obj1.p1c.value + ", " + obj1.partner2.value + ":"+ obj1.p2c.value + ", " + obj1.partner3.value + ":" + obj1.p3c.value + ", Ph (" + obj1.night_phone_a.value + ")" + obj1.night_phone_b.value + "-" + obj1.night_phone_c.value;  
	}
		
function getCheckedValue(radioObj, other) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked)
			{
				if(radioObj[i].value=="other")
					{return other.value;}
				else
					return radioObj[i].value;
			}
	}
	return "";
}