// SCOTT.CSC.StoreLocator

/// <reference name="MicrosoftAjax.debug.js" />
/// <reference name="MicrosoftAjaxTimer.debug.js" />
/// <reference name="MicrosoftAjaxWebForms.debug.js" />

/// <reference path="jquery-1.2.6-vsdoc.js"/>

SCOTT.CSC.StoreLocator = function(clientId, rfv1id, rfv2id, rfv3id, rfv4id) {
    this.ClientID = clientId;
    this.Selector = '#' + clientId;
    this.Rfv1 = $('#' + rfv1id).get(0);
    this.Rfv2 = $('#' + rfv2id).get(0);
    this.Rfv3 = $('#' + rfv3id).get(0);
    this.Rfv4 = $('#' + rfv4id).get(0);
    this.Initialize();
};

SCOTT.CSC.StoreLocator.prototype =
{
    Name: 'SCOTT.CSC.StoreLocator',
    __typeName: 'SCOTT.CSC.StoreLocator',
    __class: true,
    AttachEvents: function() {
        var __app = this;
        var context = $(this.Selector);

        var showHide = function(val) {
            if (val == 'towels') {
                $('.choose', context).hide();
                $('.towels', context).show();
                $('.tissue', context).hide();
                $('.moist', context).hide();
                $('.napkins', context).hide();

                ValidatorEnable(__app.Rfv1, true);
                ValidatorEnable(__app.Rfv2, false);
                ValidatorEnable(__app.Rfv3, false);
                ValidatorEnable(__app.Rfv4, false);
            }
            else if (val == 'tissue') {
                $('.choose', context).hide();
                $('.towels', context).hide();
                $('.tissue', context).show();
                $('.moist', context).hide();
                $('.napkins', context).hide();

                ValidatorEnable(__app.Rfv1, false);
                ValidatorEnable(__app.Rfv2, true);
                ValidatorEnable(__app.Rfv3, false);
                ValidatorEnable(__app.Rfv4, false);
            }
            else if (val == 'moist') {
                $('.choose', context).hide();
                $('.towels', context).hide();
                $('.tissue', context).hide();
                $('.moist', context).show();
                $('.napkins', context).hide();

                ValidatorEnable(__app.Rfv1, false);
                ValidatorEnable(__app.Rfv2, false);
                ValidatorEnable(__app.Rfv3, true);
                ValidatorEnable(__app.Rfv4, false);
            }
             else if (val == 'napkins') {
                $('.choose', context).hide();
                $('.towels', context).hide();
                $('.tissue', context).hide();
                $('.moist', context).hide();
                $('.napkins', context).show();

                ValidatorEnable(__app.Rfv1, false);
                ValidatorEnable(__app.Rfv2, false);
                ValidatorEnable(__app.Rfv3, false);
                ValidatorEnable(__app.Rfv4, true);
            }
            else {
                $('.choose', context).show();
                $('.towels', context).hide();
                $('.tissue', context).hide();
                $('.moist', context).hide();
                $('.napkins', context).hide();

                ValidatorEnable(__app.Rfv1, false);
                ValidatorEnable(__app.Rfv2, false);
                ValidatorEnable(__app.Rfv3, false);
                ValidatorEnable(__app.Rfv4, false);
            }
        };

        $('select:first', context).change(function(e) {
            var val = $(this).val();
            showHide(val);
        });

    }
};

SCOTT.CSC.Extend(SCOTT.CSC.StoreLocator, SCOTT.CSC.UserControl);
