define namespace in JS
function regNamespace(namespace) { var parts = namespace.split("."); var root = "window"; for (var i = 0; i < parts.length; i++) { var part = parts[i]; root = root + "." + part; if (eval(root) == undefined) { eval(root + "= {};") } } } regNamespace("MyNS") regNamespace("MyNS.Funcs") MyNS.Options = { Yes:"Yes", No:"No" }; MyNS.Funcs.show = function () { alert("hello"); }