function List(name) { var url = '/list/'; var key = name; this.sort = sort; this.page = page; this.refresh = refresh; this.show = show; function sort(sort) { this.refresh('sort', sort); } function page(page) { this.refresh('page', page); } function refresh(func, data) { Effect.Fade(key + 'DIV', { duration:0.125, to:0.1 }); var myAjax = new Ajax.Updater(key + 'DIV', url + func + '/' + key + '/' + data, { method: 'get', evalScripts: true, onComplete: this.show }); } function show() { new Effect.Appear(key + 'DIV', { duration:0.125 }); } }