// JavaScript Document

/*
attach function like so:
<a href="javascript:Effect.slider(elementID)" ></a>

Also give element these style elements
#blockElem{display:none; height:0px; overflow:hidden;}
*/

var oHeight = 0;
var Effect = {
    // public method. Attach slider to referenced element.
    slider : function(str) {
    oElem = document.getElementById(str);

    if(oElem.style.display == 'block') {
	    oHeight= oElem.clientHeight;
        new Effect._slideUp(oElem,oHeight);
    } else {
        oElem.style.display = "block";
        oElem.style.height = "1px";
        new Effect._slideDown(oElem,oElem.scrollHeight);
    }
},
    // private method. Slide (transition) Element open/closed
_slideDown : function(oElem,maxHeight){
    oHeight= oElem.clientHeight;
    oElem.style.height = Math.min(Math.floor(oHeight*2),maxHeight)+"px";
    if(oHeight < maxHeight){
        window.setTimeout('Effect._slideDown(oElem,'+maxHeight+')',10);
    }
},
_slideUp : function(oElem,lastHeight){
	newHeight= Math.floor(lastHeight/2);
    oElem.style.height=newHeight+"px";
    if(newHeight > 0){
        window.setTimeout('Effect._slideUp(oElem,'+newHeight+')',10);
    }else{
        oElem.style.display = "none";
    }
}

}
