$.accordian = function(items, first, options) {
var active = first;
var running = 0;
var titles = options && options.titles || '.heading';
var contents = options && options.contents || '.zmest';
var onClick = options && options.onClick || function(){};
var onShow = options && options.onShow || function(){};
var onHide = options && options.onHide || function(){};
var showSpeed = options && options.showSpeed || 'slow';
var hideSpeed = options && options.hideSpeed || 'slow';
$(items).not(active).children(contents).hide();
$(items).not(active).each(onHide);
$(active).each(onShow);
$(items).children(titles).click(function(e){
var p = $(contents, this.parentNode);
$(this.parentNode).each(onClick);
if (running || !p.is(":hidden")) return false;
running = 2;
$(active).children(contents).not(':hidden').slideUp(hideSpeed, function(){--running;});
p.slideDown(showSpeed, function(){--running;});
$(active).each(onHide);
active = '#' + $(this.parentNode)[0].id;
$(active).each(onShow);
return false; }); };
function simpleLog(message) {
$('<div>' + message + '</div>').appendTo('#log'); }
$(function(){ $.accordian('#accordion > div', '#item11'); });