/*
=======================================================================
Copyright W3Now Web Design, Inc.  
W3WebForms.com    W3Now.com   W3SiteBuilder.com   W3WebTemplates.com
This information must remain in tact as presented here

Visit http://W3WebForms.com/  
to easily generate functional online forms for your web pages. 

The form information can be emailed to you or stored in a CSV file in your web site directory
Making an online form for your web page is easy...just log in, make a few entries, then copy the 
generated HTML code into your web page for a fully functional, spam-proof online form 

Forms generated by W3WebForms.com are spam-proof and fully functional.

=======================================================================
*/

function validZip(zp,cntry) { 
	if (!cntry)  cntry = 'US';
	if (cntry == 'US'  || cntry == 'U.S.' || cntry == 'USA' || cntry == 'U.S.A.' || cntry == 'United States' || cntry == '1' ) { 
			Nbrs = 0;
			validChars = "-0123456789";
			validNbrs="0123456789";
			for (z=0; z<zp.length; z++) { 
				charOK=false;
				for (i=0; i<validChars.length; i++) {
						if (zp.charAt(z)== validChars.charAt(i) ) {
							charOK=true;
							break;
						} 
				}
				if (!charOK) { 
				 return false;
				} 
				isNbr=false;
				for (i=0; i<validNbrs.length; i++) {
						if (zp.charAt(z)== validNbrs.charAt(i) ) {
							isNbr=true;
							break;
						} 
				}
				if (isNbr) Nbrs++; 
			}  
			if (Nbrs < 5 || Nbrs > 10) {
				return false; 
			}			
			return true;
	}
	else { // cntry is not usa, just ignore
		return true;
	}
}