/**
 * 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 = 10;

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);
}





<!--
function ValidateDoc()
{
   var course = 0;
	
	
    var TheForm   = document.online_registration_form;
	
	  if (TheForm.salutation.selectedIndex == '00'){
         alert("Please select the salutation.");
         TheForm.salutation.focus();
	     TheForm.salutation.style.backgroundColor = '#FFCC33';
         return (false); }
	
    if (TheForm.firstname.value.length < 1) {
         alert("Please check your first name.");
         TheForm.firstname.focus();
	     TheForm.firstname.style.backgroundColor = '#FFCC33';
         return (false); }

	  if (TheForm.lastname.value.length < 1){
        alert("Please check your  last name.");
         TheForm.lastname.focus();
	     TheForm.lastname.style.backgroundColor = '#FFCC33';
         return (false);}
		
	  if (TheForm.gender.selectedIndex == '00'){
        alert("Please select  your gender.");
         TheForm.gender.focus();
	     TheForm.gender.style.backgroundColor = '#FFCC33';
         return (false);}
	

      if (TheForm.streetaddress.value.length < 1){
         alert("Please check  your street address.");
         TheForm.streetaddress.focus();
	     TheForm.streetaddress.style.backgroundColor = '#FFCC33';
         return (false);}

 if (TheForm.country.selectedIndex == '0'){
        alert("Please select  your country.");
         TheForm.country.focus();
	     TheForm.country.style.backgroundColor = '#FFCC33';
         return (false);}

    if (TheForm.email.value.length < 1){
       ErrorMsg =  ErrorMsg + "Email" + cr;
	}else if (TheForm.email.value.length < 4 || TheForm.email.value.indexOf ('@', 0) == -1 || TheForm.email.value.indexOf ('.', 0) == -1 || (TheForm.email.value.substring(1,0)=='@')){
        alert("Your email is not valid.");
         TheForm.email.focus();
	     TheForm.email.style.backgroundColor = '#FFCC33';
         return (false);}
		
 if (TheForm.email2.value.length != TheForm.email.value.length){
        alert("Retype email is not match.");
         TheForm.email2.focus();
	     TheForm.email2.style.backgroundColor = '#FFCC33';
         return (false);}
  

if (TheForm.Basic_course.checked) {
	
	 course = 1;
}

if (TheForm.Advance_course.checked) {
	
	 course = 1;
}
if (TheForm.Oil_massage_course.checked) {
	
	 course = 1;
}
if (TheForm.Foot_massage_course.checked) {
	
	 course = 1;
}
if (TheForm.Foot_reflexology.checked) {
	
	 course = 1;
}
if (TheForm.Facial_massage_course.checked) {
	
	 course = 1;
}
if (TheForm.Rue_sri_datton_exercise_course.checked) {
	
	 course = 1;
}

  if (course == 0)
  {
    alert("Please select the course.");
    TheForm.Basic_course.focus();
    return (false);
  }

    return(true);
}

//-->








