var iSingleNightCount = 1

function setemailfocus()
{
	document.joinapp.memberemail.select()
}

function myalert(i)
{
	switch(i)
	{
	case 1:alert("Name: First name and last name. Middle name or initial if you like.")
	break
	case 2:alert("DOB: date of birth. Format is day / month / year.")
	break
	case 3:alert("Your home phone number with your STD code e.g. 07 892 3843.")
	break
	case 4:alert("Your work phone number with your STD code e.g. 07 892 3843.")
	break
	case 5:alert("Your mobile phone number with your STD code e.g. 027 375 7754.")
	break
	case 6:alert("email address for the individual member.")
	break
	case 7:alert("Your occupation - this way we can call on your skills to help the club.")
	break
	case 8:alert("Enter skier or boarder or both if you do both.")
	break
	case 9:alert("Enter Beginner, Intermediate or Advanced.")
	break
	case 10:alert("We are looking for: heard from a friend, friend is a member, Internet search, went past club on chair etc.")
	break
	case 11:alert("Single, Family or One Parent Family.")
	break
	case 12:alert("The rules page link will open in a new window.")
	break
	case 13:alert("The rates page will open in a new window.")
	break
	case 14:alert("Rule 3 b viii) Single Parent Family membership shall include, in addition to the parent, all children of his or her family who are aged under 25 on the 31st day of March in the current year and who are registered with the Club. It does not include families with two parents where one parent never uses the club's facilities. This membership shall pay the same fees as an Ordinary Single member.")
	break
	case 15:alert("The post code finder at nz post will open in a new window.")
	break
	case (1==1):alert(i)
	break
	}
}

var iSubmitCount=0;
function CheckSubmitted() {
	if (iSubmitCount >= 1)
		{
		alert("Your application is being submitted as we speak.  Just click once only. Thanks!");
		return false;
		}

	if (document.joinapp.membername.value == "e.g. Mr Joe & Mrs Jane Bloggs" || document.joinapp.membername.value == "")
		{
		alert("Please enter your membership name and try again.")
		document.joinapp.membername.select()
		return false
		}

	if (document.joinapp.memberemail.value == "email address" || document.joinapp.memberemail.value == "")
		{
		alert("Please enter your email address.")
		document.joinapp.memberemail.select()
		return false
		}

	if (document.joinapp.memberemail.value.length <= 5)
		{
		alert("You must enter a valid email address.")
		document.joinapp.memberemail.select()
		return false
		}

	if (document.joinapp.address1.value == "")
		{
		alert("Please enter at least two address lines.")
		document.joinapp.address1.select()
		return false
		}

	if (document.joinapp.address2.value == "")
		{
		alert("Please enter at least two address lines.")
		document.joinapp.address2.select()
		return false
		}

	if (document.joinapp.name1.value == "")
		{
		alert("Please enter at least one member name.")
		document.joinapp.name1.select()
		return false
		}

	if (document.joinapp.howheard.value == "")
		{
		alert("Please enter how you heard about us.")
		document.joinapp.howheard.select()
		return false
		}

	if (document.joinapp.memtype.value == "")
		{
		alert("Please enter member type of Single, Family or One Parent Family.")
		document.joinapp.memtype.select()
		return false
		}

	if (document.joinapp.rulesagree.value == "")
		{
		alert("We need you to follow the rules. Will you?")
		document.joinapp.rulesagree.select()
		return false
		}

	if (document.joinapp.subdue.value == "")
		{
		alert("Please enter your subscription amount.")
		document.joinapp.subdue.select()
		return false
		}

	if (document.joinapp.memtype.value.toLowerCase() == "one parent family" && document.joinapp.singleagree.value == "")
		{
		alert("Please accept the conditions around one parent family.")
		document.joinapp.singleagree.select()
		return false
		}

	if (document.joinapp.oneparentfamily.checked == false && document.joinapp.memtype.value.toLowerCase() == "one parent family")
		{
		alert("Please tick the box for one parent family.")
		document.joinapp.singleagree.select()
		return false
		}

	if (document.joinapp.oneparentfamily.checked == false && document.joinapp.singleagree.value > " ")
		{
		alert("Please accept the conditions around one parent family and tick in the box.")
		document.joinapp.singleagree.select()
		return false
		}
		
	if (document.joinapp.oneparentfamily.checked == true && document.joinapp.singleagree.value == "")
		{
		alert("Please accept the conditions around one parent family.")
		document.joinapp.singleagree.select()
		return false
		}

if (document.joinapp.thinksitisok.checked)
	{
	if (iSubmitCount == 0)
		{
		iSubmitCount++;
		return true;
		}
	else
		{
		alert("Your application is being submitted as we speak.  Just click once only. Thanks!");
		return false;
		}
	}
else
	{
	alert("If you are ready to join tick the Finished check box then click [Join]");
	return false;
	}
}
