function coval(){

	var name = document.getElementById('coname');
	name.value = trim(name.value);
	var email = document.getElementById('cemail');
	email.value = trim(email.value);
	var message = document.getElementById('cmessage');
  message.value = trim(message.value);

	if(isAlphabet(name, "Please enter a your name")){
	if(emailValidator(email, "Please enter a valid Email Address")){
	if(isAlphanumbpunc(message, "Please enter only letters, numbers and punctuation in your Message")){
				return true;								
			}
		}
	}	
	return false;
}

function isAlphabet(elem, helperMsg){
	var alphaExp = /^[a-zA-Z(-)(')\u00C0-\u00ff\s]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function isAlphanumbpunc(elem, helperMsg){
	var alphaExp = /^[0-9a-zA-Z(.)(,)(?)(!)(')(()())(-)\u00C0-\u00ff\s]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function trim(s) {
        s = s.replace(/(^\s*)|(\s*$)/gi,"");
        s = s.replace(/[ ]{2,}/gi," ");
        s = s.replace(/\n /,"\n");
        return s;
}


