I have the following jquery plugin that I use to create a menu system.

jQuery.fn.initMenu = function() {

return $(this).each(function() {
var $menu = $(this);

// Set the container's height
$menu.find('.sub').show();
$menu.parent().height($menu.height() + 10);
$menu.find('.sub').hide();

// Append arrow to submenu items
$menu.find('li:has(ul)').each(function() {
$(this).children('a').append("<span class='arrow'>&raquo;</span>");
});
$menu.find('.sub').hide();

// The main part
$menu.find('li a').click(function(e) {

e.stopImmediatePropagation();
var $submenu = $(this).next(), $this = $(this);

if($menu.hasClass('noaccordion')) {
if($submenu.length == 0) {
window.location.href = this.href;
}
$submenu.slideToggle('normal');
return false;
} else {
// Using accordeon
if($submenu.hasClass('sub') && $submenu.is(':visible')) {
// If already visible, slide up
if($menu.hasClass('collapsible')) {
$menu.find('.sub:visible').slideUp('normal');
return false;
}
return false;
} else if($submenu.hasClass('sub') && !$submenu.is(':visible')) {
// If not visible, slide down
$menu.find('.sub:visible').slideUp('normal');
$submenu.slideDown('normal');
return false;
}
}
});

});

};

The line of code
return $(this).each(function() {
messes up a couple of jquery scripts that I use. I think it is because many of the scripts are named function(). Does anyone know a way around this or can I alter this script so I do not have to use return $(this).each(function() {
If I comment out this line of code the rest of my page works fine, but my menu is broken. thanks in advance.