function ValidateDataAskTheSurgeon()
{	
	var contactDate = document.getElementById('contactDate');
	var FirstName = document.getElementById('txtFirstName');
	var LastName = document.getElementById('txtLastName');
	var Phone = document.getElementById('txtPhone');
	var City = document.getElementById('txtCity');	
	var ZipCode = document.getElementById('txtZipCode');
	var Email = document.getElementById('txtEmail');
	var Address = document.getElementById('txtAddress');
	
	var ddlState = document.getElementById('ddlState');
	var ddlCountry = document.getElementById('ddlCountry');
	
	var CellPhone = document.getElementById('txtCellPhone');
	
	
	if (contactDate.value != "")
	{
		return false;
	}

	
	if (FirstName.value == "")
	{
		alert('Please, enter your first name.');
		FirstName.focus();
		return (false);
	}
	else
	{		
		if(!ValidateName(FirstName.value))
		{
			alert("Please check your first name.");
			FirstName.focus();			
			return false;
		}
		if(!ValidateConsonants(FirstName.value))
		{
			alert("Please check your first name.");
			FirstName.focus();
			return false;
		}
	}

	if (LastName.value == "")
	{
		alert('Please, enter your last name.');
		LastName.focus();
		return (false);
	}
	else
	{
		if(!ValidateName(LastName.value))
		{
			alert("Please check your last name.");
			LastName.focus();			
			return false;
		}

		if(!ValidateConsonants(LastName.value))
		{
			alert("Please check your last name.");
			LastName.focus();			
			return false;
		}
	}
		
	if (Email.value == "")
	{
		alert('Please, enter your email address.');
		Email.focus();
		return (false);
	}
	else
	{		
		if(!ValidateEmailCharacters(Email.value))
		{
		   	alert("Please check your email address.");
		  	Email.focus();			
		   	return false;
		}
		if(!ValidateEmail(Email.value))
		{
			alert("Please check your email address.");
			Email.focus();		
			return false;
		}
		if(!ValidateEmailDomain(Email.value))
		{
			alert("Please check your email address, domain (.ru, .sk, .ua) isn't valid.");
			Email.focus();			
			return false;
		}

		if(!ValidateConsonants(Email.value))
		{
			alert("Please check your email address.");
			Email.focus();			
			return false;
		}		
	}
	
	
	//City
	if (City.value != '')
	{
		if (!ValidateCityState(City.value))
		{
			alert("Please check your city.");
			City.focus();			
			return false;
		}
		if(!ValidateConsonants(City.value))
		{
			alert("Please check your city.");
			City.focus();			
			return false;
		}
	}
	
	
	if (Phone.value != "")
	{
		if(!ValidatePhone(Phone.value))
		{
			alert("Please, enter a valid phone number.");
			Phone.focus();
			return false;
		}
	}
	
	if (CellPhone.value != "")
	{
		if(!ValidatePhone(CellPhone.value))
		{
			alert("Please, enter a valid mobile phone number.");
			CellPhone.focus();
			return false;
		}
	}
	return true;
}
	

function trim(myString)
{
 return myString.replace(/^\s+/g,'').replace(/\s+$/g,'')
}

function ValidatePhone(incoming)
{
	var ValidChars = "0123456789.()- ";
	var IsCorrect=true;
	var Char;

	for (cont = 0; cont < incoming.length && IsCorrect == true; cont++) 
	{ 
		Char = incoming.charAt(cont); 
		if (ValidChars.indexOf(Char) == -1) 
			return false;
	}
	return true;
}


function ValidateConsonants(valor) 
{
       valor = valor.toLowerCase();
	if (/[bcdfghjklmnpqrstvwxyz]{7}/.test(valor))
		return false;
	else
		return true;
}  


function ValidateName(valor) 
{
      	valor = valor.toLowerCase();
	if (/^[a-z ]+$/i.test(valor))
		return true;
	else
		return false;
} 

function ValidateEmailCharacters(valor)
{
	valor = valor.toLowerCase();
 	var ValidChars = "abcdefghijklmnopqrstuvwxyz0123456789@.-_";   
 	var Char;
 	var IsCorrect=true;
	
	for (cont = 0; cont < valor.length && IsCorrect == true; cont++) 
 	{ 
	  	Char = valor.charAt(cont); 
  		if (ValidChars.indexOf(Char) == -1) {
			return false;
		}
	}
	return true;
}

function ValidateEmail(valor) 
{    
	var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]{2,60}(\.[a-zA-Z]{2,4}){1,2}$/;  
    return emailPattern.test(valor); 
}

function ValidateEmailDomain(valor) 
{
	valor = valor.toLowerCase();
	if (/.ru$|.sk$|.ua$/i.test(valor))
		return false;	
	else
		return true;
}  
	


function ValidateCityState(valor) 
{
	valor = valor.toLowerCase();
	if (/^[a-z ]+$/i.test(valor))
		return true;
	else
		return false;
} 

function ValidateAreaCode(incoming)
{
	var ValidChars = "0123456789";
	var IsCorrect=true;
	var Char;

	for (cont = 0; cont < incoming.length && IsCorrect == true; cont++) 
	{ 
		Char = incoming.charAt(cont); 
		if (ValidChars.indexOf(Char) == -1) 
			return false;
	}
	return true;
}

