/* ================================================================ 
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='';
					getdt[z+1].className='';
				}
			}
		}
	}
}
function expand (cY, fY, subY) {
cY=cY+8;
if (cY <= fY) {
document.getElementById(subY).style.height = cY + "px";
setTimeout ("expand("+cY+","+fY+",'"+subY+"')", 1);
}
}

function contract (cZ, fZ, subZ) {
if (cZ >= fZ) {
cZ=cZ-8;
document.getElementById(subZ).style.height = cZ + "px";
setTimeout ("contract("+cZ+","+fZ+",'"+subZ+"')", 1);
}
}
function defaultmenu(DDid) {
			for (var z=0; z<getdd.length; z++) {
				if (getdd[z].id.indexOf(getdt[DDid].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(getdt[DDid].id) !=-1 && getdd[z].className=='') {
					getdd[z].className='selected'; 
					getdt[DDid].className='slide';
					}
				else {
					getdd[z].className='';
					getdt[z+1].className='';
					}
			}
}
function defautmenunotscroll(ddId2, ddHeight){
	getdd[ddId2].style.height = ddHeight+"px";
}