var nsresizeload = false;

function initToolBar(maxwidth, barheight, hcentered){
	//alert('initToolBar');
/********************************
*
* The main function of this 
* is to get the absolute left of
* a centered page. Re-init the starting
* x and y elements of the toolbar.
*
* Top of Toolbar = 71
* Left is Varied depending on 
* var absoluteleft
*
*
* 6 April 2004. Mariano Tanenglian Jr
*********************************/
	var leftcssp;


	//1) Netscape Layers Having Problems with margin-left

		if(document.layers){
			if (window.innerWidth <= 770) {
				if (document.layers['toolbar']){document.layers['toolbar'].left = 0;}
				if (document.layers['bodybar']){document.layers['bodybar'].left = 0;}
					nsresizeload = true;
			} else {
				if (!nsresizeload){
					if(document.layers['toolbar']){document.layers['toolbar'].left -= 385;}
					if(document.layers['bodybar']){document.layers['bodybar'].left -= 385;}				
					nsresizeload = true;
				} else {
					if(document.layers['toolbar']){document.layers['toolbar'].left = (window.innerWidth - 770)/2;}
					if(document.layers['bodybar']){document.layers['bodybar'].left = (window.innerWidth - 770)/2;}
				}//end condition
			}//end if condition
		
		/**} else if (document.getElementById){
			if ((document.body.clientWidth <= 770)){
				if(document.getElementsByTagName('span')['toolbar']){document.getElementsByTagName('span')['toolbar'].style.left = 0;}
				if(document.getElementsByTagName('span')['toolbar']){document.getElementsByTagName('span')['toolbar'].style.marginLeft = 0;}
				if(document.getElementsByTagName('div')['bodybar']){document.getElementsByTagName('div')['bodybar'].style.left = 0;}
				if(document.getElementsByTagName('div')['bodybar']){document.getElementsByTagName('div')['bodybar'].style.marginLeft = 0;}
			} else {
				if(document.getElementsByTagName('span')['toolbar']){document.getElementsByTagName('span')['toolbar'].style.left = "50%";}
				if(document.getElementsByTagName('span')['toolbar']){document.getElementsByTagName('span')['toolbar'].style.marginLeft = -385;}
				if(document.getElementsByTagName('div')['bodybar']){document.getElementsByTagName('div')['bodybar'].style.left = "50%";}
				if(document.getElementsByTagName('div')['bodybar']){document.getElementsByTagName('div')['bodybar'].style.marginLeft = -385;}
			}//end if condition
		} else if (document.all){
			if ((document.body.clientWidth <= 770)){
				if(document.all.tags('span')['toolbar']){document.all.tags('span')['toolbar'].style.left = 0;}
				if(document.all.tags('span')['toolbar']){document.all.tags('span')['toolbar'].style.marginLeft = 0;}
				if(document.all.tags('div')['bodybar']){document.all.tags('div')['bodybar'].style.left = 0;}
				if(document.all.tags('div')['bodybar']){document.all.tags('div')['bodybar'].style.marginLeft = 0;}
			} else {
				if(document.all.tags('span')['toolbar']){document.all.tags('span')['toolbar'].style.left = "50%";}
				if(document.all.tags('span')['toolbar']){document.all.tags('span')['toolbar'].style.marginLeft = -385;}
				if(document.all.tags('div')['bodybar']){document.all.tags('div')['bodybar'].style.left = "50%";}
				if(document.all.tags('div')['bodybar']){document.all.tags('div')['bodybar'].style.marginLeft = -385;}
			}//end if condition	
		**/
		}//
	
	/**********
		if (self.innerHeight) // all except Explorer
		{
			x = self.innerWidth;
			y = self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientHeight)
			// Explorer 6 Strict Mode
		{
			x = document.documentElement.clientWidth;
			y = document.documentElement.clientHeight;
		}
		else if (document.body) // other Explorers
		{
			x = document.body.clientWidth;
			y = document.body.clientHeight;
		}
	************/
	//4) After we have reset the toolbar, we want to call the MenuMgr's start() function.
	//alert('start now');
	var xleft = 0;
	if(hcentered){
		//alert("table is centered");
		if (self.innerHeight) // all except Explorer
		{
			xleft = (self.innerWidth - maxwidth);
			//alert("Mozilla " + xleft);
		}
		else if (document.documentElement && document.documentElement.clientHeight)
			// Explorer 6 Strict Mode
		{
			xleft = (document.documentElement.clientWidth - maxwidth);
			//alert("IE Strict" + xleft);
		}
		else if (document.body) // other Explorers
		{
			xleft = (document.body.clientWidth - maxwidth);
			//alert("IE " + xleft);
		}//fin
		if(xleft <=0){
			xleft = 0;
		} else {
			xleft = parseInt(xleft/2); 
		}//
	}//
	start(barheight, xleft);
}//end function initToolBar()
