/// <reference path="//Microsoft.WinJS.1.0/js/ui.js" />  
/// <reference path="//Microsoft.WinJS.1.0/js/base.js" />  
(function () {
    "use strict";
    WinJS.Namespace.define("Win8Webinar.Binding.Helpers", {
        getValue: function (item, itemProperties) {
            if (itemProperties.length === 1) {
                return item[itemProperties[0]];
            }
            else {
                var element = eval("item['" + itemProperties.slice(0, itemProperties.length - 1).join("']['") + "']");
                return element[itemProperties[itemProperties.length - 1]];
            }
        },
        setValue: function (item, itemProperties, val) {
            if (itemProperties.length === 1) {
                item[itemProperties[0]] = val;
            }
            else {
                var element = eval("item['" + itemProperties.slice(0, itemProperties.length - 1).join("']['") + "']");
                element[itemProperties[itemProperties.length - 1]] = val;
            }
        },
        getObject: function (item, itemProperties) {
            if (itemProperties.length === 1) {
                return item;
            }
            else {
                return eval("item['"
                            + itemProperties.slice(0, itemProperties.length - 1).join("']['") + "']");
            }
        },
    });
})();