Resizing Swf with Javascript not working

Can someone help me out here. I am able to resize my swf with Javascript, but I cannot get the intervals to work correctly. When the menu is not dropped down the height of the swf should be 40 pixels. As you can see that is working, but if you pop up two menus it will run the resize function and cut off the second menu. Here is an example of what I am talking about.

I only have the 1st, 3rd and 4th menus working right now.

http://staffweb.maconstate.edu/nchapman/resize/

I’m only going to post the actionscript. The javascript seems to be working fine. It is something with my intervals. Sorry for the bloated code. I have been screwing around with this so long that I just want to get it working:P

flash file if needed.

http://staffweb.maconstate.edu/nchapman/resize/test.fla


stop();
getURL("javascript:newSize(778, 40)");
//Import the classes for Tweening.
import mx.transitions.Tween;
import mx.transitions.easing.*;

//Variables to tell if the menus are down or up.
_global.down = false;
_global.down3 = false;
_global.down4 = false;

_global.big = false;

function menuopen(but, drop, end) {
	clearInterval(_global.uptest);
	getURL("javascript:newSize(778, 300)");
	var butin:Tween  = new  Tween(but, "_alpha", Strong.easeOut, 0, 12, .5, true);
	var butopen:Tween  = new  Tween(drop, "_y", Strong.easeOut, -219, end, .3, true);
	
};

function shorter() {
	getURL("javascript:newSize(778, 40)");
	clearInterval(_global.uptest);
}

function menuclose() {
	var butin:Tween  = new  Tween(b1, "_alpha", Strong.easeOut, 12, 0, .5, true);
	var butclose:Tween  = new  Tween(d1, "_y", Strong.easeOut, 0, -225, .3, true);
	clearInterval(_global.b1int);
	_global.down = false;
	butclose.onMotionFinished = function() {
		if(_global.big == false){
		_global.uptest = setInterval(_root.shorter, 200);
		_global.big = true;
		}else{
			_global.uptest = setInterval(_root.shorter, 40);
			_global.big = false;
		}
	};
};

function menuclose3() {
	var butin3:Tween  = new  Tween(b3, "_alpha", Strong.easeOut, 12, 0, .5, true);
	var butclose3:Tween  = new  Tween(d3, "_y", Strong.easeOut, -65, -225, .3, true);
	clearInterval(_global.b3int);
	_global.down3 = false;
	butclose3.onMotionFinished = function() {
		if(_global.big == false){
		_global.uptest = setInterval(_root.shorter, 200);
		_global.big = true;
		}else{
			_global.uptest = setInterval(_root.shorter, 40);
			_global.big = false;
		}
	};
};

function menuclose4() {
	var butin4:Tween  = new  Tween(b4, "_alpha", Strong.easeOut, 12, 0, .5, true);
	var butclose4:Tween  = new  Tween(d4, "_y", Strong.easeOut, -55, -225, .3, true);
	clearInterval(_global.b4int);
	_global.down4 = false;
	butclose4.onMotionFinished = function() {
		if(_global.big == false){
		_global.uptest = setInterval(_root.shorter, 200);
		_global.big = true;
		}else{
			_global.uptest = setInterval(_root.shorter, 40);
			_global.big = false;
		}
	};
};

//dropdown 1 start
b1.onRollOver = function() {
	if(_global.b1int != null){ clearInterval(_global.b1int); }
	if(_global.down == false) {
		_root.d1.swapDepths(_global.front);
		menuopen(this, d1, 0); 
		_global.down = true;
		_global.front = d1;
	}
	
};
	
b1.onRollOut = function() {
	_global.b1int = setInterval(menuclose, _global.intTime);
};

b1.onReleaseOutside = function() {
	_global.b1int = setInterval(menuclose, _global.intTime);
};

d1.d1stop.onRollOver = function() {
	clearInterval(_global.b1int);
};

d1.d1stop.onRollOut = function() {
	_global.b1int = setInterval(_root.menuclose, _global.intTime);
};
		
d1.d1stop.onReleaseOutside = function() {
	_global.b1int = setInterval(_root.menuclose, _global.intTime);
};

//dropdown 3 start
b3.onRollOver = function() {
	if(_global.b3int != null){ clearInterval(_global.b3int); }
	if(_global.down3 == false) { 
		_root.d3.swapDepths(_global.front);
		menuopen(this, d3, -75); 
		_global.down3 = true;
		_global.front = d3;
	}
	
};
	
b3.onRollOut = function() {
	_global.b3int = setInterval(menuclose3, _global.intTime);
};

b3.onReleaseOutside = function() {
	_global.b3int = setInterval(menuclose3, _global.intTime);
};

d3.d3stop.onRollOver = function() {
	clearInterval(_global.b3int);
};

d3.d3stop.onRollOut = function() {
	_global.b3int = setInterval(_root.menuclose3, _global.intTime);
};
		
d3.d3stop.onReleaseOutside = function() {
	_global.b3int = setInterval(_root.menuclose3, _global.intTime);
};

var z:Number = 1;

//dropdown 4 start
b4.onRollOver = function() {
	clearInterval(_global.b4int);
	if(_global.down4 == false) { 
		_root.d4.swapDepths(_global.front);
		menuopen(this, d4, -55); 
		_global.down4 = true;
		_global.front = d4;
	}
};
	
b4.onRollOut = function() {
	_global.b4int = setInterval(menuclose4, _global.intTime);
};

b4.onReleaseOutside = function() {
	_global.b4int = setInterval(menuclose4, _global.intTime);
};

d4.d4stop.onRollOver = function() {
	clearInterval(_global.b4int);
};

d4.d4stop.onRollOut = function() {
	_global.b4int = setInterval(_root.menuclose4, _global.intTime);
};
		
d3.d4stop.onReleaseOutside = function() {
	_global.b4int = setInterval(_root.menuclose4, _global.intTime);
};