﻿/// All Netqast javascript helper functions
/// <reference path="firebug-vsdoc.js" />

var netqast = {
parseConfig: function(rawConfig) {
        /// <summary>
        ///     Parses the config provided by the server in the "netqast" attribute of a DOM element.
        /// </summary>
        /// <param name="rawConfig" type="String">
        ///     The raw config string which his a hash (#) separated string of key=value pairs.
        /// </param>
        /// <returns type="Object">Example: {start: 0, count: 5, sortby: "rating"}</returns>
        
        var config = rawConfig.split("#");
        var dictionary = {};

        for (var i in config) {
            nameValuePair = config[i].split("=");
            dictionary[nameValuePair[0]] = nameValuePair[1];
        }

        return dictionary;
    },

    isUndefined: function(value) {
        /// <summary>
        ///     Tests if the passed in value is undefined.
        /// </summary>
        /// <param name="value">
        ///     The value being tested.
        /// </param>
        /// <returns type="Boolean"/>
        
        return (typeof(value) == "undefined");
    }
};
