﻿var rblTripType;
var ddlInsuredPersons;
var trPartnerAge;
var trDurationDays;
var rqfvldPartnerAge;
var rqfvldDurationDays;

addLoadEvent(function()
{
	rblTripType_OnClick();
	ddlInsuredPersons_OnChange();
});

function rblTripType_OnClick()
{
	var value = 2;

	radioButtons = rblTripType.getElementsByTagName('input');

    for(var count = 0; count < radioButtons.length; count++)
    {
		if(radioButtons[count].checked)
		{
			value = radioButtons[count].value
		}
    }

	if(value == 1)
	{
		trDurationDays.style.display = (IEVersion() == -1 || IEVersion() >= 8) ? 'table-row' : 'inline';
		ValidatorEnable(rqfvldDurationDays, true);
		rqfvldDurationDays.style.visibility = 'hidden';
	}
	else
	{
		trDurationDays.style.display = 'none';
		ValidatorEnable(rqfvldDurationDays, false);
	}
}

function ddlInsuredPersons_OnChange()
{
	if(ddlInsuredPersons.value == 2 || ddlInsuredPersons.value == 4)
	{
		trPartnerAge.style.display = (IEVersion() == -1 || IEVersion() >= 8) ? 'table-row' : 'inline';
		ValidatorEnable(rqfvldPartnerAge, true);
		rqfvldPartnerAge.style.visibility = 'hidden';
	}
	else
	{
		trPartnerAge.style.display = 'none';
		ValidatorEnable(rqfvldPartnerAge, false);
	}
}

