<!--
var navImages = new Array();

function preload() {
	for(x=0; x<preload.arguments.length; x++) {
		navImages[x] = new Image();
		navImages[x].src = preload.arguments[x];
	}
}

var zChar = new Array(' ', '(', ')', '-', '.');
var maxphonelength = 13;
var phonevalue1;
var phonevalue2;
var cursorposition;

function ParseForNumber1(object){
	phonevalue1 = ParseChar(object.value, zChar);
	}
	function ParseForNumber2(object){
		phonevalue2 = ParseChar(object.value, zChar);
}

function backspacerUP(object,e) { 
	if(e){ 
		e = e 
	} else {
		e = window.event 
	} 
	if(e.which){ 
		var keycode = e.which 
	} else {
		var keycode = e.keyCode 
}

ParseForNumber1(object)

	if(keycode >= 48){
		ValidatePhone(object)
	}
}

function backspacerDOWN(object,e) { 
	if(e){ 
		e = e 
	} else {
		e = window.event 
	} 
	if(e.which){ 
		var keycode = e.which 
	} else {
		var keycode = e.keyCode 
	}
	ParseForNumber2(object)
} 

function GetCursorPosition(){

	var t1 = phonevalue1;
	var t2 = phonevalue2;
	var bool = false
	for (i=0; i<t1.length; i++)
	{
		if (t1.substring(i,1) != t2.substring(i,1)) {
			if(!bool) {
				cursorposition=i
				bool=true
				}
			}
	}
}

function ValidatePhone(object){

var p = phonevalue1

p = p.replace(/[^\d]*/gi,"")

	if (p.length < 3) {
		object.value=p
	} else if(p.length==3){
		pp=p;
		d4=p.indexOf('(')
		d5=p.indexOf(')')
		if(d4==-1){
		pp="("+pp;
	}
		if(d5==-1){
		pp=pp+")";
	}
		object.value = pp;
	} else if(p.length>3 && p.length < 7){
		p ="(" + p; 
		l30=p.length;
		p30=p.substring(0,4);
		p30=p30+")"
	
		p31=p.substring(4,l30);
		pp=p30+p31;
	
		object.value = pp; 
	
	} else if(p.length >= 7){
		p ="(" + p; 
		l30=p.length;
		p30=p.substring(0,4);
		p30=p30+")"
		
		p31=p.substring(4,l30);
		pp=p30+p31;
		
		l40 = pp.length;
		p40 = pp.substring(0,8);
		p40 = p40 + "-"
		
		p41 = pp.substring(8,l40);
		ppp = p40 + p41;
		
		object.value = ppp.substring(0, maxphonelength);
}

GetCursorPosition()

	if(cursorposition >= 0){
		if (cursorposition == 0) {
			cursorposition = 2
		} else if (cursorposition <= 2) {
			cursorposition = cursorposition + 1
		} else if (cursorposition <= 5) {
			cursorposition = cursorposition + 2
		} else if (cursorposition == 6) {
			cursorposition = cursorposition + 2
		} else if (cursorposition == 7) {
			cursorposition = cursorposition + 4
			e1=object.value.indexOf(')')
			e2=object.value.indexOf('-')
				if (e1>-1 && e2>-1){
				if (e2-e1 == 4) {
					cursorposition = cursorposition - 1
					}
				}
			} else if (cursorposition < 11) {
				cursorposition = cursorposition + 3
			} else if (cursorposition == 11) {
				cursorposition = cursorposition + 1
			} else if (cursorposition >= 12) {
				cursorposition = cursorposition
		}

		var txtRange = object.createTextRange();
		txtRange.moveStart( "character", cursorposition);
		txtRange.moveEnd( "character", cursorposition - object.value.length);
		txtRange.select();
	}

}

function ParseChar(sStr, sChar)
	{
	if (sChar.length == null) 
	{
		zChar = new Array(sChar);
	}
	else zChar = sChar;
	
	for (i=0; i<zChar.length; i++)
	{
		sNewStr = "";
	
		var iStart = 0;
		var iEnd = sStr.indexOf(sChar[i]);
	
	while (iEnd != -1)
	{
		sNewStr += sStr.substring(iStart, iEnd);
		iStart = iEnd + 1;
		iEnd = sStr.indexOf(sChar[i], iStart);
	}
		sNewStr += sStr.substring(sStr.lastIndexOf(sChar[i]) + 1, sStr.length);
	
		sStr = sNewStr;
	}

return sNewStr;
}

function checkAppForm() {
	var theform =  document.form;
	/*
	var childOne = 0;
	var childTwo = 0;
	var childThree = 0;
	var childFour = 0;
	var childFive = 0;
	*/
		
	if(theform.lastName.value == "") {
		alert("Please enter your last name");
		theform.lastName.focus();
		return false;
	}
	
	if(theform.homePhone.value.length !=13) {
		alert("Please enter your a valid home phone number");
		theform.homePhone.focus();
		return false;
	}
	
	if(theform.address.value == "") {
		alert("Please enter your address in the space provided");
		theform.address.focus();
		return false;
	}
	
	if(theform.city.value == "") {
		alert("Please enter your city in the space provided");
		theform.city.focus();
		return false;
	}
	
	if(theform.state.value == "Select") {
		alert("Please select your state from the list provided");
		theform.state.focus();
		return false;
	}
	
	if(theform.zip.value.length != 5) {
		alert("Please enter a valid 5-digit zip code in the space provided");
		theform.zip.focus();
		return false;
	}
	
	if(theform.fatherName.value == "") {
		alert("Please enter father's name in the space provided");
		theform.fatherName.focus();
		return false;
	}
	
	if( (theform.fatherBdayMonth.value.length != 2) || (theform.fatherBdayDay.value.length != 2) || (theform.fatherBdayYear.value.length != 4) ) {
		alert("Please enter father's birthday in the format mm/dd/yy");
		theform.fatherBdayMonth.focus();
		return false;
	}
	
	if(theform.fatherOccupation.value == "") {
		alert("Please enter father's occupation in the space provided");
		theform.fatherOccupation.focus();
		return false;
	}
	
	if(theform.fatherHobbies.value == "") {
		alert("Please enter father's hobbies in the space provided");
		theform.fatherHobbies.focus();
		return false;
	}
	
	if(theform.fatherCell.value.length !=13) {
		alert("Please enter your a valid cell phone number for the father");
		theform.fatherCell.focus();
		return false;
	}
	
	var string1=theform.fatherEmail.value
	if((string1.indexOf("@")==-1) || (string1.indexOf(".")==-1)) {
		alert("Please enter a valid email address for the father");
		theform.fatherEmail.focus();
		return false;
	}
	
	if(theform.motherName.value == "") {
		alert("Please enter mother's name in the space provided");
		theform.motherName.focus();
		return false;
	}
	
	if( (theform.motherBdayMonth.value.length != 2) || (theform.motherBdayDay.value.length != 2) || (theform.motherBdayYear.value.length != 4) ) {
		alert("Please enter mother's birthday in the format mm/dd/yy");
		theform.motherBdayMonth.focus();
		return false;
	}
	
	if(theform.motherOccupation.value == "") {
		alert("Please enter mother's occupation in the space provided");
		theform.motherOccupation.focus();
		return false;
	}
	
	if(theform.motherHobbies.value == "") {
		alert("Please enter mother's hobbies in the space provided");
		theform.motherHobbies.focus();
		return false;
	}
	
	if(theform.motherCell.value.length !=13) {
		alert("Please enter your a valid cell phone number for the mother");
		theform.motherCell.focus();
		return false;
	}
	
	var string2=theform.motherEmail.value
	if((string2.indexOf("@")==-1) || (string1.indexOf(".")==-1)) {
		alert("Please enter a valid email address for the mother");
		theform.motherEmail.focus();
		return false;
	}
	
	if(theform.lengthSchooling.value == "") {
		alert("Please enter the amount of time you've been homeschooling");
		theform.lengthSchooling.focus();
		return false;
	}
	
	if(theform.reasons.value == "") {
		alert("Please enter why you want to join LIFE");
		theform.reasons.focus();
		return false;
	}
	
	if(theform.childOneName.value == "") {
		alert("Please enter information for at least one child you're currently homeschooling");
		theform.childOneName.focus();
		return false;
	}
	
	if( (theform.childOneName.value == "") && (theform.childOneGrade.value == "0") ) {
		alert("Please indicate a grade for the first child you entered");
		theform.childOneGrade.focus();
		return false;
	}
	
	return true;
	}
	
//-->

// Date for registration
var now = new Date();
var year= now.getYear();
var mon = now.getMonth() + 1;
var day = now.getDate();

// Hack for Gecko and Web-Kit Y2K  Bug
if (year >= 100 && year <= 1999)
	{ 
		year = year + 1900
	}
	else {
		year = year
	}


