
var CurrentSlide= new Array();

// run this function with 1 param: object id
function SlideBox(oObj,Direction,UseOpacity,Step,Height)
{
    if (!oObj) return false;
    if (typeof(oObj)!='object') oObj=document.getElementById(oObj);
    if (!Direction  && !Step && CurrentSlide.toString().indexOf(oObj.id)!=-1) return false;
    if (CurrentSlide.toString().indexOf(oObj.id)==-1) CurrentSlide.push(oObj.id);
    if (!Step) Step=parseInt(oObj.scrollHeight/7);
    if (Step<5&&Step!=0) Step=5;

    if (!Direction) {
        Direction=(oObj.style.display=='none')?'open':'close';
        Height = (Direction=='open')?1:oObj.offsetHeight;
        oObj.style.overflow='hidden';
        oObj.style.display='';
    }
    var GoalValue=(Direction=='open')?oObj.scrollHeight:0
    if (!Height) Height=(oObj.offsetHeight)?oObj.offsetHeight:0;

    if (UseOpacity) {
        var Opacity = ((oObj.offsetHeight/100)*Height)/1000;
        if (Opacity==1 || (Direction=='open' && Step>=(GoalValue-Height) )) Opacity=0.999;
        if (window.ActiveXObject) oObj.style.filter = "alpha(opacity=" + Opacity*100 + ")";
    	else oObj.style.opacity = Opacity;
	}
	
    if ( (Direction=='close' && Height<=Step) || (Direction=='open' && Step>=(GoalValue-Height)) ) {
        oObj.style.overflow='visible';
        oObj.style.display=(Direction=='close')?'none':'';
        oObj.style.height=(Direction=='close')?0:GoalValue;
        for (j=0;j<CurrentSlide.length;j++) {if (CurrentSlide[j]==oObj.id) CurrentSlide[j]=null;}
        return true;
    }
    Height=(Direction=='open')?Height+Step:Height-Step;

    oObj.style.height=(Height<0)?0:Height;
    window.setTimeout("SlideBox(document.getElementById('"+oObj.id+"'), '"+Direction+"', "+UseOpacity+" ,"+Step+", "+Height+")",1);
}
