function validateForm(whichbutton) {
var btton = whichbutton;
if(btton =="submit"){
with (document.form2) {
var alertMsg = "The following REQUIRED fields\nhave been left empty:\n";
str =  ActivityTitle.value;
str =  str.replace(/^\s*|\s*$/g,"");
ActivityTitle.value = str;
if (ActivityTitle.value == "") alertMsg += "\nActivity Title";
if (ContribName.value == "") alertMsg += "\nContributor Name";
if (ContribEmail.value == "") alertMsg += "\nEontributor Email";
if (Procedures.value == "") alertMsg += "\nProcedures";
if (!AttribSelf.checked && !AttribPerseverance.checked && !AttribProactivity.checked && !AttribGoal.checked && !AttribSocial.checked && !AttribEmotional.checked) alertMsg += "\nAttribute - Please select at least one.";
if (!Grkto3.checked && !Gr4to6.checked && !Gr7to9.checked && !Gr10to12.checked) alertMsg += "\nGrade - Please select at least one.";

//if (Description.value == "") alertMsg += "\nDescription";
//if (ThumbToUpload.value == "") alertMsg += "\nThumbnail";
//if (FileToUpload.value == "") alertMsg += "\nFull-size Image";
if (alertMsg != "The following REQUIRED fields\nhave been left empty:\n") {
alert(alertMsg);
return false;
} else {
return true;
//alert("test");
} } 

}
else{
with (document.form2) {
var alertMsg = "The following REQUIRED fields\nhave been left empty:\n";
str =  ActivityTitle.value;
str =  str.replace(/^\s*|\s*$/g,"");
ActivityTitle.value = str;
if (ActivityTitle.value == "") alertMsg += "\nActivity Title";
if (ContribName.value == "") alertMsg += "\nContributor Name";
if (ContribEmail.value == "") alertMsg += "\nEontributor Email";
//if (Description.value == "") alertMsg += "\nDescription";
//if (ThumbToUpload.value == "") alertMsg += "\nThumbnail";
//if (FileToUpload.value == "") alertMsg += "\nFull-size Image";
if (alertMsg != "The following REQUIRED fields\nhave been left empty:\n") {
alert(alertMsg);
return false;
} else {
return true;
//alert("test");
} } }
}
