(function($){
// http://blog.brandonaaron.net/2007/06/01/jquery-snippets-replace/
// returns the new element (that has replaced the old)
$.fn.replace_with = function(){
	var stack = [];
	return this.domManip(arguments, true, 1, function(_c){
		this.parentNode.replaceChild(_c, this);
		stack.push(_c);
	}).pushStack(stack);
};

$.fn.session_associate = function(){
	$(this).find(".sign-in, .sign-out").click(function(){
		popup_dialog.reloadable(this.href, function(){ $(this).find("input[type=text]").first().focus() });
		return false;
	})
	$(this).find(".user-edit").click(function(){
		popup_dialog.reloadable(this.href/*, function(){ $(this).convert_file_inputs(); $(document).trigger('popup-content-changed', this); }*/);
		return false;
	});
	return $(this);
};

$(document).ready(function(){ $("body").session_associate() });
})(jQuery);

