function SetValueCheckBox(checkbox)
{
 checkbox.value="No";
 if (checkbox.checked)
 checkbox.value="Yes";
}

function ValidateData()
{
	var contactDate = document.getElementById('contactDate');
	var FullName = getElementLarge('txtFullName');
	var Address = getElementLarge('txtAddress');
	var City = getElementLarge('txtCity');
	var State = document.getElementById('ddlState');
	var ZipCode = getElementLarge('txtZipCode');
	var Phone = getElementLarge('txtPhone');
	var Email = getElementLarge('txtEmail');
	var ProcedureInterest = document.getElementById('ddlProcedureInterest');
	var Comments = getElementLarge('txtComments');

	if (contactDate.value != "")
	{
		return false;
	}
	
	_gaq.push(['_trackEvent', 'Webform', 'Start Submit', 'Large Contact']);

	if (FullName.value == "")
	{
		alert('Please, enter your full name.');
		FullName.focus();
		_gaq.push(['_trackEvent', 'Webform', 'Validation Error - Full Name', 'Large Contact']);
		return false;
	}
	else
	{
		if(!ValidateName(FullName.value))
		{
			alert("Please check your full name.");
			FullName.focus();
			_gaq.push(['_trackEvent', 'Webform', 'Validation Error - Full Name', 'Large Contact']);
			return false;
		}

		if(!ValidateConsonants(FullName.value))
		{
			alert("Please check your full name.");
			FullName.focus();
			_gaq.push(['_trackEvent', 'Webform', 'Validation Error - Full Name', 'Large Contact']);
			return false;
		}
	}
	
	
	if (Address.value == "")
	{
		alert('Please, enter your address.');
		Address.focus();
		_gaq.push(['_trackEvent', 'Webform', 'Validation Error - Address', 'Large Contact']);
		return false;
	}

	if (City.value == "")
	{
		alert('Please, enter your city.');
		City.focus();
		_gaq.push(['_trackEvent', 'Webform', 'Validation Error - City', 'Large Contact']);
		return false;
	}
	else
	{
		if (!ValidateName(City.value))
		{
			alert("Please check your city.");
			City.focus();
			_gaq.push(['_trackEvent', 'Webform', 'Validation Error - City', 'Large Contact']);
			return false;
		}
		if(!ValidateConsonants(City.value))
		{
			alert("Please check your city.");
			City.focus();
			_gaq.push(['_trackEvent', 'Webform', 'Validation Error - City', 'Large Contact']);
			return false;
		}
	}
	
	
	if (State.value == "")
	{
		alert('Please, select your state.');
		State.focus();
		_gaq.push(['_trackEvent', 'Webform', 'Validation Error - State', 'Large Contact']);
		return false;
	}
	
	
	if (ZipCode.value == "")
	{
		alert('Please, enter your zip.');
		ZipCode.focus();
		_gaq.push(['_trackEvent', 'Webform', 'Validation Error - ZipCode', 'Large Contact']);
		return false;
	}
	else
	{
		if (ZipCode.value.length < 5)
		{
			alert("Please enter at most 5 characters in the zip field.");
			ZipCode.focus();
			_gaq.push(['_trackEvent', 'Webform', 'Validation Error - ZipCode', 'Large Contact']);
			return false;
		}
				
		if (!ValidateAreaCode(ZipCode.value))
		{
			alert('Please, check your zip code.');    	   
			ZipCode.focus();
			_gaq.push(['_trackEvent', 'Webform', 'Validation Error - ZipCode', 'Large Contact']);
			return false;
		}
	}
	
	
	if (Phone.value == "")
	{
		alert('Please, enter your phone number.');
		Phone.focus();
		_gaq.push(['_trackEvent', 'Webform', 'Validation Error - Phone', 'Large Contact']);
		return false;
	}
	else 
	{
		if(!ValidatePhone(Phone.value))
		{
			alert("Please, enter a valid phone number.");
			Phone.focus();
			_gaq.push(['_trackEvent', 'Webform', 'Validation Error - Phone', 'Large Contact']);
			return false;
		}
	}

	var chkBotoxBonus = getElementLarge('chkBotoxBonus');
	var chkBotoxFriends = getElementLarge('chkBotoxFriends')
	var chkBotoxPrivate = getElementLarge('chkBotoxPrivate')
	var chkSingUp = getElementLarge('chkSingUp')
	
	if (!(chkBotoxBonus.checked || 
		chkBotoxFriends.checked ||
		chkBotoxPrivate.checked ||
		chkSingUp.checked
		))
	{
		alert('Please, select a info.');
		_gaq.push(['_trackEvent', 'Webform', 'Validation Error - Info', 'Large Contact']);
		return false;
		
	}
	
	if (Email.value == "")
	{
		alert('Please, enter your email.');
		Email.focus();
		_gaq.push(['_trackEvent', 'Webform', 'Validation Error - Email', 'Large Contact']);
		return false;
	}
	else
	{	
		if(!ValidateEmailCharacters(Email.value))
		{
		   	alert("Please check your email.");
		  	Email.focus();
			_gaq.push(['_trackEvent', 'Webform', 'Validation Error - Email', 'Large Contact']);
		   	return false;
		}
		if(!ValidateEmail(Email.value))
		{
			alert("Please check your email.");
			Email.focus();
			_gaq.push(['_trackEvent', 'Webform', 'Validation Error - Email', 'Large Contact']);
			return false;
		}
		if(!ValidateEmailDomain(Email.value))
		{
			alert("Please check your email, domain (.ru, .sk, .ua) isn't valid.");
			Email.focus();
			_gaq.push(['_trackEvent', 'Webform', 'Validation Error - Email', 'Large Contact']);
			return false;
		}
		if(!ValidateConsonants(Email.value))
		{
			alert("Please check your email.");
			Email.focus();
			_gaq.push(['_trackEvent', 'Webform', 'Validation Error - Email', 'Large Contact']);
			return false;
		}
	}
	
	
	if (ProcedureInterest.selectedIndex < 1)
	{
		alert('Please, select a procedure.');
		ProcedureInterest.focus();
		_gaq.push(['_trackEvent', 'Webform', 'Validation Error - Procedure', 'Large Contact']);
		return false;
	}
	
	if (Comments.value == "")
	{
		alert('Please, enter your comments.');
		Comments.focus();
		_gaq.push(['_trackEvent', 'Webform', 'Validation Error - Comment', 'Large Contact']);
		return false;
	}	
	
	if (chkBotoxBonus.checked)
	{
		chkBotoxBonus.value = 'Yes';
	}
	
	if (chkBotoxFriends.checked)
	{
		chkBotoxFriends.value = 'Yes';
	}
	
	if (chkBotoxPrivate.checked)
	{
		chkBotoxPrivate.value = 'Yes';
	}
	
	if (chkBotoxPrivate.checked)
	{
		chkBotoxPrivate.value = 'Yes';
	}
	
	if (chkSingUp.checked)
	{
		chkSingUp.value = 'Yes';
	}
	
	_gaq.push(['_trackEvent', 'Webform', 'Submit Ok', 'Large Contact']);
	return true;
}



function trim(myString)
{
 return myString.replace(/^\s+/g,'').replace(/\s+$/g,'')
}

function getElementLarge(name)
{
	var object = null;
	var tbLargeContact=document.getElementById('tbLargeContact'); 
	for (var i=0; i<tbLargeContact.rows.length; i++)
    {
        for (var j=0; j<tbLargeContact.rows[i].cells.length; j++)
        {
            for (var k=0; k<tbLargeContact.rows[i].cells[j].childNodes.length; k++)
            {                
                if(tbLargeContact.rows[i].cells[j].childNodes[k].id == name)
                {
                    object = tbLargeContact.rows[i].cells[j].childNodes[k];
                    return object;
                }
            }
        }
        
    }    
}


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 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;
}

