It seems that you're trying to build a jQuery plugin. You should constrain your plugin's methods to a private scope, and you should also iterate over the elements given to the plugin by the jQuery selector, and return them by using jQuery's "each" to preserve the chaining abilities:
// wrap the plugin code inside an anonymous function
// to keep the global namespace clean
(function($){
$.fn.my_function = function() {
return this.each(function(){
function foo() {
// stuff here
}
function bar() {
// stuff here
}
// now you can use your foo and bar which ever way you want
// inside the plugin
$(this).focus(function(event){
// do some stuff
...
// call the function defined previously in the plugin code
foo();
});
$(this).blur(function(event){
// do some stuff
...
// call the function defined previously in the plugin code
bar();
});
});
};
})(jQuery);
You might wanna have a look at these articles for more info on jQuery plugin development:
http://www.learningjquery.com/2007/10/a-plugin-development-pattern
http://docs.jquery.com/Plugins/Authoring
However, if you're doing just some "utility"-type functions, you can just tie them to jQuery namespace like this:
$.foo = function(){
// do stuff
};
$.bar = function(){
// do stuff
};