/* Start HB_height script 

Author: A.H. Borger
Email: borger@glovi-network.com
It's not allowed to copy or use this script without permission from the author.
Copyright protected.
*/
var i = new Array;
var y = true;
var s = 2;
var oldHeightP = new Array;
var oldHeight = new Array;
var ready = true;
var tlo = new Array;

function HB_height (setId, hSetMin, setSpeed, design) {
	if (ready === true){
		HB_set_height(setId, hSetMin, setSpeed, design)}
}

function HB_set_height (setId, hSetMin, setSpeed, design) {
	ready = false;
	d = document; p = parseInt; t = setTimeout; u = undefined; 
	if(u!==setId){id = setId;}
	if(u!==hSetMin){hMin = p(hSetMin);}
	if(u!==setSpeed){s = p(setSpeed);}
	if(u === oldHeight[id]){
		oldHeight[id] = d.getElementById(id).clientHeight;
		
		if (u !== oldHeightP[id]){oldHeight[id] = oldHeightP[id];}
		if (hMin > oldHeight[id]){
			tlo[id] = oldHeight[id];
			oldHeight[id] = hMin;
			hMin = tlo[id];

		}
	}
	var cor = 0;
	padding = d.getElementById(id).style.padding.split("px");
	paddingTop = d.getElementById(id).style.paddingTop.split("px");
	paddingBottom = d.getElementById(id).style.paddingBottom.split("px");
	if ('' !== paddingTop[0] || '' !== paddingBottom[0]) {cor = p(paddingTop[0]) + p(paddingBottom[0]);}
	if ('' !== padding[0]){cor = padding[0] * 2;}
	if (u !== tlo[id]){hMin = tlo[id] - cor;}
	hMax = oldHeight[id] - cor;
	if (u !== tlo[id] && u === i[id]){d.getElementById(id).style.height = (hMin) + "px";}
	else if (u === i[id]){d.getElementById(id).style.height = (hMax) + "px";}
	tl = d.getElementById(id).style.height.split("px");
	i[id] = p(tl[0]);
	if (i[id] >= hMax){y = true;}
	if (i[id] <= hMin){y = false;}	
			
	if (y==false){
		if (hMax - i[id] < s*s){s -= 1;}
		if (oldHeight[id] - i[id] < s){s = oldHeight[id] - i[id];}
		i[id] +=s;
		d.getElementById(id).style.height = (i[id]) + "px";
		if(u!==design){
				d.getElementById(design).innerHTML = "-";}
		if (i[id] < hMax){
			t('HB_set_height()',10) ;		
		} else {ready = true;}
	}
	if ( y==true){
		if (i[id] - hMin < s*s){s -= 1;}
		if (i[id] - hMin < s){s = i[id] - hMin;}
		i[id] -=s;
		d.getElementById(id).style.height = (i[id]) + "px";
		if(u!==design){
				d.getElementById(design).innerHTML = "+";}
		if (i[id] > hMin){
			t('HB_set_height()',10) ;
		}else {	ready = true;}
	}	
}
/* End HB_height script */

