<!-- Begin

function FormFocus()
{
	frmInfo.txtCompanyName.focus();
}


//--------------------End Phone and Email Validation Functions----------------//

// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

function isInteger(s)
{   
    var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag)
{   
    var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone)
{
    s=stripCharsInBag(strPhone,validWorldPhoneChars);
    return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function checkRadio (frmName, rbGroupName) {
 var radios = document[frmName].elements[rbGroupName];
 for (var i=0; i <radios.length; i++) {
  if (radios[i].checked) {
   return true;
  }
 }
 return false;
}

function valButton(btn) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}
   



//--------------------End Phone and Email Validation Functions----------------//


function Form_Validator(theForm)
{

	if (theForm.firstname.value == "")
	{
		alert("Please enter your first name.");
		theForm.firstname.focus();
		return (false);
	}

	if (theForm.middleinitial.value == "")
	{
		alert("Please enter your middle initial.");
		theForm.middleinitial.focus();
		return (false);
	}
	
	if (theForm.lastname.value == "")
	{
		alert("Please enter your lastname.");
		theForm.lastname.focus();
		return (false);
	}
	
	if (theForm.appstatus.selectedIndex == 0)
	{
		alert("What is your application status");
		theForm.appstatus.focus();
		return (false);
	}
	
//----------------Email Address Validation--------------//

    if (theForm.emailoffice.value == "")
    {
      alert("Please enter an email address");
      theForm.emailoffice.focus();
      return (false);
    }

    if (!isEmailAddr(theForm.emailoffice.value))
    {
      alert("Please enter a complete email address: yourname@yourdomain.com");
      theForm.emailoffice.focus();
      return (false);
    }
    
//----------------Email Address Validation--------------//

    if (theForm.emailpersonal.value == "")
    {
      alert("Please enter an email address");
      theForm.emailpersonal.focus();
      return (false);
    }

    if (!isEmailAddr(theForm.emailpersonal.value))
    {
      alert("Please enter a complete email address: yourname@yourdomain.com");
      theForm.emailpersonal.focus();
      return (false);
    }

	if (theForm.firm.value == "")
	{
		alert("Please enter your firm, company or agency name.");
		theForm.firm.focus();
		return (false);
	}

	if (theForm.address.value == "")
	{
		alert("Please enter an address");
		theForm.address.focus();
		return (false);
	}

	if (theForm.city.value == "")
	{
		alert("Please enter a city");
		theForm.city.focus();
		return (false);
	}

	/*if (theForm.slcState.selectedIndex == 0)
	{
		alert("Please select a state");
		theForm.slcState.focus();
		return (false);
	}*/
	
	if (theForm.state.value == "")
	{
		alert("Please enter a state");
		theForm.state.focus();
		return (false);
	}


	
	

//----------------Zip Code Validation--------------//

    var valid = "0123456789";

    if (theForm.zip.value.length!=5) 
    {
        alert("Please enter a 5 digit zip code.");
		theForm.zip.focus()
        return false;
    }
    for (var i=0; i < theForm.zip.value.length; i++) 
    {
        temp = "" + theForm.zip.value.substring(i, i+1);
        if (valid.indexOf(temp) == "-1") 
        {
            alert("Invalid characters in zip code. Please try again.");
		    theForm.zip.focus()
            return false;
        }

    }
    
    

//----------------Phone Number Validation--------------//

    //--Phone1
	if ((theForm.phoneprimary.value==null)||(theForm.phoneprimary.value==""))
    {
		alert("Please Enter a Phone Number")
		theForm.phoneprimary.focus()
		return false
	}
	if (checkInternationalPhone(theForm.phoneprimary.value)==false)
    {
		alert("Please Enter a Valid Phone Number")
		theForm.phoneprimary.value=""
		theForm.phoneprimary.focus()
		return false
	}


	if (theForm.contacted.selectedIndex == 0)
	{
		alert("How do you prefer to be contacted");
		theForm.contacted.focus();
		return (false);
	}
	
	if (theForm.lawschool.value == "")
	{
		alert("Please enter your law school");
		theForm.lawschool.focus();
		return (false);
	}
	
	if (theForm.year.value == "")
	{
		alert("Please enter your year of graduation");
		theForm.year.focus();
		return (false);
	}


	var btn = valButton(frmInfo.practice);
	if (btn == null) 
		{
			alert('Please select your area of practice');
			return (false);
		}
		
	var btn = valButton(frmInfo.dues);
	if (btn == null) 
		{
			alert('Please select dues amount');
			return (false);
		}
		
	var btn = valButton(frmInfo.method);
	if (btn == null) 
		{
			alert('Please select payment method');
			return (false);
		}
		
	var btn = valButton(frmInfo.directory);
	if (btn == null) 
		{
			alert('Would you like to be in the membership directory');
			return (false);
		}





/*

	if (document.frmTest.CHKBOX_1.checked == false &&
	    document.frmTest.CHKBOX_2.checked == false &&
	    document.frmTest.CHKBOX_3.checked == false)
		{
		alert ('You didn\'t choose any of the checkboxes!');
		return (false);
		}
		

	if (theForm.slcDirectmail.selectedIndex == 0)
	{
		alert("Do you have a direct mail piece?");
		theForm.slcDirectmail.focus();
		return (false);
	}

//----------------Contacts Validation--------------//

	if (theForm.slcDirectmail.selectedIndex == 1)
	{
        var valid = "0123456789";

	    if (theForm.txtContacts.value == "")
	    {
	    	alert("Please enter the number of contacts.");
	    	theForm.txtContacts.focus();
	    	return (false);
	    }


        for (var i=0; i < theForm.txtContacts.value.length; i++) 
        {
            temp = "" + theForm.txtContacts.value.substring(i, i+1);
            if (valid.indexOf(temp) == "-1") 
            {
                alert("Please enter numbers only.");
	    	    theForm.txtContacts.focus()
                return false;
            }
        }
	}


	if (theForm.slcList.selectedIndex == 0)
	{
		alert("Do you need to purchase a list?");
		theForm.slcList.focus();
		return (false);
	}     

	if (theForm.txtStartDate.value == "")
	{
		alert("Please enter a start date.");
		theForm.txtStartDate.focus();
		return (false);
	}

	if (theForm.txtBudget.value == "")
	{
		alert("Please enter a budget.");
		theForm.txtBudget.focus();
		return (false);
	}

	if (theForm.txtLength.value == "")
	{
		alert("Please enter a start Length.");
		theForm.txtLength.focus();
		return (false);
	}

	if (theForm.slcHear.selectedIndex == 0)
	{
		alert("Please tell us how you heard about us?");
		theForm.slcHear.focus();
		return (false);
	}

	if (theForm.slcHear.selectedIndex == 4)
	{
		if (theForm.txtOther.value == "")
		{
			alert("Please tell us the other method that you heard about us.");
			theForm.txtOther.focus();
			return (false);
		}
	}*/

	return (true);
}


//  End -->