
var cm=null;
var mstep=6;
var hide_delay=800;
var tstat=0;

function getelementbyid(myid) {
	objElement = document.getElementById(myid);
	return(objElement);
}

function switchDiv(objElement,bolVisible){
	if(!bolVisible){
		objElement.style.display = "none";
	} else {
		objElement.style.display = "";
	}
}

function getPos(el,sProp) {
	var iPos = 0;
	while (el!=null) {
		iPos+=el["offset" + sProp]
		el = el.offsetParent
	}
	return iPos
}

function movefx() {
	if ((mstatus) && (fxrect>fxm.offsetHeight)) {
		fxrect=fxm.offsetHeight;
		return 1;
	}
	
	if ((!mstatus) && (fxrect<0)) {
		fxrect=0;
		switchDiv(fxm,false);
		mstatus=true;
		cm=null;
		return 1;
	}
	
	fxm.style.left = getPos(fxel,"Left")+2+"px";
	fxm.style.clip='rect('+(fxm.offsetHeight-fxrect)+' '+(fxm.offsetWidth+fxrect*3)+' '+(fxm.offsetHeight+fxrect)+' '+(fxm.offsetWidth-500)+')';
	fxm.style.top = (getPos(fxel,"Top")+fxel.offsetHeight-fxm.offsetHeight+fxrect)+1+"px";

	if (mstatus) {
		fxrect=fxrect+mstep;
		setTimeout('movefx()',1);
	} else {
		fxrect=fxrect-mstep;
		setTimeout('movefx()',1);
	}

	return 1;
}

function show(el,m) {

	if (m!=null) {
		m=getelementbyid(m);
	}
	
	if ((el==null) && (cm)) {
		
		mstatus=false;
		movefx()
	
	} else if ((m!=cm) && (cm)) {

		switchDiv(cm,false)
	
	}
	
	if ((m)&&(cm!=m)) {

		switchDiv(m,true);
		fxel=el;
		fxm=m;
		fxrect=0;
		mstatus=true;
		movefx()
		
	}

	if (m) cm=m;
	
	if (tstat==1) {
		clearTimeout(timer1);
		tstat=0
	}

}

function hidemenu(b) {
	if (b) {
    	tstat=1;
    	timer1=setTimeout("show(null)",hide_delay);
    } else {
    	tstat=0;
    	show(null);
    }
}

function cancelhide() {

	if (!mstatus) {
		mstatus=1;
	}
	tstat=0;
	clearTimeout(timer1);
}

function doMouseOver(el) {
	el.originalClass = el.className;
	el.className += "MOver";
	return(false);
}

function doMouseOut(el) {
	el.className = el.originalClass;
	return(false);
}