﻿
App.Account.Register = function() {

    /* Private */

    /* Properties */

    var cmp = {};





    /* Methods */

    var init = function() {

        /* Constructor */
        
        cmp.mcnRegisterForm = new TVI.Form({
        
            ID: 'mcnRegisterForm',
            url: TVI.handlers + 'App.Account.aspx/register',
            load: {
                meta: true,
                metaQuery: 'App_getCountries',
                success: function() {

                    //refresh countries
                    this.field('country').el.find('SELECT').change();

                }
            },
            success: function(d){
            
                window.location.href = '/my';
            
            }
        
        });

        //handle login event
        TVI.addListener('accountChanged', function(d) {

            if (d !== undefined) { window.location.href = '/my'; }

        });

    };





    /* Public */

    TVI.apply(cmp, {

        /* Properties */

        /* Methods */

    });


    TVI.ready(init);


    return cmp;


} ();
