function moveStuff(){
	xHide('header');
	xHide('menu');
	xHide('leftBit');
	xHide('main');
	xWidth('header',750)
	xMoveTo('header',xClientWidth()/2-xWidth('header')/2,0);
	xWidth('menu',xWidth('header'));
	xMoveTo('menu',xClientWidth()/2-xWidth('header')/2,xHeight('header'));
	xZIndex('menu',999);
	xWidth('leftBit',140);
	if(xHeight('leftBit')<xHeight('main')){
		xHeight('leftBit',xHeight('main')+xHeight('header')+xHeight('menu'));
	}
	xMoveTo('leftBit',xLeft('header'),xHeight('header')+xHeight('menu'));
	xZIndex('leftBit',9);
	xWidth('main',xWidth('header')-xWidth('leftBit')-10);
	xMoveTo('main',xLeft('leftBit')+xWidth('leftBit')+10,xHeight('header')+xHeight('menu')+20);
	xShow('header');
	xShow('menu');
	xShow('leftBit');
	xShow('main');	
}
function doScroll(){
	xHeight('leftBit',xClientHeight()-xHeight('header')-xHeight('menu'));
	if(xScrollTop()>xHeight('header')){
		xSlideTo('menu',xLeft('header'),xScrollTop(),700);
	}else{
		xSlideTo('menu',xLeft('header'),xHeight('header'),700);
	}
}	
function doResize(){
	moveStuff();
	doScroll();
}
window.onload = function setup(){
	moveStuff();
	xAddEventListener(window,'resize',doResize,false);
	xAddEventListener(window,'scroll',doScroll,false);
}
function googleSearch(){
	showwin("http://www.google.co.uk/search?q=" + document.forms[0].elements[0].value);
}
function doSearch(){
	location = 'search.php?"'+document.forms[0].elements[0].value+'"';
}
function showwin(myURL){
	if (myURL != '#') {
    newwin = window.open(myURL, 'newwin', 'top=10,left=10,width=435,height=500,scrollbars=yes, resizable=yes');
    newwin.focus();
  }
}

