function validateForm()
{
var allValid = true
var checkNum ="012345 6789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&.,"

	if (document.frm.txtFirstName.value.length <= 2)
	{
		alert("You must enter a First Name at least 3 characters long.")
		document.frm.txtFirstName.focus()
		return false;
	}else{
	  if(document.frm.txtFirstName.value.length >= 4){
	        //###added check for all numbers
	        var nameCheck
	        nameCheck = document.frm.txtFirstName.value
	        for (i = 0;  i < nameCheck.length;  i++)
	        {
                ch = nameCheck.charAt(i);
                        for (j = 0;  j < checkNum.length;  j++)
                        if (ch == checkNum.charAt(j))
                                break;
                        if (j == checkNum.length)
                        {
                                allValid = false;
                                break;
                        }
	        }
	        if (!allValid)
	        {
                alert("The First Name cannot contain any symbols or special characters. Letters, Numbers and spaces only.")
                document.frm.txtFirstName.value = ""
                document.frm.txtFirstName.focus();
		     return false;
	        }
	  }
	}
	if (document.frm.txtLastName.value.length <= 2)
	{
		alert("You must enter a Last Name at least 3 characters long.")
		document.frm.txtLastName.focus()
		return false;
	}else{
	  if(document.frm.txtLastName.value.length >= 4){
	        //###added check for all numbers
	        var nameCheck
	        nameCheck = document.frm.txtLastName.value
	        for (i = 0;  i < nameCheck.length;  i++)
	        {
                ch = nameCheck.charAt(i);
                        for (j = 0;  j < checkNum.length;  j++)
                        if (ch == checkNum.charAt(j))
                                break;
                        if (j == checkNum.length)
                        {
                                allValid = false;
                                break;
                        }
	        }
	        if (!allValid)
	        {
                alert("The Last Name cannot contain any symbols or special characters. Letters, Numbers and spaces only.")
                document.frm.txtLastName.value = ""
                document.frm.txtLastName.focus();
		     return false;
	        }
	  }
	}
	if (document.frm.txtCompanyName.value.length <= 2)
	{
		//alert("You must enter a Company Name at least 3 characters long.")
		//document.frm.txtCompanyName.focus()
		//return false;
	}else{
	  if(document.frm.txtCompanyName.value.length >= 4){
	        //###added check for all numbers
	        var nameCheck
	        nameCheck = document.frm.txtCompanyName.value
	        for (i = 0;  i < nameCheck.length;  i++)
	        {
                ch = nameCheck.charAt(i);
                        for (j = 0;  j < checkNum.length;  j++)
                        if (ch == checkNum.charAt(j))
                                break;
                        if (j == checkNum.length)
                        {
                                allValid = false;
                                break;
                        }
	        }
	        if (!allValid)
	        {
                alert("The Company Name cannot contain any symbols or special characters. Letters, Numbers and spaces only.")
                document.frm.txtCompanyName.value = ""
                document.frm.txtCompanyName.focus();
		     return false;
	        }
	  }
	}
	if (document.frm.txtAddr1.value.length <= 2)
	{
		//alert("You must enter an Address at least 3 characters long.")
		//document.frm.txtAddr1.focus()
		//return false;
	}else{
	  if(document.frm.txtAddr1.value.length >= 4){
	        //###added check for all numbers
	        var nameCheck
	        nameCheck = document.frm.txtAddr1.value
	        for (i = 0;  i < nameCheck.length;  i++)
	        {
                ch = nameCheck.charAt(i);
                        for (j = 0;  j < checkNum.length;  j++)
                        if (ch == checkNum.charAt(j))
                                break;
                        if (j == checkNum.length)
                        {
                                allValid = false;
                                break;
                        }
	        }
	        if (!allValid)
	        {
                alert("The Address cannot contain any symbols or special characters. Letters, Numbers and spaces only.")
                document.frm.txtAddr1.value = ""
                document.frm.txtAddr1.focus();
		     return false;
	        }
	  }
	}
	if (document.frm.txtCity.value.length <= 2)
	{
		//alert("You must enter a City Name at least 3 characters long.")
		//document.frm.txtCity.focus()
		//return false;
	}else{
	  if(document.frm.txtCity.value.length >= 4){
	        //###added check for all numbers
	        var nameCheck
	        nameCheck = document.frm.txtAddr1.value
	        for (i = 0;  i < nameCheck.length;  i++)
	        {
                ch = nameCheck.charAt(i);
                        for (j = 0;  j < checkNum.length;  j++)
                        if (ch == checkNum.charAt(j))
                                break;
                        if (j == checkNum.length)
                        {
                                allValid = false;
                                break;
                        }
	        }
	        if (!allValid)
	        {
                alert("The City cannot contain any symbols or special characters. Letters, Numbers and spaces only.")
                document.frm.txtCity.value = ""
                document.frm.txtCity.focus();
		     return false;
	        }
	  }
	}
	if (document.frm.txtState.value.length <= 1)
	{
		alert("You must enter a State")
		document.frm.txtState.focus()
		return false;
	}else{
	  if(document.frm.txtState.value.length >= 2){
	        //###added check for all numbers
	        var nameCheck
	        nameCheck = document.frm.txtState.value
	        for (i = 0;  i < nameCheck.length;  i++)
	        {
                ch = nameCheck.charAt(i);
                        for (j = 0;  j < checkNum.length;  j++)
                        if (ch == checkNum.charAt(j))
                                break;
                        if (j == checkNum.length)
                        {
                                allValid = false;
                                break;
                        }
	        }
	        if (!allValid)
	        {
                alert("The State cannot contain any symbols or special characters. Letters, Numbers and spaces only.")
                document.frm.txtState.value = ""
                document.frm.txtState.focus();
		     return false;
	        }
	  }
	}


	if(document.frm.txtZip.value.length <=0)
	{
            //alert("You must enter a zip code")
			//document.frm.txtZip.focus()
			//return false;
	}else{
	//###added check for all numbers
	        allValid = true
	        var nameCheck
	        var checkZ = "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-"
	        nameCheck = document.frm.txtZip.value

	        for (i = 0;  i < nameCheck.length;  i++)
	        {
                ch = nameCheck.charAt(i);
                        for (j = 0;  j < checkZ.length;  j++)
                        if (ch == checkZ.charAt(j))
                                break;
                        if (j == checkZ.length)
                        {
                                allValid = false;
                                break;
                        }
	        }
	        if (!allValid)
	        {
              	alert("You must enter a valid zip code for the User")
			document.frm.txtZip.focus()
			return false;
	        }
	}

	if (document.frm.txtCountry.value.length <= 1)
	{
		//alert("You must enter a Country")
		//document.frm.txtCountry.focus()
		//return false;
	}else{
	  if(document.frm.txtCountry.value.length >= 2){
	        //###added check for all numbers
	        var nameCheck
	        nameCheck = document.frm.txtCountry.value
	        for (i = 0;  i < nameCheck.length;  i++)
	        {
                ch = nameCheck.charAt(i);
                        for (j = 0;  j < checkNum.length;  j++)
                        if (ch == checkNum.charAt(j))
                                break;
                        if (j == checkNum.length)
                        {
                                allValid = false;
                                break;
                        }
	        }
	        if (!allValid)
	        {
                alert("The Country cannot contain any symbols or special characters. Letters, Numbers and spaces only.")
                document.frm.txtCountry.value = ""
                document.frm.txtCountry.focus();
		     return false;
	        }
	  }
	}
	//if (document.frm.txtARCNbr.value.length <= 1)
	//{
	//	alert("You must enter an ARC Number")
	//	document.frm.txtARCNbr.focus()
	//	return false;
	//}else{
	//  if(document.frm.txtARCNbr.value.length >= 2){
	//        //###added check for all numbers
	//        var nameCheck
	//        nameCheck = document.frm.txtARCNbr.value
	//        for (i = 0;  i < nameCheck.length;  i++)
	//        {
        //        ch = nameCheck.charAt(i);
        //                for (j = 0;  j < checkNum.length;  j++)
        //                if (ch == checkNum.charAt(j))
        //                        break;
        //                if (j == checkNum.length)
        //                {
        //                        allValid = false;
        //                        break;
        //                }
	//        }
	//        if (!allValid)
	//        {
        //        alert("The ARC Number cannot contain any symbols or special characters. Letters, Numbers and spaces only.")
        //        document.frm.txtARCNbr.value = ""
        //        document.frm.txtARCNbr.focus();
	//	     return false;
	//        }
	//  }
	//}

	if(document.frm.txtEmail.value.length <=0)
	{
		alert("You must enter an Email Address.")
		document.frm.txtEmail.focus()
		return false;
	}
  return allValid;
}



function IsItInteger(val){
   
   inputVal = val;  
   inputStr = inputVal.toString()
   
   for (var i = 0; i < inputStr.length; i++){
        var oneChar = inputStr.charAt(i);             
        if (oneChar < "0" || oneChar > "9") {           
            return false;
            }
       }
       return true;
  }
  
var bag = "'"
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;}
        else{
            returnString += "&rsquo;";
        }
    }

    return returnString;
}


