I'm wondering how it works. I would like to use $(this) to do two things. In the script below, only the first one executes. The rest of the script is ignored.

Code JavaScript:
$("#groups").delegate("a", "click", function() {
		window.location.hash = $(this).attr("href");
		$("#groups a").removeClass('active');
 
         // if the .addClass line below is not commented out, the rest of the script is ignored.
		$(this).addClass('active');
 
		// find the new page name by class
		var pageName = $(this).attr('class');
 
		// switch the bg in the css
		$("html").css("background-image","url(images/" + pageName + ".jpg)");
 
		return false;
	});
Your help is greatly appreciated, as always!