var charexp = /./
var letterexp = /^[a-z_0-9\.]/i
var phonexp =  /^\d{10}$/
var motpasse = /^[a-z][a-z_0-9\.]+@[a-z_0-9\.]+\.[a-z]{2,3}$/i
var zipexp = /^[a-z][0-9][a-z]\s[0-9][a-z][0-9]/i
var emailexp = /^[a-z][a-z_0-9\.]+@[a-z_0-9\.]+\.[a-z]{2,3}$/i




function isValid(pattern, str) {
	return pattern.test(str)
}

function hasLetter(str) {
	return letterexp.test(str)
}

function hasChar(str) {
	return charexp.test(str)
}

function stripChars(pattern, str) {
	return str.replace(pattern,"")
}

function stripNonDigits(str) {
	return str.replace(/[^0-9]/g,"")
}

function checkform(form) {

	if  (!hasLetter(form.nom.value)) {
		alert("Entrez votre nom.")
		form.nom.focus()
		return false
		
	} else if  (!hasLetter(form.prenom.value)) {
		alert("Entrez votre prénom.")
		form.prenom.focus()
		return false
		
	} else if  (!hasLetter(form.address.value)) {
		alert("Entrez votre adresse.")
		form.address.focus()
		return false
		
	} else if  (!hasLetter(form.ville.value)) {
		alert("Entrez votre ville.")
		form.ville.focus()
		return false
		
			
	} else if  (!hasLetter(form.codeacc.value)) {
		alert("Entrez votre code.")
		form.codeacc.focus()
		return false
		
			
	} else if (!hasletter(form.email.value)) {
		alert("Your email is invalid")
		form.email.focus()
		return false
	
	} else {
		form.action = "http://www.picmedia.ca/chasse.php";
	}
	

}
