function deal(contactdealer) {
 var alphaExp = /^[0-9a-zA-Z]+[0-9a-zA-Z]+$/;
 var emailExp=/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/;
 var numExp =/^[0-9]+$/;
 //var illegalChars = /\W/; 

function isNotEmpty(val){
  return ((trim(val)).length>0);
}
function trim(s) {
  while (s.substring(0,1) == ' ') { s = s.substring(1,s.length);}
  while (s.substring(s.length-1,s.length) == ' ') { s = s.substring(0,s.length-1); }
  return s;
}

 if (!emailExp.test(contactdealer.email_add.value)) {
    alert('Please introduce a valid email address.');
	contactdealer.email_add.style.backgroundColor='#3976A3'; 
	contactdealer.email_add.style.color='black';
    return false;
  }
  else { 
 	 contactdealer.email_add.style.backgroundColor='';
 }
       
  if (!alphaExp.test(contactdealer.first_name.value)) {
    alert('Please introduce First Name.');
    contactdealer.first_name.style.backgroundColor='#3976A3';
	contactdealer.first_name.style.color='black';
    return false;
  }
  else { 
  	contactdealer.first_name.style.backgroundColor=''; 
  } 
  
  if (!alphaExp.test(contactdealer.last_name.value)) {
    alert('Please introduce Last Name.');
    contactdealer.last_name.style.backgroundColor='#3976A3';
	contactdealer.last_name.style.color='black';
    return false;
  }
  else { 
  	contactdealer.last_name.style.backgroundColor=''; 
  } 
  
  if (!numExp.test(contactdealer.telephone.value)) {
    alert('Please introduce Phone Number.');
    contactdealer.telephone.style.backgroundColor='#3976A3';
	contactdealer.telephone.style.color='black';
    return false;
  }
  else { 
  	contactdealer.telephone.style.backgroundColor=''; 
  }
  
  if (!isNotEmpty(contactdealer.comments.value)) {
		alert('Please introduce your comment.');
		contactdealer.comments.style.backgroundColor='#3976A3'; 
        contactdealer.comments.style.color='black';
    	return false;
  }
  else { 
 	 contactdealer.comments.style.backgroundColor='';
   }
 /*if (illegalChars.test(contactdealer.username.value)) {
		alert('The username contains illeagal chars (only letters numbers and underscores are allowed).');
		contactdealer.username.style.backgroundColor='#3976A3';
		contactdealer.username.style.color='black';
		return false;
    } 
	else { 
 
  	contactdealer.username.style.backgroundColor=''; 
  } */

  return true;
}
