<!--



function validate()

{

	//alert("here!");



	var validationsOK = false;



	if ( (frm_email.value != "" ) && !echeck(frm_email.value) ){

				alert("You specified an invalid email address");

				frm_email.focus();

				return false;

	}



	if (frm_addr.value == "" ){

		alert("Please specify address.");

		frm_addr.focus();

		return false;

	}

	else if(

		(frm_city.value == "") &&

		(frm_state.value == "") &&

		(frm_zip.value == "")

		)

	{

		alert("Please specify city/state/zip.");

		frm_city.focus();

	}

	else

		validationsOK = true;



	//alert(validationsOK);

	//return false;



	return validationsOK;

}



function initialize()

{

	frm_addr.focus();

}



/*

Function echeck is used to verify if the given value is a possible valid email address.

This function thus simply makes sure the email address has one (@), atleast one (.).

It also makes sure that there are no spaces, extra '@'s or a (.) just before or after the @.

It also makes sure that there is atleast one (.) after the @.

*/



function echeck(str) {

	var at="@"

	var dot="."

	var lat=str.indexOf(at)

	var lstr=str.length

	var ldot=str.indexOf(dot)

	if (str.indexOf(at)==-1){

	   //alert("Invalid E-mail ID")

	   return false

	}



	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){

	   //alert("Invalid E-mail ID")

	   return false

	}



	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){

		//alert("Invalid E-mail ID")

		return false

	}



	 if (str.indexOf(at,(lat+1))!=-1){

		//alert("Invalid E-mail ID")

		return false

	 }



	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

		//alert("Invalid E-mail ID")

		return false

	 }



	 if (str.indexOf(dot,(lat+2))==-1){

		//alert("Invalid E-mail ID")

		return false

	 }



	 if (str.indexOf(" ")!=-1){

		//alert("Invalid E-mail ID")

		return false

	 }



 	return true

}



function IsNumeric(strString)

//  check for valid numeric strings

{

	var strValidChars = "0123456789";

	var strChar;

	var blnResult = true;



	if (strString.length == 0) return false;



	//  test strString consists of valid characters listed above

	for (i = 0; i < strString.length && blnResult == true; i++)

	  {

	  strChar = strString.charAt(i);

	  if (strValidChars.indexOf(strChar) == -1)

		 {

		 blnResult = false;

		 }

	  }

	return blnResult;

}

	

function getNumOfSelBoxes(boxes){

	var nc=0;

	if (boxes  != null) {

        	for (i=0; i<boxes.length; i++) {

			if (boxes.item(i).checked)

                        	nc=nc+1;

                }

	}

	return nc;

}



function selectValue(fName, fValue)

{

	var optionElement;



	for (var index=0; index < fName.options.length; index++)

	{

		optionElement = fName.options[index];



		if (optionElement.value == fValue)

		{

			optionElement.selected =  true;

			break;

		}

	}

}

//Child information is mandatory for BalaVihar members only.

function isMemberTypeValid()

{

	var MemberType = document.memDetail.MemberType;



	var aVal = MemberType.options(MemberType.selectedIndex).value;

	if (aVal == 'B')

	{

		return (isEntered(document.memDetail.Child1LastName, "Child Last Name") &&

		isEntered(document.memDetail.Child1FirstName, "Child First Name"));

	}



	return true;

}



//

function clearOptns()

{

	var hFld;

	var vals = document.all("hide");



	for (var i=0; i< vals.length; i++)

	{

		hFld = vals.item(i);

		hFld.value = "";		

	}

}



//Get number of selected options and move the first 10 values to the hidden fields.

function getNumOptions()

{

	var selOptns = 0;

	var optns = document.all("optn");

	var vals = document.all("hide");

	

	clearOptns();

	

	for (var i=0; i< optns.length; i++)

	{

		if (optns.item(i).checked)

		{

			//alert(optns.item(i).value);



			if (selOptns < 10)

				vals.item(selOptns).value = optns.item(i).value;

			selOptns++;

		}



	}



	//for (var i=0; (i< 10) && (i < selOptns); i++)

	//	alert(vals.item(i).value);



	return selOptns;

}



function isEntered(field, fldNm)

{

	if (field.value == "")

	{

		

		alert("Please specify " + fldNm);

		field.focus();

		return false;

	}



	return true;

}





//Select appropriate radio button based on the number of payments and total paymt amount.

/*

function selRbutton(bVal)

{

	if (bVal == 0)

		return;



	var rads = document.memDetail("NoOfPayments");

	for (var i=0; i<rads.length; i++)

	{

		//alert(rads.item(i).value + ' '+i);

		if (bVal == rads.item(i).value)

		{

			rads.item(i).checked = true;

			break;

		}



	}

}

*/

-->

