﻿function clientValidateCountryPayPage(source, arguments)
{
    var pnlTxtCountryRef = document.getElementById(prefixTagNameMain + 'pnlTxtCountryPayPage');
    var txtCountryRef = document.getElementById(prefixTagNameMain + 'txtCountryPayPage');
    var drpCountriesRef = document.getElementById(prefixTagNameMain + 'drpCountriesPayPage');

    try
    {
        if (pnlTxtCountryRef)
        {
            if (trim(txtCountryRef.value).length == 0)
                arguments.IsValid = false;
            else
                arguments.IsValid = true;
        }
        else if (drpCountriesRef.selectedIndex == 0)
            arguments.IsValid = false;
        else
            arguments.IsValid = true;
    }
    catch (err)
    {
        arguments.IsValid = false;
    }
}

function clientValidateCityPayPage(source, arguments)
{
    var pnlTxtCityRef = document.getElementById(prefixTagNameMain + 'pnlTxtCityPayPage');
    var txtCityRef = document.getElementById(prefixTagNameMain + 'txtCityPayPage');
    var drpCitiesRef = document.getElementById(prefixTagNameMain + 'drpCitiesPayPage');

    try
    {
        if (pnlTxtCityRef)
        {
            if (trim(txtCityRef.value).length == 0)
                arguments.IsValid = false;
            else
                arguments.IsValid = true;
        }
        else if (drpCitiesRef.selectedIndex == 0)
            arguments.IsValid = false;
        else
            arguments.IsValid = true;
    }
    catch (err)
    {
        arguments.IsValid = false;
    }
}

function clientValidateDistrictPayPage(source, arguments)
{
    var pnlTxtDistrictRef = document.getElementById(prefixTagNameMain + 'pnlTxtDistrictPayPage');
    var txtDistrictRef = document.getElementById(prefixTagNameMain + 'txtDistrictPayPage');
    var drpDistrictsRef = document.getElementById(prefixTagNameMain + 'drpDistrictsPayPage');

    try
    {
        if (pnlTxtDistrictRef)
        {
            if (trim(txtDistrictRef.value).length == 0)
                arguments.IsValid = false;
            else
                arguments.IsValid = true;
        }
        else if (drpDistrictsRef.selectedIndex == 0)
            arguments.IsValid = false;
        else
            arguments.IsValid = true;
    }
    catch (err)
    {
        arguments.IsValid = false;
    }
}

function setDivPayPageCA(isInput)
{
    var divCAListRef = $('divCAListPayPage');
    var divCAInputRef = $('divCAInputPayPage');
    if (isInput)
    {
        divCAListRef.style.display = 'none';
        divCAInputRef.style.display = 'block';
    }
    else
    {
        divCAListRef.style.display = 'block';
        divCAInputRef.style.display = 'none';
    }
}

function setDivPayPageCAByEffect(isInput)
{
    if (isInput)
    {
        new Effect.Fade('divCAListPayPage', { duration: 0.5, afterFinish: function() { new Effect.Appear('divCAInputPayPage'); } });
    }
    else
    {
        new Effect.Fade('divCAInputPayPage', { duration: 0.5, afterFinish: function() { new Effect.Appear('divCAListPayPage'); } });
    }
}

function setDivBtnBackPayPageCA(isVisible)
{
    var divBtnBackCARef = $('divBtnBackPayPageCA');
    if (isVisible)
        divBtnBackCARef.style.display = 'block';
    else
        divBtnBackCARef.style.display = 'none';
}

function payPageCANext()
{
    new Effect.Fade('divPayPageCA', { duration: 0.5, afterFinish: function() { new Effect.Appear('divPayPageCBI'); } });
}