$(document).ready(function(){ $('div#further-actions').addClass('js'); $('ul#further-tabs li a').click(function(){ var tab_id = $(this).parent().attr("id").replace(/-tab$/, "-content"); $('ul#further-tabs li.selected, ul#further-content li.selected').removeClass('selected'); $(this).parent().addClass('selected'); $('ul#further-content li#' + tab_id).addClass('selected'); return false; }); $('ul#further-content li div.expander > p').wrapInner(''); $('ul#further-content li div.expander > p a').click(function(){ var form = $(this).parent().next(); if(form.is(':hidden')){ form.css('opacity','0'); form.slideDown(400,function(){ form.animate({opacity:1},400); }); } else { form.animate({opacity:0},400,function(){ form.slideUp(400); }); } return false; }); $('ul#further-content li div.expander > p + *').css("display", "none"); });