function validateEmail(emailad) {
		
		var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
		var check=/@[\w\-]+\./;
		var checkend=/\.[a-zA-Z]{2,3}$/;
		
			if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1)){
				return true;
			}
			else {
				return false;
			}
		}
		
function limite(zone,max)
		{
		if(zone.value.length>=max){zone.value=zone.value.substring(0,max);}
		}
		
function LTrim(str) {
	var whitespace = new String(" \t\n\r");
	var s = new String(str);
	if (whitespace.indexOf(s.charAt(0)) != -1) {
	var j=0, i = s.length; 
	while (j < i && whitespace.indexOf(s.charAt(j)) != -1) 
	j++; 
	s = s.substring(j, i); } 
	return s; } 
function RTrim(str) {
	var whitespace = new String(" \t\n\r"); 
	var s = new String(str); 
	if (whitespace.indexOf(s.charAt(s.length-1)) != -1){ 
	var i = s.length - 1; // Get length of string 
	while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
	i--; 
	s = s.substring(0, i+1); }
	return s; }
function Trim(str) { return RTrim(LTrim(str)); }

function validateReg(form) {
	if (document.frmContact.name.value=="" || document.frmContact.name.value=="name"){
		alert("Please specify your name!");
		document.frmContact.name.focus();
		return false;
	}
	else if (document.frmContact.position.value=="" || document.frmContact.position.value=="position"){
		alert("Please specify your position!");
		document.frmContact.position.focus();
		return false;
	}
	else if (document.frmContact.company.value=="" || document.frmContact.company.value=="company"){
		alert("Please specify your company!");
		document.frmContact.company.focus();
		return false;
	}
	else if (document.frmContact.telephone.value=="" || document.frmContact.telephone.value=="telephone"){
		alert("Please specify your phone number!");
		document.frmContact.telephone.focus();
		return false;
	}
	else if(validateEmail(form.email.value)){
		alert("Please specify a valid email address!");
		document.frmContact.email.focus();
		return false;
	}
	else if (document.frmContact.query.value=="" || document.frmContact.query.value=="your query"){
		alert("Please specify your query!");
		document.frmContact.query.focus();
		return false;
	}
	else {
		return true;
	}
}		