function CheckAge()
{
	var birthDay = parseInt(document.getElementById('PersonalInformation_txtBirthDay').value);
	var birthMonth = parseInt(document.getElementById('PersonalInformation_txtBirthMonth').value) - 1;
	var birthYear = parseInt(document.getElementById('PersonalInformation_txtBirthYear').value);
	var birthDate = new Date(birthYear, birthMonth, birthDay);
	
	if (!isNaN(birthDate))
	{
		var dataDiff = new Date();
		var today = new Date(document.getElementById('PersonalInformation_hidTodayDate').value);
		dataDiff.setTime(Math.abs(today.getTime() - birthDate.getTime()));
		var anniDiff = parseInt(dataDiff.getFullYear() - 1970);

		if ((anniDiff >= 14) && (anniDiff < 18))
		{
			document.getElementById('PersonalInformation_rdlAlitaliaNews_1').checked = true;
			document.getElementById('PersonalInformation_rdlPartnersNews_1').checked = true;
			document.getElementById('PersonalInformation_rdlMailingType_0').checked = true;
			document.getElementById('PersonalInformation_hidNews').value = "No";
			document.getElementById('PersonalInformation_rdlAlitaliaNews').disabled = true;
			document.getElementById('PersonalInformation_rdlPartnersNews').disabled = true;
			document.getElementById('PersonalInformation_rdlMailingType').disabled = true;
			
			
		}
		else
		{
			var myLocation = location.pathname.toUpperCase();
			var searchString = new String("ProfileNew");
														
			if (myLocation.indexOf(searchString.toUpperCase())<0)
				{
					document.getElementById('PersonalInformation_rdlAlitaliaNews_0').checked = true;
					document.getElementById('PersonalInformation_rdlPartnersNews_0').checked = true;
					document.getElementById('PersonalInformation_rdlMailingType_0').checked = true;
					document.getElementById('PersonalInformation_hidNews').value = "Yes";
				}	
		  
			document.getElementById('PersonalInformation_rdlAlitaliaNews').disabled = false;
			document.getElementById('PersonalInformation_rdlPartnersNews').disabled = false;
			document.getElementById('PersonalInformation_rdlMailingType').disabled = false;
						
		}
		
	}
}

function EnableOrDisableSMSBox()
{
	var phoneNumber = document.getElementById("PersonalInformation_txtPhoneNumber");
	var smsBox = document.getElementById("PersonalInformation_rdlSMSAuthorization");
	var smsBoxNo = document.getElementById("PersonalInformation_rdlSMSAuthorization_1");
	var smsLabel = document.getElementById("PersonalInformation_lblSMSAuthotization");

	if ((phoneNumber.value).length > 0) 
	{
		smsBox.disabled = false;
		smsLabel.disabled = false;
  }
  else 
  {
		smsBoxNo.checked = true;
    smsBox.disabled = true;
    smsLabel.disabled = true;
	}
}

