In the case of the calendar project, it was set up like this:
calendar = function(){
var cal = { d:1, m:1, y:2006 }
var monthView = {
getEvents:function(){
var url = '/getevents?d= ' + cal.d
+ '&m=' + cal.m
+ '&y=' + cal.y;
Ajax.call(url);
}
}
cal.month = monthView;
return cal;
}();
This is more of a pseudo-code but you can see that the monthView object is still available externally via the calendar.month object and internally via the monthView object. Likewise, the monthView object can access the cal object and any of its properties. I had an object for both the day and weekly views as well, attached to the cal
object in the same way.