document.observe('dom:loaded', function () { //RESORTABLE CATEGORIES Sortable.create('sortable_categories', {scroll:window, tag:'div', handle: 'cat_handle', onUpdate: function () { //save the new items order new Ajax.Request('/content/networks/discussion-forum/ajax/php/update_categories_order.php', { method: 'post', parameters: $H({ order: Sortable.serialize("sortable_categories") }) } ); } }); }); //COLLAPSABLE CATEGORIES function col_category(category, element) { Effect.toggle(category, "Blind"); if (element.down().readAttribute("image") == "collapse") { new Ajax.Request('/content/networks/discussion-forum/ajax/php/update_collapsed_categories.php', { method: 'get', parameters: $H({ category_id: element.down().readAttribute('catid'), collapsed: 0 }) } ); element.down().src = "/images/main/expand.png"; element.down().writeAttribute("image", "expand"); } else { new Ajax.Request('/content/networks/discussion-forum/ajax/php/update_collapsed_categories.php', { method: 'get', parameters: $H({ category_id: element.down().readAttribute('catid'), collapsed: 1 }) } ); element.down().src = "/images/main/collapse.png"; element.down().writeAttribute("image", "collapse"); } }