stopH = new Array();
stopW = new Array();
nHeight = 0;
nWidth = 0;

function resetH(id,H,speed) {
	stopH[id] = 2;
	runH(id,H,speed);
}

function resizeH(id,H,speed) {
	if (stopH[id]) {
		stopH[id] = 1;
		setTimeout("resetH('"+id+"',"+H+","+speed+");", 25);
	} else {
		resetH(id,H,speed);
	}
}


function resetW(id,W,speed) {
	stopW[id] = 2;
	runW(id,W,speed);
}

function resizeW(id,W,speed) {
	if (stopW[id]) {
		stopW[id] = 1;
		setTimeout("resetW('"+id+"',"+W+","+speed+");", 25);
	} else {
		resetW(id,W,speed);
	}
}
function runH(id,H,speed) {
	if (stopH[id]==2) {
		H = parseFloat(H);
		speed = parseFloat(speed);
		x = document.getElementById(id);
		cHeight = parseFloat(x.style.height);
		if (cHeight!=H) {
			if (cHeight<H) {
				if ((H-cHeight)<speed) {
					nHeight = cHeight+1;
				} else {
					nHeight = cHeight+((H-cHeight)/speed);
				}
				if (nHeight>H-1) {
					nHeight = H;
				}
			}
			if (cHeight>H) {
				if ((H-cHeight)>speed*-1) {
					nHeight = cHeight-1;
				} else {
					nHeight = cHeight+((H-cHeight)/speed);
				}
				if (nHeight<H+1) {
					nHeight = H;
				}
			}
			if (nHeight!=0) {
				x.style.height = nHeight+"px";
				setTimeout("runH('"+id+"',"+H+","+speed+")", 25);
			}
		} else {
			stopH[id]==1;
		}
	}
}

function runW(id,W,speed) {
	if (stopW[id]==2) {
		W = parseFloat(W);
		speed = parseFloat(speed);
		x = document.getElementById(id);
		cWidth = parseFloat(x.style.width);
		if (cWidth!=W) {
			if (cWidth<W) {
				if ((W-cWidth)<speed) {
					nWidth = cWidth+1;
				} else {
					nWidth = cWidth+((W-cWidth)/speed);
				}
				if (nWidth>W-1) {
					nWidth = W;
				}
			}
			if (cWidth>W) {
				if ((W-cWidth)>speed*-1) {
					nWidth = cWidth-1;
				} else {
					nWidth = cWidth+((W-cWidth)/speed);
				}
				if (nWidth<W+1) {
					nWidth = W;
				}
			}
			if (nWidth!=0) {
				x.style.width = nWidth+"px";
				setTimeout("runW('"+id+"',"+W+","+speed+")", 25);
			}

		}
	}
}