
var yeah;
var yeah3;
var yeah1 = new Array(1);
var height = 100;
var height2;
var browser;


browser=navigator.appName; 

function goo(x) {
	this.location = x;
}

function bblah(x) {
	parent1 = x.parentNode;
	if (parent1) {
		if (browser=="Microsoft Internet Explorer") {
			childData = parent1.firstChild.nextSibling;
		}
		else {
			childData = parent1.firstChild.nextSibling.nextSibling.nextSibling;
		}
		dparent = parent1.parentNode.parentNode.parentNode;
		dchild = dparent.firstChild;
	
		height2 = parseInt(childData.clientHeight);
		
		var ll;
		x.style.fontWeight = 'bold';
		if (emdown2(x.parentNode, ll)) {
			for (dchilder = dchild; dchilder < dparent.lastChild; dchilder = dchilder.nextSibling) {
					dthinger = dchilder.firstChild.firstChild;
					if (dthinger != parent1) {
						k = dchilder;
						if (k.firstChild.clientHeight > 25) {
							aa = k.firstChild.firstChild;
							d = aa;
							
							var dive = new Array();
							dive = recur(parent1, dive);
							for (xx =0; xx < dive.length; xx++) {
									if (dive[xx].firstChild && dive[xx].firstChild.style.fontWeight == 'bold') {
										if (dive[xx] != x.parentNode) {
											dive[xx].firstChild.style.fontWeight = 'normal';
										}
									}
							}
							shutChild(aa.firstChild.nextSibling, dive);
							att = window.setInterval("emuper(aa, att)", 20);
							aa.firstChild.style.fontWeight='normal';
						}
					}
			}
		}
	}
	else return false;
}

function shutChild(aa, dive) {
	if (aa.firstChild != null && aa.firstChild.firstChild != null) {
		kaka = aa.firstChild.firstChild;
		var dite = new Array();
		dite = recur(kaka, dite);
		ax = dite[0];
		//alert(ax.innerHTML);
		dtt = window.setInterval("tanker(ax, dtt)", 20);
	}
}

function recur(no, dive) {
	if (no != null && no.nodeName == 'DIV') {
		dive[dive.length] = no;
	}
	if (no == null || no.firstChild == null)
		return;
	else {
		recur(no.firstChild, dive);
		recur(no.nextSibling, dive);
	}
	return dive;
}

function emuper(x, qe) {
		var d = x;
		var divs = new Array(1);
		var tc;
		for (xx=0; d.id.substr(0, 3) != "div"; d = d.parentNode) 
		{
			tc = d;
			if (d.nodeName == 'DIV') {
				divs[xx] = d;
				//alert(d.id);
				xx++;
			}
		}

		qwert = tc.parentNode;
		if (qwert.parentNode) {
//		&& x.parentNode.parentNode.parentNode.parentNode && x.parentNode.parentNode.parentNode.parentNode.parentNode
//		&& x.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode) {
			//qwert = x.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
			if (parseInt(x.clientHeight) > 20) {
				//if (qwert.clientHeight > qwert.firstChild.nextSibling.clientHeight + 20) {
				//}
				goUp(x);
				//alert(qwert.innerHTML);
				qq = window.setTimeout("somedUp(qwert, qq)", 20);
				//somedUp(qwert);
			}

			else {
				//alert("kaka");
				if (x.firstChild && x.firstChild.nextSibling && x.firstChild.nextSibling.firstChild &&
					x.firstChild.nextSibling.firstChild.firstChild &&
					x.firstChild.nextSibling.firstChild.firstChild.firstChild &&
					x.firstChild.nextSibling.firstChild.firstChild.firstChild.firstChild &&
					x.firstChild.nextSibling.firstChild.firstChild.firstChild.firstChild.firstChild &&
					x.firstChild.nextSibling.firstChild.firstChild.firstChild.firstChild.firstChild.style ) {
				x.firstChild.nextSibling.firstChild.firstChild.firstChild.firstChild.firstChild.style.height = 20 + 'px';
				alert(x.firstChild.nextSibling.firstChild.firstChild.firstChild.firstChild.firstChild.innerHTML);
				x.firstChild.nextSibling.firstChild.firstChild.firstChild.firstChild.firstChild.style.fontWeight = 'normal';
				//alert(x.firstChild.nextSibling.firstChild.firstChild.firstChild.firstChild.firstChild.innerHTML);
				x.firstChild.nextSibling.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.style.fontWeight = 'normal';
			}
			if (x.firstChild && x.firstChild.nextSibling && x.firstChild.nextSibling.firstChild &&
					x.firstChild.nextSibling.firstChild.firstChild &&
					x.firstChild.nextSibling.firstChild.firstChild.firstChild &&
					x.firstChild.nextSibling.firstChild.firstChild.firstChild.nextSibling &&
					x.firstChild.nextSibling.firstChild.firstChild.firstChild.nextSibling.firstChild &&
					x.firstChild.nextSibling.firstChild.firstChild.firstChild.nextSibling.firstChild.firstChild &&
					x.firstChild.nextSibling.firstChild.firstChild.firstChild.nextSibling.firstChild.firstChild.style ) {
				 x.firstChild.nextSibling.firstChild.firstChild.firstChild.nextSibling.firstChild.firstChild.style.height = 15 + 'px';
				 x.firstChild.nextSibling.firstChild.firstChild.firstChild.nextSibling.firstChild.firstChild.firstChild.style.fontWeight='normal';
				 //x.firstChild.nextSibling.firstChild.firstChild.firstChild.nextSibling.firstChild.firstChild.style.fontWeight = 'normal';
			}
			clearInterval(qe);
				//qet = window.setInterval("someUp(x.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode, qet)", 20);
			qwert = x.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
		}
	}
	else return false;
}

function somedUp(qwert, qe) {
	if (qwert.clientHeight > qwert.firstChild.nextSibling.clientHeight + 25) {
		qwert.style.height = qwert.clientHeight - 5 + "px";
	}
	else
		window.clearTimeout(qe);
}

function blah(x) {

	parent1 = x.parentNode;
	
	 if (browser=="Microsoft Internet Explorer") {
		childData = parent1.firstChild.nextSibling;
	 }
	 else {
		childData = parent1.firstChild.nextSibling.nextSibling.nextSibling;
	 }
		height = parseInt(childData.clientHeight);
		var qt;
		emdown(x.parentNode, qt);
}
var ax;
function slideup(x) {
	parent1 = document.getElementById("d_slidingmenus");
	theChild = parent1.firstChild;
	theChilder = theChild;
	counter = 10;

	while (theChild != parent1.lastChild) {
		yeah1 = new Array(1);
		theChilder = theChilder.firstChild;
		if (theChilder) {
			theChilder = theChilder.nextSibling;
			if (theChilder != null && theChilder.parentNode != x.parentNode) {
				
				yeah1[counter] = theChilder.parentNode;
				
// just change number here to control height
if (parseInt(yeah1[counter].clientHeight) > 25) {
					k  = yeah1[counter];
					var dive = new Array();
					if (k.firstChild != null && k.firstChild.nextSibling != null) {
						dive = recur(k.firstChild.nextSibling, dive);
						for(xx=0; xx<dive.length; xx++) {
							if (dive[xx].firstChild != null && dive[xx].firstChild.style.fontWeight == 'bold') {
								ax = dive[xx];
							}
						}
					}

					xx = window.setInterval("emup(k, xx)", 20);
					if (ax != null) {
						ax.firstChild.style.fontWeight = 'normal';
						dtt = window.setInterval("childUp(ax, dtt)", 20);
					}
					break;
				}
				counter++;
			}

		}
		theChild = theChild.nextSibling;
		theChilder = theChild;
	}
}

function emup(x, qe) {
	if (parseInt(x.clientHeight) > 20) {
		goUp(x);
	}
	else {
		if (x.firstChild && x.firstChild.nextSibling && x.firstChild.nextSibling.firstChild &&
			x.firstChild.nextSibling.firstChild.firstChild &&
			x.firstChild.nextSibling.firstChild.firstChild.firstChild &&
			x.firstChild.nextSibling.firstChild.firstChild.firstChild.firstChild &&
			x.firstChild.nextSibling.firstChild.firstChild.firstChild.firstChild.firstChild &&
			x.firstChild.nextSibling.firstChild.firstChild.firstChild.firstChild.firstChild.style ) {
		x.firstChild.nextSibling.firstChild.firstChild.firstChild.firstChild.firstChild.style.height = 20 + 'px';
		x.firstChild.nextSibling.firstChild.firstChild.firstChild.firstChild.firstChild.style.fontWeight = 'normal';
		x.firstChild.nextSibling.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.style.fontWeight = 'normal';
		}
		if (x.firstChild && x.firstChild.nextSibling && x.firstChild.nextSibling.firstChild &&
			x.firstChild.nextSibling.firstChild.firstChild &&
			x.firstChild.nextSibling.firstChild.firstChild.firstChild &&
			x.firstChild.nextSibling.firstChild.firstChild.firstChild.nextSibling &&
			x.firstChild.nextSibling.firstChild.firstChild.firstChild.nextSibling.firstChild &&
			x.firstChild.nextSibling.firstChild.firstChild.firstChild.nextSibling.firstChild.firstChild &&
			x.firstChild.nextSibling.firstChild.firstChild.firstChild.nextSibling.firstChild.firstChild.style ) {
		 x.firstChild.nextSibling.firstChild.firstChild.firstChild.nextSibling.firstChild.firstChild.style.height = 20 + 'px';
		 x.firstChild.nextSibling.firstChild.firstChild.firstChild.nextSibling.firstChild.firstChild.firstChild.style.fontWeight='normal';
		 //x.firstChild.nextSibling.firstChild.firstChild.firstChild.nextSibling.firstChild.firstChild.style.fontWeight = 'normal';
		}
		clearInterval(qe);
	}
}

function emdown(x, abc) {
	yeah = x;
	if (parseInt(x.clientHeight) < height+20) {
		goDown(x);
	}
	
	if (parseInt(x.style.height) < height+20) {
		abc = window.setTimeout("emdown(yeah)", 20);
	}
	else
		window.clearTimeout(abc);
}

function emdown2(x, yo) {
	yeah3 = x;
	kul = yo;
	if (parseInt(x.clientHeight) < height2+20)
		goDown(x);
	
	if (parseInt(x.style.height) < height2+20)
		yo = window.setTimeout("emdown2(yeah3, kul)", 20);
	else {
		var d = x;
		var divs = new Array(1);
		var tc;
		for (xx=0; d.id.substr(0, 3) != "div"; d = d.parentNode) {
			tc = d;
			if (d.nodeName == 'DIV') {
				divs[xx] = d;
				xx++;
			}
		}

		if (divs.length > 2) {
			
			h = parseInt(divs[0].clientHeight) - 40 + parseInt(divs[1].clientHeight);
			if (parseInt(divs[2].clientHeight) < h ) {
				bblah(divs[1]);
			}
			else {
				x.firstChild.style.fontWeight = 'normal';
				aa = divs[0];
				att = window.setInterval("tanker(aa, att)", 20);
			}
		}
		else {
			blah(tc);
		}
		window.clearTimeout(yo);
	}
	return true;
}

function childUp(eee, tt) {
	if (eee.clientHeight > 15)
		eee.style.height = eee.clientHeight - 5 + "px";
	else
		window.clearInterval(tt);
}

function tanker(pp, qq) {

	var divs = new Array(1);
	d = pp;
	if (d!=null) {
		for (xx=0; d.id.substr(0, 3) != "div"; d = d.parentNode) 
		{
			tc = d;
			if (d.nodeName == 'DIV') {
				divs[xx] = d;
				xx++;
			}
		}
		if (pp.clientHeight > 15) {
			divs[0].style.height = divs[0].clientHeight - 5 + "px";
			divs[2].style.height = divs[2].clientHeight - 5 + "px";
			divs[3].parentNode.style.height = divs[3].parentNode.clientHeight - 5 + "px";
		}
		else
			window.clearTimeout(qq);
	}
	else
		window.clearTimeout(qq);
}

function goDown(x) {
		x.style.height = x.clientHeight + 5 + "px";
}
 
function goUp(x) {
		x.style.height = x.clientHeight - 5 + "px";
} 

