// JavaScript Document
    var iePos  = navigator.appVersion.indexOf('MSIE');
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseFloat(navigator.appVersion.substring(iePos+5, navigator.appVersion.indexOf(';',iePos))) < 7.0))		 {
		document.write('<link href="css/ie.css" rel="stylesheet" type="text/css" />')
	}


// Routines for validating Seder Registration form
function RequiredSederRadioFilledOut(radioGroupName)
{
	var i = 0;
	var choiceFound = false;
	var el;
	while ((i < document.nvoForm.elements.length) && !choiceFound)
	{
		el = document.nvoForm.elements[i];
		// Find radio group buttons
		if ((el.name == radioGroupName) && el.checked)
			choiceFound = true;
		i++;
	}
	return choiceFound;
}



function FindSederElement(elementName)
{
	var i = 0;
	for (i = 0; i < document.nvoForm.elements.length; i++)
	{
		if (document.nvoForm.elements[i].name == elementName)
		{
			return document.nvoForm.elements[i];
		}
	}
	return null;
}



function RequiredSederItemsFilledOut()
{
	var gotOne = false;
	var regExpression = /@/g;
	el = FindSederElement("txtFirstName");
	if (el)
	{
		if (el.value == "")
		{
			alert("Please fill out all the items marked with a '*'.");
			el.focus();
			return false;
		}
	}
	el = FindSederElement("txtLastName");
	if (el)
	{
		if (el.value == "")
		{
			alert("Please fill out all the items marked with a '*'.");
			return false;
		}
	}
	el = FindSederElement("txtAddress");
	if (el)
	{
		if (el.value == "")
		{
			alert("Please fill out all the items marked with a '*'.");
			el.focus();
			return false;
		}
	}
	el = FindSederElement("txtCity");
	if (el)
	{
		if (el.value == "")
		{
			alert("Please fill out all the items marked with a '*'.");
			el.focus();
			return false;
		}
	}
	el = FindSederElement("selState");
	if (el)
	{
		if (el.selectedIndex == 0)
		{
			alert("Please fill out all the items marked with a '*'.");
			el.focus();
			return false;
		}
	}
	el = FindSederElement("txtZipCode");
	if (el)
	{
		if (el.value == "")
		{
			alert("Please fill out all the items marked with a '*'.");
			el.focus();
			return false;
		}
	}
	el = FindSederElement("txtEmailAddress");
	if (el)
	{
		if (el.value == "")
		{
			alert("Please fill out all the items marked with a '*'.");
			el.focus();
			return false;
		}
		if (!el.value.match(regExpression) && !el.value == "")
		{
			alert("Valid e-mail addresses must contain an '@' sign.");
			el.focus();
			return false;
		}
	}
	el = FindSederElement("txtPhoneNumber");
	if (el)
	{
		if (el.value == "")
		{
			alert("Please fill out all the items marked with a '*'.");
			el.focus();
			return false;
		}
	}
	el = FindSederElement("selContactMethod");
	if (el)
	{
		if (el.selectedIndex == 0)
		{
			alert("Please fill out all the items marked with a '*'.");
			el.focus();
			return false;
		}
	}
	el = FindSederElement("selSource");
	if (el)
	{
		if (el.selectedIndex == 0)
		{
			alert("Please fill out all the items marked with a '*'.");
			el.focus();
			return false;
		}
	}
	el = FindSederElement("selPaymentOption");
	if (el)
	{
		if (el.selectedIndex == 0)
		{
			alert("Please fill out all the items marked with a '*'.");
			el.focus();
			return false;
		}
	}
	el = FindSederElement("txtNumberAdults");
	el1 = FindSederElement("txtNumberChildren");
	if (el && el1)
	{
		if (el.value == "" && el1.value == "")
		{
			alert("Please fill out all the items marked with a '*'.");
			el.focus();
			return false;
		}
	}
	el = FindSederElement("radStatus");
	if (el)
	{
		if (!RequiredRadioFilledOut("radStatus"))
		{
			alert("Please fill out all the items marked with a '*'.");
			el.focus();
			return false;
		}
	}
	el = FindSederElement("radChildcare");
	if (el)
	{
		if (!RequiredRadioFilledOut("radChildcare"))
		{
			alert("Please fill out all the items marked with a '*'.");
			el.focus();
			return false;
		}
	}
	el = FindSederElement("txtChildAges");
	if (el)
	{
		if (el.value == "")
		{
			alert("Please fill out all the items marked with a '*'.");
			el.focus();
			return false;
		}
	}
	return true;
}



function Validate_Seder_Registation()
{
	if (RequiredSederItemsFilledOut())
		return true
	else
		return false;
}
// End of Seder Registration validation



// Routines to validate Invitation form
function RequiredInvitationRadioFilledOut(radioGroupName)
{
	var i = 0;
	var choiceFound = false;
	var el;
	while ((i < document.frmInvite.elements.length) && !choiceFound)
	{
		el = document.frmInvite.elements[i];
		// Find radio group buttons
		if ((el.name == radioGroupName) && el.checked)
			choiceFound = true;
		i++;
	}
	return choiceFound;
}



function FindInvitationElement(elementName)
{
	var i = 0;
	for (i = 0; i < document.frmInvite.elements.length; i++)
	{
		if (document.frmInvite.elements[i].name == elementName)
		{
			return document.frmInvite.elements[i];
		}
	}
	return null;
}



function RequiredInvitationItemsFilledOut()
{
	var gotOne = false;
	var regExpression = /@/g;
	
	el = FindInvitationElement("rgSpeaker");
	if (el)
	{
		if (!RequiredInvitationRadioFilledOut("rgSpeaker"))
		{
			alert("Please indicate who you would like to invite");
			el.focus();
			return false;
		}
	}
	
	el = FindInvitationElement("ddlService")
	if (el)
	{
		if (el.value == "")
		{
			alert("Please select a teaching or service");
			el.focus();
			return false;
		} else {
			if (el.value == "Other")
			{
				el1 = FindInvitationElement ("txtOther");
				if (el.value == "")
				{
					alert("Please indicate why you would like a visit to your congregation/group");
					el1.focus();
					return false;
				}
			}
		}
	}
	
	el = FindInvitationElement("txtDate");
	if (el)
	{
		if (el.value == "")
		{
			alert("Please suggest a date for your event");
			el.focus();
			return false;
		}
	}
	
	el = FindInvitationElement("txtFirstName");
	if (el)
	{
		if (el.value == "")
		{
			alert("Please enter your first name");
			el.focus();
			return false;
		}
	}
	
	el = FindInvitationElement("txtLastName");
	if (el)
	{
		if (el.value == "")
		{
			alert("Please enter your last name");
			el.focus();
			return false;
		}
	}
	
	el = FindInvitationElement("txtAddress");
	if (el)
	{
		if (el.value == "")
		{
			alert("Please enter your address");
			el.focus();
			return false;
		}
	}
	
	el = FindInvitationElement("txtCity");
	if (el)
	{
		if (el.value == "")
		{
			alert("Please enter your city");
			el.focus();
			return false;
		}
	}
	
	el = FindInvitationElement("selState");
	if (el)
	{
		if (el.selectedIndex == 0)
		{
			alert("Please select a state");
			el.focus();
			return false;
		}
	}
	
	el = FindInvitationElement("txtZipCode");
	if (el)
	{
		if (el.value == "")
		{
			alert("Please enter your zip code");
			el.focus();
			return false;
		}
	}
	
	el = FindInvitationElement("txtEmailAddress");
	if (el)
	{
		if (el.value == "")
		{
			alert("Please enter your email address");
			el.focus();
			return false;
		}
		if (!el.value.match(regExpression) && !el.value == "")
		{
			alert("Valid e-mail addresses must contain an '@' sign.");
			el.focus();
			return false;
		}
	}
	
	el = FindInvitationElement("txtPhoneNumber");
	if (el)
	{
		if (el.value == "")
		{
			alert("Pleae enter your phone numnber");
			el.focus();
			return false;
		}
	}
	
	el = FindInvitationElement("txtOrganization");
	if (el)
	{
		if (el.value == "")
		{
			alert("Please give us the name of your organization");
			el.focus();
			return false;
		}
	}

	el = FindInvitationElement("txtPosition");
	if (el)
	{
		if (el.value == "")
		{
			alert("Please tell us your position in your organization");
			el.focus();
			return false;
		}
	}
	
	return true;
}



function Validate_Invitation()
{
	if (RequiredInvitationItemsFilledOut())
		return true
	else
		return false;
}
// End of Invitation validation routines


// Populate Invitation request based on selected speaker
function List_Felix() {
	var el;
	
	el = FindInvitationElement("ddlService");
	
	if (el)
	{
		el.options.length = 0;
		
		el.options[el.options.length] = new Option ("Please make a selection", "", true, true);
		el.options[el.options.length] = new Option ("The Call of the Church in Zion’s Harvest", "The Call of the Church in Zion’s Harvest", false, false);
		el.options[el.options.length] = new Option ("The Appointed Home Coming of the Church Today", "The Appointed Home Coming of the Church Today", false, false);
		el.options[el.options.length] = new Option ("The Signs of Biblical Revival", "The Signs of Biblical Revival", false, false);
		el.options[el.options.length] = new Option ("The Purpose of the Biblical Feasts", "The Purpose of the Biblical Feasts", false, false);
		el.options[el.options.length] = new Option ("Understanding the One New Man", "Understanding the One New Man", false, false);
		el.options[el.options.length] = new Option ("Crossing over into the New World", "Crossing over into the New World", false, false);
		el.options[el.options.length] = new Option ("Israel the Church and Last Days", "Israel the Church and Last Days", false, false);
		el.options[el.options.length] = new Option ("Jewish Evangelism Training", "Jewish Evangelism Training", false, false);
		el.options[el.options.length] = new Option ("Teaching on the Feasts", "Teaching on the Feasts", false, false);
		el.options[el.options.length] = new Option ("Passover Seders and Tabernacles Services", "Passover Seders and Tabernacles Services", false, false);
		el.options[el.options.length] = new Option ("Other (describe below)", "Other", false, false);
	}
}


function List_Bonnie() {
	var el;
	
	el = FindInvitationElement("ddlService");
	
	if (el)
	{
		el.options.length = 0;
		
		el.options[el.options.length] = new Option ("Please make a selection", "", true, true);
		el.options[el.options.length] = new Option ("Women's Breakfast", "Women's Breakfast", false, false);
		el.options[el.options.length] = new Option ("Women's Lunch", "Women's Lunch", false, false);
		el.options[el.options.length] = new Option ("The Keys to Spiritual and Physical Health", "The Keys to Spiritual and Physical Health", false, false);
		el.options[el.options.length] = new Option ("A Jewish girl from Brooklyn to the Promised Land", "A Jewish girl from Brooklyn to the Promised Land", false, false);
		el.options[el.options.length] = new Option ("Other (describe below)", "Other", false, false);
	}
}