<!--

function ConfirmDelete(sAct)
{
	var sYN = confirm("Are you sure you want to delete this record?");
	if(sYN)
	{
		var sURL = "Submit.php?Act=" + sAct;
		window.location.href= sURL;
	}
}

function ValidateNonBlank(sElID, sMsg)
{
	var el = document.getElementById(sElID).value;
	if (el == "")
	{
	       alert(sMsg);
	       return false;
	}
	else
	    return true;
}

function checkDollars(obj)
{
     var not_number = false;
     var the_char = "";
     var teststring = document.getElementById('otheramt').value;
     var valid_string = "0123456789."; // only numbers and decimal point.
     for(i=0; i<teststring.length; i++)
        {
          the_char = teststring.charAt(i);
         if (valid_string.indexOf(the_char) == -1)
           {
            not_number = true;
           }
        }
     if(not_number)
       {
       return not_number;
       }
     // now see if the decimal point is in the right place and is the only one



     if(teststring.indexOf(".") != teststring.lastIndexOf("."))
       {
        return true;   // more than one decimal point
       }
     if (teststring.lastIndexOf(".") != -1)
       {
        if (teststring.lastIndexOf(".") != teststring.length - 3)
         {
          return true;  // 9999.99  length 7, 7-3 = 4, count over starting w/ zero, in 4th postition
         }
       }

    return not_number;
}  // end checkDollars

function ValidateSignin()
{
	//volunteer
	if(!ValidateNonBlank('volunteer','Must provide a value for MemberID!'))
	       return false;

	//password
	if(!ValidateNonBlank('password','Must provide a value for password!'))
	       return false;

	return true;
}

function ValidateVolunteer()
{
	//password
	if(!ValidateNonBlank('password','Must provide a value for password!'))
	       return false;

	// pswdchk
	if(!ValidateNonBlank('pswdchk','Must provide values in both password fields!'))
	       return false;

	// firstname
	if(!ValidateNonBlank('firstname','Must provide a value for first name!'))
	       return false;

	// lastname
	if(!ValidateNonBlank('lastname','Must provide a value for last name!'))
	       return false;

	// address1
	if(!ValidateNonBlank('address1','Must provide a value for address!'))
	       return false;

	// city
	if(!ValidateNonBlank('city','Must provide a value for city!'))
	       return false;

	// state
	if(!ValidateNonBlank('state','Must provide a value for state!'))
	       return false;

	// zip
	if(!ValidateNonBlank('zip','Must provide a value for zip!'))
	       return false;

	// county
	if(!ValidateNonBlank('county','Must provide a value for county!'))
	       return false;

	var password = document.getElementById('password').value;
	var pswdchk = document.getElementById('pswdchk').value;
	if (pswdchk != password)
	{
	       alert('Password values do not match!');
	       return false;
	}

	var email = document.getElementById('email').value;
	var emailchk = document.getElementById('emailchk').value;
	if (email != email)
	{
	       alert('Email values do not match!');
	       return false;
	}

	return true;
}

function ValidateEmailSignup()
{
	// email
	if(!ValidateNonBlank('email','Must provide a value for email!'))
	       return false;

	// emailchk
	if(!ValidateNonBlank('emailchk','Must provide values in both email fields!'))
	       return false;

	var email = document.getElementById('email').value;
	var emailchk = document.getElementById('emailchk').value;
	if (email != email)
	{
	       alert('Email values do not match!');
	       return false;
	}
	return true;
}

function ValidateContactUs()
{
	//yourname
	if(!ValidateNonBlank('yourname','Must provide a value for name!'))
	       return false;

	//email
	if(!ValidateNonBlank('email','Must provide a value for email!'))
	       return false;

	//msg
	if(!ValidateNonBlank('msg','Must provide a value for the message!'))
	       return false;

	return true;
}

function ValidateEmailPswd()
{
	// email
	if(!ValidateNonBlank('email','Must provide a value for email!'))
	       return false;

	return true;
}

function ValidateNewsItem()
{
	// headline
	if(!ValidateNonBlank('headline','Must provide a value for headline!'))
	       return false;

	// showthru
	if(!ValidateNonBlank('showthru','Must provide a value for showthru!'))
	       return false;

	// newsitem
	if(!ValidateNonBlank('newsitem','Must provide a value for newsitem!'))
	       return false;

	return true;
}

function ValidateEmail()
{
	// subject
	if(!ValidateNonBlank('subject','Must provide a value for subject!'))
	       return false;

	// FCKeditor1
	if(!ValidateNonBlank('FCKeditor1','Must provide a value for the email body!'))
	       return false;
	// sendto
	var el = document.getElementById(sElID).value;
	if (el == "")
	{
		alert("You must select a recipient option!");
		return false;
	}
	switch (el)
	{
	   // county
	   case "county":
		if(!ValidateNonBlank('county','Must select a county!'))
		       return false;
		break;
	   // task
	   case "task":
		if(!ValidateNonBlank('task','Must select an interest!'))
		       return false;
		break;

	   // committee
	   case "committee":
		if(!ValidateNonBlank('committee','Must select a committee!'))
		       return false;
		break;
 	}

	return true;
}

function ValidateContribute1()
{
	//email
	if(!ValidateNonBlank('email','Must provide a value for email!'))
	       return false;

	return true;
}

function ValidateContribute2()
{
	return true;
}

function ValidateContribute3(level, sAmt)
{
	var msg;
	var errors = "";
	var haserror = false;

	if (level==0)
	{
		if(!ValidateNonBlank('otheramt','Other Amount selected but field is blank'))
			return false;

		if (checkDollars(document.getElementById('otheramt').value))
		{
			haserror = true;
			errors += "Dollar field invalid;\n\n"
		}

		if (haserror)
		{
			msg="Please correct the following error(s):\n\n";
			msg += errors;
			alert(msg);
			return false;
		}
		else
			sAmt = document.getElementById('otheramt').value;

	}

	// submit the form...
	document.getElementById('donation').value = sAmt;
	document.getElementById("ct3").submit();
}

function ContributeBackup(sRandomKey)
{
	var sURL = "Submit.php?Act=DelContribute&ID=" + sRandomKey;
	location.href=sURL;
}

function PreviewAction()
{
 	var oAction = document.getElementById('DoThis');
	oAction.value="Preview";
	document.ActionSubmit.submit();

}

function PostAction()
{
 	var oAction = document.getElementById('DoThis');
	oAction.value="Save";
	document.ActionSubmit.submit();
}

function SendAnnouncement()
{
	document.getElementById("ActionSubmit").action="Announcement.php";
	document.ActionSubmit.submit();
}

function SendAnnouncementB()
{
        window.open('Announcement.php', 'Announcement','width=1000,height=700,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes');
}

function PreviewEmail()
{
	//var oEdit = document.getElementById('EmailSubmit');
	alert('test 1');
	document.getElementById("EmailSubmit").action="AtlantaDems.php?Act=AdminEmail";
	alert('test 2');
 	document.getElementById("EmailSubmit").submit();
	alert('test 3');
}

function ControlSubmitForm(sFormName)
{
	var oForm = document.getElementById(sFormName);
 	oForm.submit();
}

function PopPreview()
{

    var sPreviewID = document.getElementById('PopPreview').value;
    var nPreviewID = parseInt(sPreviewID);
    if (nPreviewID != 0)
    {
    	sURL='Preview.php?ID=' + sPreviewID;
        window.open(sURL,'Preview','width=700,height=500,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes');
    }
}

function DisplayPhoto(sPath, sName)
{
    	sURL='Photo.php?Path=' + sPath + "&PhotoName=" + sName;
        window.open(sURL,'Photo','width=700,height=500,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes');
}

function ShowVolSearchControl()
{
	// hide them all
	document.getElementById('c_lastname').className = "Invisible";
	document.getElementById('c_county').className = "Invisible";
	document.getElementById('c_committee').className = "Invisible";
	document.getElementById('c_task').className = "Invisible";
	document.getElementById('c_email').className = "Invisible";

	// Show the one selected
	var sSelMethod = document.getElementById('SearchBy').value;
	switch(sSelMethod)
	{
		case "lastname":
			document.getElementById('c_lastname').className = "General";
			break;
		case "county":
			document.getElementById('c_county').className = "General";
			break;
		case "committee":
			document.getElementById('c_committee').className = "General";
			break;
		case "task":
			document.getElementById('c_task').className = "General";
			break;
		case "email":
			document.getElementById('c_email').className = "General";
			break;
		case "IPAddress":
			document.getElementById('c_IPAddress').className = "General";
			break;
		case "NotValidated":
			document.getElementById('c_NotValidated').className = "General";
			break;
		case "city":
			document.getElementById('c_city').className = "General";
			break;
		case "state":
			document.getElementById('c_state').className = "General";
			break;
		default:
			break;
	}
}

function AddCommitteeMember(sID)
{
	var oMemberAdd = document.getElementById('AddMember');
	oMemberAdd.className = "General";
}

function SelectChairman(sID)
{
	var oFindChairman = document.getElementById('FindChairman');
	var oChairSearch = document.getElementById('ChairSearch');

	if(oChairSearch.checked)
		oFindChairman.className = "General";
	else
		oFindChairman.className = "Invisible";
}

function BanMember(seqv)
{
	sMsg = "         *** ARE YOU SURE??? ***\n\nBanning a member will remove them from \nthe database and prevent them \nfrom ever registering again...";
	bRetVal = confirm(sMsg);
	if (bRetVal == true)
	{
		oForm = document.getElementById('Volunteer');
		oForm.action = "Submit.php?Act=BanMember&ID=" + seqv;
		oForm.submit();
	}
}

function RSVPEvent(seqv, seqmt)
{
	var sCount = prompt("How many will be attending?","1");
	if (sCount!=null && sCount!="")
	{
		sURL = "Submit.php?Act=RSVPEvent&ID=" + seqmt + "&MiscText=" + seqv + "&attending=" + sCount;
		location.href=sURL;
	}
}

function ToggleRSVPLink(seqmt)
{
	seqmt = seqmt + 0;
	if(seqmt != 0)
	{
		var oCheck = document.getElementById('rsvp');
		var oLink = document.getElementById('RSVPLink');
		if(oCheck.checked)
			oLink.className = "General";
		else
			oLink.className = "Invisible";
	}
	
function DisableButton(sButtonName)
{
	document.getElementById(sButtonName).disabled=true;
	return true;
}

}
//-->