/* Main class for javascript example */
declarePackage("ccs.pnp.smart_shopper.points");


ccs.pnp.smart_shopper.points.Main = function() {

    var self;
    // constructor function
    function constructorFn() {
        self = this;
        registerOnLoad(self.init);
    }

    // init function called once document is loaded
    constructorFn.prototype.init = function() {
    }


    constructorFn.prototype.updatePoints = function() {
        $("throbber").style.display = 'block';
        var points
        new Ajax.Request(ccs.contextPath + '/json/' + ccs.appName + '/' + ccs.languageCode + '/modules/smart_shopper_show_points/get_user_points.json',
        {
            method:'post',
            onSuccess: function(transport) {
                $("throbber").style.display = 'none';
                var res = transport.responseText.evalJSON();
                if (res.success == true) {
				 $("points").style.display = 'block'; 
                 $("points").innerHTML = res.cardPoints;
                 $("name").style.display = 'block';
                 $("desc").style.display = 'block';
                }
                //$("name").innerHTML = res.logInName;
            },
            onFailure: function() {
                $('throbber').style.display = 'none';
            }
        });
    }
    return new constructorFn();
}

