I want a tool bar on my website. I have some buttons starting on the bottom-left corner of the window but I wanted to fill the rest of the space. I realised I can't do this with CSS so I'm trying Javascript. What I have so far is:

Code:
function update_grey(){
	//Puts grey at end of toolbar
	fim_width = document.getElementById("fim").offsetWidth;
	document.getElementById("fim_grey_fill").style.width = pageWidth() - fim_width + 'px';
}
window.onresize = update_grey;
The function is also called on the page load. It resizes a grey image for the remaining toolbar according to the window width and the width of the other part of the toolbar.

It doesn't work. It displays screwed up. It usually starts too wide and then does random things when the window is resized. If I'm lucky I may get it to land perfectly as I resize the window.

This should work. I see no reason why it doesn't. It's screwed up in Firefox and Safari. Can anyone help?

I kept it on my blog so people can see - http://crytekuk.info/forums/viewtopic.php?f=5&p=92#p92 It shouldn't hurt the visitors experience much I hope. Hopefully it will be fixed soon.

Thank you.