// JavaScript Document
/**
 * DHTML phone number validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 0;

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}



/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		
		if (str.indexOf(at)==-1){
		   alert("E-mail invalide ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("E-mail invalide ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("	E-mail invalide ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("E-mail invalide ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("E-mail invalide ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("E-mail invalide ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		      alert("E-mail invalide ID")
		    return false
		 }
		diff=str.length-(str.indexOf((dot),(str.length-5)));
		if ((diff<3 || diff>5) && (str.indexOf("..")==-1)){
		     alert("E-mail invalide ID")
		    return false
		 }
 		 return true;
	}
function ValidateForm(){
	var Name=document.contactus.name.value;
	var Phone=document.contactus.phone;
	var emailID=document.contactus.email;
	var msg=document.contactus.textmesg;

	if ((Name==null)||(Name=="")){
		alert("S’il vous plaît entrer votre nom");
		Name.focus;
		return false;
	}
	if ((Name.search(/[^a-zA-Z]/) > -1)&&(Name.search(")") > -1)&&(Name.search("(") > -1) 
	&&(Name.search("+") > -1)&&(Name.search("-") > -1))
	{
	  error = "Pas de chiffres et des caractères spéciaux sont autorisés dans Nom";
	  alert(error);
	  return false;
	}
  
	if ((emailID.value==null)||(emailID.value=="")){
		alert("S’il vous plaît entrer votre courriel ID");
		emailID.focus;
		return false;
	}
	if (echeck(emailID.value)==false){
		//emailID.value="";
		emailID.focus;
		return false;
	}
	
	/*if ((Phone.value==null)||(Phone.value=="")){
		alert("Please Enter your Phone Number");
		Phone.focus();
		return false;
	}*/
	if (checkInternationalPhone(Phone.value)==false)
	{
		alert("S’il vous plaît, entrez un numéro de téléphone valide");
		Phone.value="";
		Phone.focus;
		return false;
	}
	
	if ((msg.value==null)||(msg.value==""))
	{
		alert("S’il vous plaît entrez un message");
		msg.focus;
		return false;
	}
	
	
	
	return true
 }

<!-- Original:  Mikhail Esteves (miks80@yahoo.com) -->
<!-- Web Site:  http://www.freebox.com/jackol -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
//  End -->
// JavaScript Document
