
//---------------------------------------------------------------------------------
var navpanewidth;//='136px';
var titlepaneheight;//='50px';

//document.style.body.textAlign='center';
//------------------------------------------------------------------------------
function build_MasterTable (bgcolor,homepicsrc) {
	var bordercolor='#666666';
//    var home=document.getElementById('home');
//    home.src=homepicsrc;
//    var homepic=new Image();
//    homepic.src=homepicsrc;
    navpanewidth=120;//homepic.width;
    titlepaneheight=0;//homepic.height;

var draw=1;
if(draw) {
	var mastertable= document.createElement("table");
	mastertable.border=0;
	mastertable.cellPadding=0;
	mastertable.cellSpacing=0;
	mastertable.width='770px';
	//	mastertable.width='100%';
	mastertable.height='100%';
	mastertable.style.border='solid 1px #666666';
	mastertable.id='mtable';
	var mthead = document.createElement("thead");
	var mthr=document.createElement("tr");	
	var mthd = document.createElement("td")
	mthd.colSpan=2;
	var trw=document.getElementById('headers_container')
	mthd.appendChild(trw);
	mthr.appendChild(mthd);
	mthead.appendChild(mthr);
	var mtbody = document.createElement("tbody");
	for ( var yy=0;yy<2;yy++) {			
		var mtr = document.createElement("tr");
		
		for ( var xx=0;xx<2;xx++) {
			var mtd = document.createElement("td")
				mtd.id='mtable'+'x'+xx+'y'+yy;
if(yy==0) {
			mtd.style.height=titlepaneheight;
			mtd.style.backgroundColor=bgcolor;
			mtd.style.borderBottom='solid 1px '+bordercolor;
}
if(xx==0) {
			mtd.style.width=navpanewidth+'px';
			}
		
			mtd.style.border && (mtd.style.border='solid grey 0px');
			//mtd.color='black';
			mtd.vAlign='top';
			mtd.align='left';
			//mtd.bgColor='grey';
			//var t=document.createTextNode('X'+xx+'Y'+yy);
			if(xx==1 && yy==1){
			mtd.style.padding='10px';
			var mcp=document.getElementById('maincontent');
			mtd.appendChild(mcp);
			}
			if(xx==0 && yy==0){
			var hmp=document.getElementById('homepane')
			hmp.style.display='';
			hmp.style.borderRight='solid 1px '+bordercolor;

			mtd.appendChild(hmp);
			}
			if(xx==0 && yy==1){
			mtd.style.backgroundColor=bgcolor;
			mtd.style.borderRight='solid 1px '+bordercolor;
			var np=document.getElementById('navpane');
			np.style.display='';
			np.style.backgroundColor=bgcolor;
			mtd.appendChild(np);
			}
			if(xx==1 && yy==0){
			var tp=document.getElementById('titlepane');
			tp.style.display='';
			mtd.style.paddingLeft='10px';
			mtd.appendChild(tp);
			}
			mtr.appendChild(mtd); 		       			
		} // loop over columns
		mtbody.appendChild(mtr);
	} // loop over rows
	mastertable.appendChild(mthead);
	mastertable.appendChild(mtbody);

	p=document.getElementsByTagName('body')[0];
	p.appendChild(mastertable);
} else {
			var hmp=document.getElementById('homepane')
			hmp.style.display='';
//			hmp.style.borderRight='solid 1px '+bordercolor;
			var tp=document.getElementById('titlepane');
			tp.style.display='';
			var np=document.getElementById('navpane');
			var mc=document.getElementById('maincontent');
			np.style.backgroundColor=bgcolor;
			hmp.style.backgroundColor=bgcolor;
			var bd=document.getElementByName('body');

//			var wheight=window.innerHeight || document.documentElement.clientHeight;
//mc.style.height='auto';
//alert(bd.style.height);
//np.style.height=mc.style.height;
}
} // End of build_MasterTable

//--------------------------------------------------------------------------------
function active_link() {
    var links=document.getElementsByTagName('a');
    for(var i=0;i<links.length;i++){
	if(links[i].id.substr(0,1)=='l'){
	    //alert(links[i].firstChild.nodeValue);
	    //alert(links[i].href+'<=>'+document.location);
	    if(links[i].href==document.location){
		//This is the active link
		//alert(links[i].parentNode.firstChild.nodeName);
		var linkcontent=links[i].firstChild;
		var parent=links[i].parentNode;
		//alert(parent.nodeName);
		//alert(links[i].firstChild.nodeName);
		parent.removeChild(links[i]);
		parent.appendChild(linkcontent);

	    }
	}
    }

}
//--------------------------------------------------------------------------------
function move_title () {
    var h1=document.getElementsByTagName('h1')[0];
    var titleh1=document.getElementById('bannerright');
    var h1c=h1.cloneNode(1);
if(h1 && titleh1) {
    titleh1.appendChild(h1c);
}
}
//--------------------------------------------------------------------------------
function move_homepane () {

    var homepane=document.getElementById('homepane');
    var banner=document.getElementById('bannerleft');
if(homepane && banner) {
    banner.appendChild(homepane);
}

}

//--------------------------------------------------------------------------------
function show_icons() {

    var iconcells=document.getElementsByTagName('td');
    for(var i=0;i<iconcells.length;i++){
    for(var j=0;j<arguments.length;j++){
	if(iconcells[i].id==arguments[j]){

//		alert(iconcells[i].id+';'+iconcells[i].style.display);
		iconcells[i].style.display='';
	    }
	}
    }

}
//--------------------------------------------------------------------------------
function show_links() {

    var linkcells=document.getElementsByTagName('li');
    for(var i=0;i<linkcells.length;i++){
    for(var j=0;j<arguments.length;j++){
	if(linkcells[i].id==arguments[j]){

//		alert(linkcells[i].id+';'+linkcells[i].style.display);
		linkcells[i].style.display='';
	    }
	}
    }

}
//--------------------------------------------------------------------------------
function hide_links() {

    var linkcells=document.getElementsByTagName('li');
    for(var i=0;i<linkcells.length;i++){
    for(var j=0;j<arguments.length;j++){
	if(linkcells[i].id==arguments[j]){

//		alert(linkcells[i].id+';'+linkcells[i].style.display);
		linkcells[i].style.display='none';
	    }
	}
    }

}
//==============================================================================
function resize_table(w) {
	var tables= document.getElementsByTagName('table');
var mastertable=tables[0];
	mastertable.border=0;
	mastertable.cellPadding=0;
	mastertable.cellSpacing=0;
	mastertable.width=w;//+'px'; //must include unit

}
//==============================================================================
function move_toprow() {

}

