function validateAll()
{   		
Invalide = true;

	validatePrenom()
	validateNom()
	validateEmail()
	validateConfirmEmail()
	validatePhone()
	validateLearnAbout()
	validatetxtQuestion()
	
	if(Invalide != false)
	{
		return true;
	}else
	{
		return false;	
	}
}
function ValidateInscription()
{   		
Invalide = true;

	validateEmail()
	validateConfirmEmail()
	
	if(Invalide != false)
	{
		return true;
	}else
	{
		return false;	
	}
}
function validatePrenom()
{   		
Invalide = true;
Focus = "";
		strPrenom = document.getElementById('strPrenom');
        document.getElementById('txtFName_requis').style.display = 'none';
		strPrenom.style.border = '1px solid #999';
   		if(strPrenom.value == '') 
   		{ 
   		    strPrenom.style.border = '1px solid #dd7627';
   		    document.getElementById('txtFName_requis').style.display = 'inline';
   		    document.getElementById('txtFName_requis').innerHTML = '(requis)'; 

			Invalide = false;
   		}
	if(Invalide != false)
	{
		return true;
	}else
	{
		return false;	
	}
}
function validateNom()
{   		
Invalide = true;
   		strNom = document.getElementById('nom');
        document.getElementById('txtLName_requis').style.display = 'none';   		
   		strNom.style.border = '1px solid #999';
   		if(strNom.value == '') 
   		{ 
   		    strNom.style.border = '1px solid #dd7627';
   		    document.getElementById('txtLName_requis').style.display = 'inline';
   		    document.getElementById('txtLName_requis').innerHTML = '(requis)'; 
			
   		    Invalide = false;
   		}
	if(Invalide != false)
	{
		return true;
	}else
	{
		return false;	
	}
}
function validateEmail()
{   		
Invalide = true;
 		strEmail = document.getElementById('strCourriel');
   		document.getElementById('txtEmail_requis').style.display = 'none';
   		strEmail.style.border = '1px solid #999';
   		if(strEmail.value == '') 
   		{ 
   		    strEmail.style.border = '1px solid #dd7627';
   		    document.getElementById('txtEmail_requis').style.display = 'inline';
   		    document.getElementById('txtEmail_requis').innerHTML = '(requis)'; 
			
   		    Invalide = false;
   		} else if(!isValidEmail(strEmail.value)) {
   		
			strEmail.style.border = '1px solid #dd7627';   		    
   		    document.getElementById('txtEmail_requis').style.display = 'inline';
   		    document.getElementById('txtEmail_requis').innerHTML = '(courriel inadmissible )'; 

			Invalide = false;   		
   		}   		   		   		
	if(Invalide != false)
	{
		return true;
	}else
	{
		return false;	
	}
}
function validateConfirmEmail()
{   		
Invalide = true;
   		strEmail2 = document.getElementById('conf_courriel');
   		document.getElementById('checkEmail_requis').style.display = 'none';
   		strEmail2.style.border = '1px solid #999';
   		if(strEmail2.value == '') 
   		{ 
   		    strEmail2.style.border = '1px solid #dd7627';
   		    document.getElementById('checkEmail_requis').style.display = 'inline';
   		    document.getElementById('checkEmail_requis').innerHTML = '(requis)'; 
			
   		    Invalide = false;
   		}
		
   		if(strEmail.value != strEmail2.value) 
   		{ 
			strEmail2.style.border = '1px solid #dd7627';
   		    document.getElementById('checkEmail_requis').style.display = 'inline';
   		    document.getElementById('checkEmail_requis').innerHTML = '(pas identique)'; 
			
   		    Invalide = false;
   		}
	if(Invalide != false)
	{
		return true;
	}else
	{
		return false;	
	}
}
function validatePhone()
{   		
Invalide = true;
Focus = "";
		strPhone = document.getElementById('txtHomePhone_r');
		document.getElementById('txtHomePhone_requis').style.display = 'none';
		strPhone.style.border = '1px solid #999';
   		if(strPhone.value == '') 
   		{ 
   		    strPhone.style.border = '1px solid #dd7627';
   		    document.getElementById('txtHomePhone_requis').style.display = 'inline';
   		    document.getElementById('txtHomePhone_requis').innerHTML = '(requis)'; 
			
   		    Invalide = false;
   		} else if(checkInternationalPhone(strPhone.value)==false) { 
   		    strPhone.style.border = '1px solid #dd7627';
   		    document.getElementById('txtHomePhone_requis').style.display = 'inline';
   		    document.getElementById('txtHomePhone_requis').innerHTML = '(invalide)'; 
			
   		    Invalide = false;
   		}

	if(Invalide != false)
	{
		return true;
	}else
	{
		return false;	
	}
}

function validateLearnAbout()
{   		
Invalide = true;
		strLearnedAbout = document.getElementById('select');
		strLearnedAboutOther = document.getElementById('txtFoundBy_autre');
		document.getElementById('txtFoundBy_requis').style.display = 'none';
		document.getElementById('txtFoundByAutre_requis').style.display = 'none';
		strLearnedAbout.style.border = '1px solid #999';
		strLearnedAboutOther.style.border = '1px solid #999';
		
		if(strLearnedAbout.value == 'Choisissez') 
   		{ 
   		    strLearnedAbout.style.border = '1px solid #dd7627';
   		    document.getElementById('txtFoundBy_requis').style.display = 'inline';
   		    document.getElementById('txtFoundBy_requis').innerHTML = '(requis)'; 
			
   		    Invalide = false;
   		}
		if(strLearnedAbout.value == 'Autre')
		{
			if(strLearnedAboutOther.value == '') 
			{ 
				strLearnedAboutOther.style.border = '1px solid #dd7627';
				document.getElementById('txtFoundByAutre_requis').style.display = 'inline';
				document.getElementById('txtFoundByAutre_requis').innerHTML = '(requis)'; 
				
				Invalide = false;
			}
		}
	if(Invalide != false)
	{
		return true;
	}else
	{
		return false;	
	}
}



function validatetxtQuestion()
{   		
Invalide = true;
		strQuestion = document.getElementById('Question');
		document.getElementById('Question_requis').style.display = 'none';
		strQuestion.style.border = '1px solid #999';
		
		if(strQuestion.value == '???') 
   		{ 
   		    strLearnedAbout.style.border = '1px solid #dd7627';
   		    document.getElementById('Question_requis').style.display = 'inline';
   		    document.getElementById('Question_requis').innerHTML = '(requis)'; 
			
   		    Invalide = false;
   		}
		
	if(Invalide != false)
	{
		return true;
	}else
	{
		return false;	
	}
}

/*function validateSecurity(){
		strSecurity = document.getElementById("recaptcha_response_field")
		if(strSecurity.value == '') 
   		{ 
   		    strSecurity.style.border = '1px solid #dd7627';
   		    document.getElementById('strSecurityError').style.display = 'inline';
   		    document.getElementById('strSecurityError').innerHTML = '(requis)'; 
			
   		    Invalide = false;
   		}
}*/
   		   		
		

	
   	function isValidEmail(str) 
   	{
        return (str.lastIndexOf(".") > 2) && (str.indexOf("@") > 0) && (str.lastIndexOf(".") > (str.indexOf("@")+1)) && (str.indexOf("@") == str.lastIndexOf("@"));
    }
	
		/*  PHONE VALIDATION*/

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;
    }
    return true;
}
function trim(s)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not a whitespace, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (c != " ") returnString += c;
    }
    return returnString;
}
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){
	var bracket=3
	strPhone=trim(strPhone)
	if(strPhone.indexOf("+")>1) return false
	if(strPhone.indexOf("-")!=-1)bracket=bracket+1
	if(strPhone.indexOf("(")!=-1 && strPhone.indexOf("(")>bracket)return false
	var brchr=strPhone.indexOf("(")
	if(strPhone.indexOf("(")!=-1 && strPhone.charAt(brchr+2)!=")")return false
	if(strPhone.indexOf("(")==-1 && strPhone.indexOf(")")!=-1)return false
	s=stripCharsInBag(strPhone,validWorldPhoneChars);
	return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}