YUI has a nice way of creating a namespace for your methods etc. in javascript.
Does jQuery have anything similiar?
check out this blog: http://javascriptweblog.wordpress.com/2010/12/07/namespacing-in-javascript/
the self-invoking dynamic namespacing is what i've used before:
var myApp = {};
(function(context) {
var id = 0;
context.next = function() {
return id++;
};
context.reset = function() {
id = 0;
}
})(myApp);
window.console && console.log(
myApp.next(),
myApp.next(),
myApp.reset(),
myApp.next()
); //0, 1, undefined, 0