/* ================================================================
This copyright notice must be untouched at all times.

The original version of this script and the associated (x)html
is available at http://www.stunicholls.com/menu/pro_concertinaslide_2.html
Copyright (c) 2005-2008 Stu Nicholls. All rights reserved.
This script and the associated (x)html may be modified in any
way to fit your requirements.
=================================================================== */

var getdd = document.getElementById('slide').getElementsByTagName("DD");
var getdt = document.getElementById('slide').getElementsByTagName("DT");

        for (var i=0; i<getdt.length; i++) {
                getdt[i].onclick=function() {
        if (this.id.indexOf('item') != -1) {
        for (var z=0; z<getdd.length; z++) {
                if (getdd[z].id.indexOf(this.id) !=-1 && getdd[z].className=='') {
                eNext = getdd[z].firstChild;
                while (eNext.nodeType!=1) {eNext = eNext.nextSibling;}
                ulHeight = eNext.offsetHeight;
                expand (0,ulHeight,getdd[z].id)
                }
                else {
                eNext = getdd[z].firstChild;
                while (eNext.nodeType!=1) {eNext = eNext.nextSibling;}
                ulHeight = eNext.offsetHeight;
                if (getdd[z].offsetHeight > 0) {
                contract (ulHeight,0,getdd[z].id)
                }
                }
                if (getdd[z].id.indexOf(this.id) !=-1 && getdd[z].className=='') {
                        getdd[z].className='selected';
                        this.className='slide';
                        }
                else {
                        getdd[z].className='';
                        ePrevious = getdd[z].previousSibling;
                        while (ePrevious.nodeType!=1) {ePrevious = ePrevious.previousSibling;}
                        ePrevious .className='';
                        }
                }
        }
        }
}
function expand (cY, fY, subY) {
cY=cY+2;;
if (cY <= fY) {
document.getElementById(subY).style.height = cY + "px";
setTimeout ("expand("+cY+","+fY+",'"+subY+"')", 5);
}
}

function contract (cZ, fZ, subZ) {
cZ=cZ-2;
if (cZ >= fZ) {
document.getElementById(subZ).style.height = cZ + "px";
setTimeout ("contract("+cZ+","+fZ+",'"+subZ+"')", 5);
}
}
