Make intensive use of namespaces, don’t use globally declared functions
//if the namespace has already been declared, use the existing one, otherwise create an empty object
//for the namespace
var theNamespace = theNamespace | {};
//assign functions and objects in the namespace by setting properties.
theNamespace.aFunction = function(){};
Using namespace will help avoid functions with same name being overridden by each other.