function validtxt(myform) {
	var currstate = "";
	
	if(document.getElementById("stateSelect").style.display == "block") 
	{
		currstate = document.getElementById('state1').options[document.getElementById('state1').selectedIndex].value
	} else {
		currstate = document.getElementById('state2').value
	}

    var teststep = "";
    teststep += company(requestform.company.value);
    teststep += street(document.getElementById("street").value);
    teststep += city(document.getElementById("city").value);
    teststep += country(document.getElementById("country").value);
    teststep += state(currstate);
    teststep += zip(document.getElementById("zip").value);
    teststep += first_name(document.getElementById("first_name").value);
    teststep += last_name(document.getElementById("last_name").value);    
    teststep += email(document.getElementById("email").value);
    
    if (teststep != "") {
       alert(teststep);
       return false;
    }
	
	return true;
}

function company(strng) {
 	var error = "";
	if (strng.length < 2) {
	    error = "Please enter a company name.\n";
	} else {
	
		var iChars = "!#$%^&*()+=-[]\\\;,/{}|\":<>?";

	  	for (var i = 0; i < strng.length; i++) {
	  		if (iChars.indexOf(strng.charAt(i)) != -1) {
	  			error = "The Company field has special characters. \nThese are not allowed.\n Please remove them and try again.";
	  		}
	  	}
	 }
	return error;
}

function street(strng) {
 	var error = "";
	if (strng.length < 2) {
	    error = "Please enter an address.\n";
	} else {
	
		var iChars = "!#$%^&*()+=-[]\\\;,/{}|\":<>?";

	  	for (var i = 0; i < strng.length; i++) {
	  		if (iChars.indexOf(strng.charAt(i)) != -1) {
	  			error = "The Address field has special characters. \nThese are not allowed.\n Please remove them and try again.";
	  		}
	  	}
	 }
	return error;
}


function city(strng) {
 	var error = "";
	if (strng.length < 2) {
	    error = "Please enter a city name.\n";
	} else {
	
		var iChars = "!#$%^&*()+=-[]\\\;,/{}|\":<>?";

	  	for (var i = 0; i < strng.length; i++) {
	  		if (iChars.indexOf(strng.charAt(i)) != -1) {
	  			error = "The City field has special characters. \nThese are not allowed.\n Please remove them and try again.";
	  		}
	  	}
	 }
	return error;
}


function country(strng) {
 	var error = "";
	if (strng == "NONE") {
	    error = "Please select a Country.\n";
	} else {
	
		var iChars = "!#$%^&*()+=-[]\\\;,/{}|\":<>?";

	  	for (var i = 0; i < strng.length; i++) {
	  		if (iChars.indexOf(strng.charAt(i)) != -1) {
	  			error = "The Country field has special characters. \nThese are not allowed.\n Please remove them and try again.";
	  		}
	  	}
	 }
	return error;
}

function state(strng) {
 	var error = "";
	if (strng.length < 2) {
	    error = "Please enter a state.\n";
	} else {
	
		var iChars = "!#$%^&*()+=-[]\\\;,/{}|\":<>?";

	  	for (var i = 0; i < strng.length; i++) {
	  		if (iChars.indexOf(strng.charAt(i)) != -1) {
	  			error = "The State field has special characters. \nThese are not allowed.\n Please remove them and try again.";
	  		}
	  	}
	 }
	return error;
}

function zip(strng) {
 	var error = "";
	if (strng.length < 2) {
	    error = "Please enter a postal code.\n";
	} else {
	
		var iChars = "!#$%^&*()+=-[]\\\;,/{}|\":<>?";

	  	for (var i = 0; i < strng.length; i++) {
	  		if (iChars.indexOf(strng.charAt(i)) != -1) {
	  			error = "The Postal Code field has special characters. \nThese are not allowed.\n Please remove them and try again.";
	  		}
	  	}
	 }
	return error;
}

function first_name(strng) {
 	var error = "";
	if (strng.length < 2) {
	    error = "Please enter a first name.\n";
	} else {
	
		var iChars = "!#$%^&*()+=-[]\\\;,/{}|\":<>?";

	  	for (var i = 0; i < strng.length; i++) {
	  		if (iChars.indexOf(strng.charAt(i)) != -1) {
	  			error = "The First Name field has special characters. \nThese are not allowed.\n Please remove them and try again.";
	  		}
	  	}
	 }
	return error;
}

function last_name(strng) {
 	var error = "";
	if (strng.length < 2) {
	    error = "Please enter a last name.\n";
	} else {
	
		var iChars = "!#$%^&*()+=-[]\\\;,/{}|\":<>?";

	  	for (var i = 0; i < strng.length; i++) {
	  		if (iChars.indexOf(strng.charAt(i)) != -1) {
	  			error = "The Last Name field has special characters. \nThese are not allowed.\n Please remove them and try again.";
	  		}
	  	}
	 }
	return error;
}

function email(strng) {
	var emailchk =/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
 	var error = "";
	if (strng.length < 1) {
    	error = "Please enter your E-Mail Address.\n";
	} else {
		// Removed to allow hyphens
		if (!emailchk.test(strng)) {		
	  		error = "Please enter a valid E-mail Address.\n";
	  	} 
	 }
  	
	return error;
}

