// <![CDATA[
 
 
/* ------------------------------------------ *
 * slide()
/* ------------------------------------------ */
 
var timer = null;
 
slide = function(objID) {
	var obj = document.getElementById(objID);
	obj.style.overflow = 'hidden';
	
	/* ------------------------------------------ *
	 * up()
	/* ------------------------------------------ */
 
	this.up = function(obj,ori,speed) {
		var present = getElementSize(obj).oh;
		var moveValue = speed + 3;
		
		present = present-moveValue;
	
		if(present > 0) {
			obj.style.height = present + 'px';
			timer = window.setTimeout(function(){ this.up(obj,ori,speed) }, 10);
		}
	
		else {
			obj.style.height = ori + 'px';
			obj.style.display = 'none';
			timer = null;
		};
	}
	
	
	/* ------------------------------------------ *
	 * down()
	/* ------------------------------------------ */
	
	this.down = function(obj,limit,slow) {
		var present = getElementSize(obj).oh;
		var distance = limit-present;
		var moveValue = Math.max(Math.floor(distance / slow),slow);
	
		if(present < limit) {
			obj.style.height = (present+moveValue) + 'px';
			timer = setTimeout(function(){ this.down(obj,limit,slow) }, 10);
		}
		
		else {
			obj.style.height = limit + 'px';
			timer = null;
		};
	}
 
 
	/* ------------------------------------------ *
	 * start
	/* ------------------------------------------ */
 
	var o = getElementSize(obj);
	var slow = 3;
	var speed = 30;
	
	if(obj.offsetHeight == 0) {
		obj.style.display = 'block';
		obj.style.height = 0;
 
		if(timer == null) this.down(obj,o.oh,slow);
	}
	
	else {
		if(timer == null) this.up(obj,o.oh,speed);
	}
	
}
 
 
/* ------------------------------------------ *
 * getElementSize()
/* ------------------------------------------ */
 
getElementSize = function(elm) {
	var oSize = new Object();
	var elm2 = elm.cloneNode(true);
 
	if(-1 == navigator.userAgent.indexOf('MSIE 5')){
		elm2.style.padding = '0';
		elm2.style.border = '0';
	}
	elm2.style.display = 'block';
	elm2.style.position = 'absolute';
 
	elm.parentNode.appendChild(elm2);
	oSize.oh = elm2.clientHeight;
	oSize.ow = elm2.clientWidth;
	elm.parentNode.removeChild(elm2);
	
	return oSize;
}
 
 
/* ------------------------------------------ *
 * getElementsByClass()
/* ------------------------------------------ */
 
getElementsByClass = function(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}
 
/* ------------------------------------------ *
 * onload()
/* ------------------------------------------ */
 
function setPosition() {
	var target = getElementsByClass('slidemenu',document,'a');
	for(i=0; i<target.length; i++) 
	{
		target[i].onclick = function(){ slide('samplemenu') };
	}
};
setPosition();
 
// ]]>