﻿/// <reference name="MicrosoftAjax.debug.js" />
/// <reference name="MicrosoftAjaxTimer.debug.js" />
/// <reference name="MicrosoftAjaxWebForms.debug.js" />
/// <reference path="jquery.intellisense.js"/>
/// <reference path="jquery.validate.js"/>

/// <reference path="Kleenex.Core.js"/>

Kleenex.MyAccount = function(clientId, regionCode)
{
    this.ClientID = clientId;
    this.RegionCode = regionCode;
    this.Selector = "#" + clientId;
    this.Initialize();
};
Kleenex.MyAccount.prototype =
{
    Name: 'Kleenex.MyAccount',
    __typeName: 'Kleenex.MyAccount',
    __class: true,
    AttachEvents: function() {
        var __app = this;
        var context = $(this.Selector);

        var handleCollapseAll = function() {
            $('.MyAccountCardListing', context).slideUp(350);
            $('.cardStateToggle', context).text('View');
        };

        var handleExpandAll = function() {
            $('.MyAccountCardListing', context).slideDown(350);
            $('.cardStateToggle', context).text('Close');
        };

        var handleCreateCardClick = function() {
        if (__app.RegionCode === Kleenex.Variables.RegionCode) {
                Kleenex.ShowModal(Kleenex.Variables.LIOCardCreationUrl, true);
            }
            else {
                Kleenex.ShowModal(Kleenex.Variables.FeelCardCreationUrl, true);
            }
        };

        $('#hrefCloseAll', context).click(handleCollapseAll);
        $('#hrefViewAll', context).click(handleExpandAll);
        $('#userModeCardCreation', context).click(handleCreateCardClick);

        $('div.MyAccountNav input[type="image"]:not(.On)', context).hover(
	    function() {
	        this.src = this.src.replace("Off.gif", "On.gif");
	    },
	    function() {
	        this.src = this.src.replace("On.gif", "Off.gif");
	    });

    },
    Display: function() {
        var __app = this;
    }
};

Kleenex.Extend(Kleenex.MyAccount, Kleenex.UserControl);