// Javascript functions for TimeToWeb Content Management System
// including support for Mozilla ans NS7
// Mozilla seems to be quite finished, othe DOM-Browsers like Opera are not very well supported do far
//
// last modified: 2002/12/19 MGO: fixed initSitelocator() for DOM browsers
// initial: 2002/11/05 MGO

function forwardToPage() {
	if(forwardflag==1) { 
		location.replace(forwardurl); 
	}
}
forwardToPage();

function BrowserCheck() {
	if (window.defaultStatus) { window.defaultStatus = "";}
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.version = navigator.appVersion
	this.useragent = navigator.userAgent
	this.v = parseInt(this.version)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns3 = (this.b=="ns" && this.v>=3)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.ns6 = (this.b=="ns" && (navigator.userAgent.indexOf('Netscape6')>0))
	this.ns7 = (this.b=="ns" && ((navigator.userAgent.indexOf('Netscape7')>0)||(navigator.userAgent.indexOf('Netscape/7')>0)))
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (this.version.indexOf('MSIE 4')>0)
	this.ie5 = (this.version.indexOf('MSIE 5')>0)
	this.ie6 = (this.version.indexOf('MSIE 6')>0) // not tested yet
	this.moz = ((navigator.appName == "Netscape") && (navigator.appVersion.substring(0,1) >= "5"))
	this.opera = ((navigator.appName == "Opera") || (navigator.userAgent.indexOf("Opera")>0))
	this.opera6 = (	(this.opera) && ( (navigator.appVersion.substring(0,1) >= "6") || (navigator.userAgent.indexOf("Opera 6")>0) ) )
	this.DOMsupport = (this.moz || this.opera)
	this.min = (this.ns||this.ie)
	// overriding the Opera "feature" of pretending to be another browser
	if (this.opera) {
/*		if ( this.ie || this.ns || this.ns3 || this.moz ) {
			msg = "even if you pretend to be another browser, we know that you are using Opera.";
			window.defaultStatus = msg;
		} */
		this.ns = false;
		this.ns4 = false;
		this.ns5 = false;
		this.ie = false;
		this.ie4 = false;
		this.ie5 = false;
		this.moz = false;
	}
}

// function display_BrowserInfo()
// displays information about the current Browser, generated from BrowserCheck()
// author: MGO
// purpose: debug
// last modified: 2002/11/07
// introduced: 2002/11/07
function display_BrowserInfo() {
	dbg = new BrowserCheck();
	alert (	
		"Browser: " + dbg.b + "\n" + 
		"Version: " + dbg.version + "\n" + 
		"UserAgent: " + dbg.useragent + "\n" + 
		"ns: " + dbg.ns + "\n" + 
		"ns4: " + dbg.ns4 + "\n" + 
		"ns5: " + dbg.ns5 + "\n" + 
		"ns6: " + dbg.ns6 + "\n" + 
		"ns7: " + dbg.ns7 + "\n" + 
		"ie: " + dbg.ie + "\n" + 
		"ie4: " + dbg.ie4 + "\n" + 
		"ie5: " + dbg.ie5 + "\n" + 
		"ie6: " + dbg.ie6 + "\n" + 
		"moz: " + dbg.moz + "\n" + 
		"opera: " + dbg.opera + "\n" + 
		"opera6: " + dbg.opera6 + "\n" + 
		"min: " + dbg.min + "\n" );
}
// global variable, used for identifying the current browser
is = new BrowserCheck();


function newWindow(url,width,height,addparam) {
	w = (width=="")?800:width;
	h = (height=="")?600:height; 
	param = (addparam=="")?"scrollbars=auto,resizable=yes":addparam;
	window.open(url,  "", "width="+w+",height="+h+","+param);
}

function NewWindowOPM(z)
{
 window.open(z,  "", "width=400,height=200,scrollbars=no,resizable=no");
}

function NewWindow(z)
{
 window.open(z,  "", "width=400,height=400,scrollbars=auto,resizable=yes");

}

function NewWindow2(z)
{
 window.open(z,  "", "width=500,height=700,scrollbars=yes,resizable=yes");

}

function NewWindow3(z)
{
 window.open(z,  "", "width=640,height=400,scrollbars=yes,resizable=yes");

}

function NewWindow4(z)
{
 window.open(z,  "", "width=400,height=600,scrollbars=no,resizable=yes");

}

function switchImg(imgobj,imgsrc) {
	imgobj.src=imgsrc;
}

function switchImgObj(imgobj,newobj) {
	imgobj.src = newobj.src;
}


var imgobj = new Array;
var imgmo = new Array;
var sitelocatorpos = 0;
var ypos =0 ;
function initLeftNavigation() {
	// get all layers and pictures
	var argv = initLeftNavigation.arguments;
	j = 0;
	pcol = new Array;
	pcol[0]="#ffffff";
	for(i=0;i<argv.length;i+=5) {
		layername = argv[i];
		h = parseInt(argv[i+1]);
		imgmo[j] = new Image;
		imgmo[j].src = argv[i+2]
		linecolor = argv[i+3];
		level = parseInt(argv[i+4]);
		if (i+5+4<argv.length) {
			nextlevel = parseInt(argv[i+9]);
			if (nextlevel > level) {
				pcol[level] = linecolor;
			} else {
				if (nextlevel < level) {
					linecolor = pcol[nextlevel];
				}
			}
		} else {
			if(pcol.length>0) {
				linecolor = pcol[0];
			}
		}
	
		if (layername.match(/text/)) {
			layernametext = layername;
			layernamecontrol = layername.replace(/text/,"ctrl");
			layernameactive = "";
			layernameline =  layername.replace(/text/,"dline");
			imagename = layername.replace(/text/,"img");
		} else {
			layernametext = "";
			layernamecontrol = layername.replace(/active/,"ctrl");
			layernameactive = layername;
			layernameline =  layername.replace(/active/,"dline");
			imagename = layername.replace(/active/,"img");
		}

		if (is.ns4) {
			if (layernametext != "") {
				imgobj[j] = document.layers["LeftNavigation"].document.layers[layernametext].document.images[imagename];
				document.layers["LeftNavigation"].document.layers[layernametext].top = ypos;
				document.layers["LeftNavigation"].document.layers[layernamecontrol].top = ypos;
				document.layers["LeftNavigation"].document.layers[layernameline].top = ypos+h;
				document.layers["LeftNavigation"].document.layers[layernameline].bgColor = linecolor;
			} else {
				imgobj[j] = null;
				document.layers["LeftNavigation"].document.layers[layernameactive].top=ypos;
				document.layers["LeftNavigation"].document.layers[layernamecontrol].top = ypos;
				document.layers["LeftNavigation"].document.layers[layernameline].top = ypos+h;
				document.layers["LeftNavigation"].document.layers[layernameline].bgColor = linecolor;
			}
		}
		if ( is.ie || is.ie4 || is.ie5 || is.ie6 ) {
			if (layernametext != "") {
				imgobj[j] = document.images[imagename];
				document.all[layernametext].style.top=ypos;
				document.all[layernamecontrol].style.top=ypos;
				document.all[layernameline].style.top=ypos+h;
				document.all[layernameline].style.backgroundColor = linecolor;
			} else {
				imgobj[j] = null;
				document.all[layernameactive].style.top=ypos;
				document.all[layernamecontrol].style.top=ypos;
				document.all[layernameline].style.top=ypos+h;
				document.all[layernameline].style.backgroundColor = linecolor;
			}			
		}
		if (is.moz || is.opera) {
			if (layernametext != "") {
				imgobj[j] = document.images[imagename];
				document.getElementById(layernametext).style.top=ypos;
				document.getElementById(layernamecontrol).style.top=ypos;
				document.getElementById(layernameline).style.top=ypos+h;
				document.getElementById(layernameline).style.backgroundColor = linecolor;
			} else {
				imgobj[j] = null;
				document.getElementById(layernameactive).style.top=ypos;
				document.getElementById(layernamecontrol).style.top=ypos;
				document.getElementById(layernameline).style.top=ypos+h;
				document.getElementById(layernameline).style.backgroundColor = linecolor;
			}			
		}
		j ++;
		ypos += h +1;
		sitelocatorpos=ypos;
	} // end for(i=0;i<argv.length;i+=2)
	

} // end function initLeftNavigation

function initLeftNavigationLayer() {
	if (is.ns4) {
		document.layers["LeftNavigation"].height=ypos+1;
	}
	if (is.ie || is.ie4 || is.ie5 || is.ie6) {
//		alert ("IE - LN: " + ypos+1);
		document.all["LeftNavigation"].style.height=ypos+1;
		document.all["LeftNavigation"].style.visibility="visible";
	}
	if (is.moz || is.opera || is.opera6 ) {
//		alert ("Mozilla - LN:  " + ypos+1);
		document.getElementById("LeftNavigation").style.height=ypos+1;
	}
}

function initSiteLocator() {
	if (is.ns4) {
		document.layers["LeftNavigation"].document.layers["sl"].top = sitelocatorpos+1;
		document.layers["LeftNavigation"].document.layers["sl"].visibility="show";
	}
	if (is.ie || is.ie4 || is.ie5 || is.ie6 ) {
		document.all["sl"].style.top=sitelocatorpos+1;
		document.all["sl"].style.visibility="visible";
	}
	if (is.moz || is.opera || is.opera6) {
//		alert ("Mozilla - sl: " + ypos+1);
		document.getElementById("sl").style.top=sitelocatorpos+1;
		document.getElementById("sl").style.visibility = "visible";
	}
}

function mark(no) {
	imgobj[no].src = imgmo[no].src;
}

function norm(no) {
	imgobj[no].src = "/icons/ecblank.gif";
}

function prozwin_ohneToolbar(ieXPos, ieYPos, ieWidth, ieHeight, nProzent, sFileName){
  sName="Dummy"
  if (is.ns) {
//- FUNKTIONIERT FÜR NS:
    winWidth = (nProzent*window.innerWidth)/ 100; 
    winHeight = (nProzent*window.innerHeight)/ 100;
    test=window.open(sFileName, sName, "width="+winWidth+",height="+winHeight+",locationbar=yes,menubar=yes,status=yes,dependent=yes,hotkeys=yes");
// relative Position:
    test.screenX=screenX+parent.innerWidth/2-winWidth/2;
    test.screenY=screenY+parent.innerHeight/2+winHeight/4-winHeight/2;
    test.focus();
   }
  else if (is.ie) {
    if (ieWidth==0) {
      winWidth=(nProzent/100)*screen.availWidth
    }
    else {
      winWidth=ieWidth
    }
    if (ieHeight==0) {
      winHeight=(nProzent/100)*screen.availHeight
    }
    else {
      winHeight=ieHeight
    }
    test=window.open(sFileName, sName, "width="+winWidth+",height="+winHeight+",locationbar=yes,menubar=yes,status=yes");
//    window.moveTo(ieXPos,ieYPos);
//    test.focus();
   }
}

function prozwin(ieXPos, ieYPos, ieWidth, ieHeight, nProzent, sFileName){
  sName="Dummy"
  if (is.ns) {
//- FUNKTIONIERT FÜR NS:
    winWidth = (nProzent*window.parent.window.innerWidth)/ 100; 
    winHeight = (nProzent*window.parent.window.innerHeight)/ 100;
//  funktioniert nur optimal, wenn das Fenster zweimal definiert wird..
    test=window.open(sFileName, sName, "width="+winWidth+",height="+winHeight+",locationbar=no,menubar=yes,status=yes");
    test=window.open(sFileName, sName, "width="+winWidth+",height="+winHeight+",toolbar=yes,location=no,locationbar=no,menubar=yes,status=yes,scrollbars=yes,personalbar=no,resizable=yes,dependent=yes,hotkeys=yes");
// relative Position:
    test.screenX=screenX+parent.innerWidth/2-winWidth/2;
    test.screenY=screenY+parent.innerHeight/2+winHeight/4-winHeight/2;
    test.focus();
   }
  else if (is.ie) {
    if (ieWidth==0) {
      winWidth=(nProzent/100)*screen.availWidth
    }
    else {
      winWidth=ieWidth
    }
    if (ieHeight==0) {
      winHeight=(nProzent/100)*screen.availHeight
    }
    else {
      winHeight=ieHeight
    }
//  funktioniert nur optimal, wenn das Fenster nur einmal definiert wird..
    test=window.open(sFileName, sName, "width="+winWidth+",height="+winHeight+",toolbar=yes,location=no,locationbar=no,menubar=yes,status=yes,scrollbars=yes,personalbar=no,resizable=yes,dependent=yes,hotkeys=yes");
//    window.moveTo(ieXPos,ieYPos);
//    test.focus();
   }
}
function processPullDown(menuname,active) {
	var layerid = "pulldown"  + menuname;
	if (active==1) {
		if (is.ns4) {
			if (document.layers[layerid]){
				document.layers[layerid].visibility="show";
			}
		}
		if (is.ie) {
			if (document.all[layerid]) {
				document.all[layerid].style.visibility="visible";
			}
		}
		if ( is.moz || is.opera || is.opera6 ) {
			if (document.getElementById(layerid)) {
				document.getElementById(layerid).style.visibility="visible";
			}
		}
	}
	if (active==0) {
		if (is.ns4) {
			if (document.layers[layerid]){
				document.layers[layerid].visibility="hide";
			}
		}
		if (is.ie) {
			if (document.all[layerid]) {
				document.all[layerid].style.visibility="hidden";	
			}
		}
		if ( is.moz || is.opera || is.opera6 ) {
			if (document.getElementById(layerid)) {
				document.getElementById(layerid).style.visibility="hidden";
			}
		}
	}
}

function processPullDownSub(p1,p2,p3) {
	if (is.ns4) {
	 	obj = document.layers["pulldown"+p1].document.layers["inner"+p2];
	 	if (obj) {
			if (p3==1) {
				obj.bgColor=pdHC[p1];
			} else {
				obj.bgColor=null;
			}
		}
	}
	if (is.ie) {
	 	obj = document.all["inner"+p2];
	 	if (obj) {
			if (p3==1) {
				obj.bgColor = pdHC[p1];
			} else {
				obj.bgColor = pdNC[p1];
			}
		}
	}
	if ( is.moz || is.opera || is.opera6 ) {
		window.status="Mozilla";
		obj = document.getElementById("inner"+p2);
		if (obj) {
			if (p3==1) {
				obj.bgColor = pdHC[p1];
			} else {
				obj.bgColor = pdNC[p1];
			}
		}
	}
}

function processPullDownSubImg(p1,p2) {
	if (p1) {
		if (p2==null) {
			p1.src = "/icons/ecblank.gif";
		} else {
			p1.src = p2.src;
		}
	}
}

function processPullDownSelect(layerno,innerlayerno,active,imgsrc,imgdest) {
	if (effect & 1 == 1) {
		processPullDownSub(layerno,innerlayerno,active);
	}
	if (effect & 2 == 2) {
		processPullDownSubImg(imgsrc,imgdest);
	}
}

function printWindow(adr) {
	var param='width=630,height=500,scrollbars=yes,resizable=yes,locationbar=no,menubar=yes,screenX=50,screenY=50';
	var title = "";
	adr = adr.replace(/#/,"%23");	
	window.open(adr,title,param);

}
var effekt = 1;
function writeLayerDefinition(PDNo,FrameColor,BGColor,LineColor,AllRows) {
	
	var rowvalue = AllRows.split(",");

	if (is.ns4) {
		document.write("<layer name='pulldown"+PDNo+"' pageX='0' pageY='88' visibility='hidden'");
		document.write(" onMouseOver=processPullDown('"+PDNo+"',1)");
		document.write(" onMouseOut=processPullDown('"+PDNo+"',0) width=1 z-index=99>");
	}
	if (is.ie || is.moz || is.opera ||is.opera6) {
		document.write("<div id='pulldown"+PDNo+"' style='position:absolute;top:88;left:0;visibility:hidden;z-index:99;width:1'");
		document.write(" onMouseOver=this.style.visibility='visible';");
		document.write(" onMouseOut=this.style.visibility='hidden';>");
	}
	if (is.ns || is.ie || is.moz || is.opera || is.opera6) {
		document.write("<img src='/icons/ecblank.gif' height=1 width=1 border=0><br>");
		document.write("<table cellpadding=1 cellspacing=0 border=0 bgcolor="+FrameColor+"><tr><td>");
		document.write("<table cellpadding=0 cellspacing=0 border=0 bgcolor='"+BGColor+"'>");
	}
	var l = rowvalue.length-1;
	for(i=0; i<l;i+=4) {
		pdentryno = rowvalue[i];
		pdref = rowvalue[i+1];
		pdtarget = rowvalue[i+2];
		pdtext = rowvalue[i+3];

		if (is.ns4) {
			if (effect==1) {
				document.write("<tr><td nowrap align=left><table cellpadding=0 cellspacing=0 border=0><tr>");
				document.write("<td><img src='/icons/ecblank.gif' height=18 width=1 border=0></td>");
				document.write("<td><a href='"+pdref+"' target='"+pdtarget+"'");
				document.write(" onMouseOver=processPullDownSubImg(PullDownImg"+pdentryno+",PullDownMOImage"+PDNo+")");
				document.write(" onMouseOut=processPullDownSubImg(PullDownImg"+pdentryno+",null)>");
				document.write("<img name ='PullDownImg"+pdentryno+"' src='/icons/ecblank.gif' height=18 width=18 border=0></a></td>");
				document.write("<td><a href='"+pdref+"' target='"+pdtarget+"' class='NAVPullDownLink"+PDNo+"'");
				document.write(" onMouseOver=processPullDownSubImg(PullDownImg"+pdentryno+",PullDownMOImage"+PDNo+")");
				document.write(" onMouseOut=processPullDownSubImg(PullDownImg"+pdentryno+",null)>"+pdtext+"</a></td>");
				document.write("<td><a href='"+pdref+"' target='"+pdtarget+"'");	
				document.write(" onMouseOver=processPullDownSubImg(PullDownImg"+pdentryno+",PullDownMOImage"+PDNo+")");
				document.write(" onMouseOut=processPullDownSubImg(PullDownImg"+pdentryno+",null)>");
				document.write("<img src='/icons/ecblank.gif' height=18 width=18 border=0></a></td></tr></table></td></tr>");
			}
			if (effect==2) {
				document.write("<tr><td nowrap align=left>");
				document.write("<ilayer name='inner"+pdentryno+"' width=100%>");
				document.write("<a href='"+pdref+"' target='"+pdtarget+"' class='NAVPullDownLink"+PDNo+"'");
				document.write(" onMouseOver=processPullDownSub('"+PDNo+"','"+pdentryno+"',1)");
				document.write(" onMouseOut=processPullDownSub('"+PDNo+"','"+pdentryno+"',0)>");
				document.write("<img src='/icons/ecblank.gif' height=18 width=18 border=0>");
				document.write(""+pdtext+"");
				document.write("<img src='/icons/ecblank.gif' height=18 width=18 border=0></a>");
				document.write("</ilayer>");
				document.write("</td></tr>");
			}

			if (i+4 < l) {
				document.write("<tr><td>");
				document.write("<table cellpadding=0 cellspacing=0 border=0 width=100%>");
				document.write("<tr><td bgcolor='"+LineColor+"'><img src='/icons/ecblank.gif' height=1 width=1 border=0></td></tr>");
				document.write("</table>");
				document.writeln("</td></tr>");
			}
		}
	
		if (is.ie || is.moz || is.opera || is.opera6 ) {
			if (effect==1) {
				document.write("<tr><td nowrap align=left id=\'inner"+pdentryno+"\'>");
				document.write("<table cellpadding=0 cellspacing=0 border=0>");
				document.write("<tr><td><img src='/icons/ecblank.gif' height=18 width=1 border=0></a></td>");
				document.write("<td><a href='"+pdref+"' target='"+pdtarget+"'");
				document.write(" onMouseOver=processPullDownSubImg(PullDownImg"+pdentryno+",PullDownMOImage"+PDNo+")");
				document.write(" onMouseOut=processPullDownSubImg(PullDownImg"+pdentryno+",null)>");
				document.write("<img name ='PullDownImg"+pdentryno+"' src='/icons/ecblank.gif' height=18 width=18 border=0></td>");
				document.write("<td nowrap align=left><a href='"+pdref+"' target='"+pdtarget+"' class='NAVPullDownLink"+PDNo+"'");
				document.write(" onMouseOver=processPullDownSubImg(PullDownImg"+pdentryno+",PullDownMOImage"+PDNo+")");
				document.write(" onMouseOut=processPullDownSubImg(PullDownImg"+pdentryno+",null)>"+pdtext+"</a></td>");
				document.write("<td><a href='"+pdref+"' target='"+pdtarget+"'");
				document.write(" onMouseOver=processPullDownSubImg(PullDownImg"+pdentryno+",PullDownMOImage"+PDNo+")");
				document.write(" onMouseOut=processPullDownSubImg(PullDownImg"+pdentryno+",null)>");
				document.write("<img src='/icons/ecblank.gif' height=18 width=18 border=0></a></td></tr></table></td></tr>");
			}
			if (effect==2) {
				document.write("<tr><td nowrap align=left id=\'inner"+pdentryno+"\'>");
				document.write("<table cellpadding=0 cellspacing=0 border=0>");
				document.write("<td><a href='"+pdref+"' target='"+pdtarget+"'");
				document.write(" onMouseOver=processPullDownSub('"+PDNo+"','"+pdentryno+"',1)");
				document.write(" onMouseOut=processPullDownSub('"+PDNo+"','"+pdentryno+"',0)>");
				document.write("<img name ='PullDownImg"+pdentryno+"' src='/icons/ecblank.gif' height=18 width=18 border=0></td>");
				document.write("<td nowrap align=left><a href='"+pdref+"' target='"+pdtarget+"' class='NAVPullDownLink"+PDNo+"'");
				document.write(" onMouseOver=processPullDownSub('"+PDNo+"','"+pdentryno+"',1)");
				document.write(" onMouseOut=processPullDownSub('"+PDNo+"','"+pdentryno+"',0)>"+pdtext+"</a></td>");
				document.write("<td><a href='"+pdref+"' target='"+pdtarget+"'");
				document.write(" onMouseOver=processPullDownSub('"+PDNo+"','"+pdentryno+"',1)");
				document.write(" onMouseOut=processPullDownSub('"+PDNo+"','"+pdentryno+"',0)>");
				document.write("<img src='/icons/ecblank.gif' height=18 width=18 border=0></a></td></tr></table></td></tr>");
			}
			

			if (i+4 < l) {
				document.write("<tr><td>");
				document.write("<table cellpadding=0 cellspacing=0 border=0 width=100%>");
				document.write("<tr><td bgcolor='"+LineColor+"'><img src='/icons/ecblank.gif' height=1 width=1 border=0></td></tr>");
				document.write("</table>");
				document.writeln("</td></tr>");
			}
		}
	
	}

	if (is.ns4) {	
		document.write("</table>");
		document.write("</td></tr></table>");
		document.writeln("</layer>");
	}
	if (is.ie || is.moz || is.opera || is.opera6) {
		document.write("</table>");
		document.write("</td></tr></table>");
		document.writeln("</div>")
	}
}

function getMax(v1,v2) {
	if (v1>v2) {
		return v1;
	} else {
		return v2;
	}
}

objheader = null;
objfooter = null;
objleftnav = null;
objlefttext = null;
objcontent = null;
objonecol = null;
objleftcol = null;
objrightcol = null;

function getLayerObjects() {
	if (is.moz || is.opera || is.opera6 ) {
		objheader = document.getElementById("Header");
		objfooter = document.getElementById("Footer");
		objleftnav = document.getElementById("LeftNavigation");
		objcontent = document.getElementById("Content");
		if (document.getElementById("ContentLeftColumn")) { objleftcol = document.getElementById("ContentLeftColumn"); }
		if (document.getElementById("RightColumn")) { objrightcol = document.getElementById("RightColumn");}
		if (document.getElementById("ContentWide")) { objonecol = document.getElementById("ContentWide");}
		if (document.getElementById("ContentWideNOKV")) { objonecol = document.getElementById("ContentWideNOKV");}	
		if (document.getElementById("LeftNavigationText")) { objlefttext = document.getElementById("LeftNavigationText");}	
	}
	if (is.ie) {
		objheader = document.all["Header"];
		objfooter = document.all["Footer"];
		objleftnav = document.all["LeftNavigation"];
		objcontent = document.all["Content"];
		if (document.all["ContentLeftColumn"]) { objleftcol = document.all["ContentLeftColumn"]; }
		if (document.all["RightColumn"]) { objrightcol = document.all["RightColumn"];}
		if (document.all["ContentWide"]) { objonecol = document.all["ContentWide"];}
		if (document.all["ContentWideNOKV"]) { objonecol = document.all["ContentWideNOKV"];}	
		if (document.all["LeftNavigationText"]) { objlefttext = document.all["LeftNavigationText"];}	
	}
	if (is.ns4) {
		objheader = document.layers["Header"];
		objfooter = document.layers["Footer"];
		objleftnav = document.layers["LeftNavigation"];
		objcontent = document.layers["Content"];
		if (objcontent.document.layers["ContentLeftColumn"]) { objleftcol = objcontent.document.layers["ContentLeftColumn"];}
		if (objcontent.document.layers["RightColumn"]) { objrightcol = objcontent.document.layers["RightColumn"];}
		if (objcontent.document.layers["ContentWide"]) { objonecol = objcontent.document.layers["ContentWide"];}
		if (objcontent.document.layers["ContentWideNOKV"]) {objonecol = objcontent.document.layers["ContentWideNOKV"];}
		if (document.layers["LeftNavigationText"]) { objlefttext = document.layers["LeftNavigationText"];}			
	}
}

winheight = 0;
winwidth = 0;
headerleft = 0;
headerwidth = 0;
headerheight = 0;
leftnavtop = 0;
leftnavheight = 0;
lefttexttop = 0;
lefttextheight = 0;
contenttop = 0;
contentheight = 0;
onecoltop = 0;
onecolheight =0;
leftcoltop = 0;
leftcolheight = 0;
rightcoltop = 0;
rightcolheight = 0;
footertop = 0;
footerleft = 0;
footerheight = 0;
footerwidth = 0;
colheight = 0;
bodyheight = 0;
bottompos = 0;

function getLayerValues(footerpos) {
	if(is.ie) {
		winheight = document.body.offsetHeight-4;
		winwidth = document.body.offsetWidth-4-16;
		if (objheader) {
			headerleft = objheader.offsetLeft;
			headerwidth = objheader.offsetWidth;
			headerheight = objheader.offsetHeight;
		}
		if (objleftnav) {
			leftnavtop = objleftnav.offsetTop;
			leftnavheight = objleftnav.offsetHeight;
		}
		if (objlefttext) {
			lefttextop = objlefttext.offsetTop;
			lefttextheight = objlefttext.offsetHeight;
		}

		if (objcontent != null) {
			contenttop = objcontent.offsetTop;
			contentheight = objcontent.offsetHeight;
		}
		if (objonecol != null) { 
			onecoltop = objonecol.offsetTop; 
			onecolheight = objonecol.offsetHeight;
		}
		if (objleftcol != null) {
			leftcoltop = objleftcol.offsetTop;
			leftcolheight = objleftcol.offsetHeight;
		}
		if (objrightcol != null) {
			rightcoltop = objrightcol.offsetTop;
			rightcolheight = objrightcol.offsetHeight;
		}
		if (objfooter != null) {
			footerheight = objfooter.offsetHeight;
			footerleft = objfooter.offsetLeft;
		}
	}
	if (is.ns4) {
		winheight = window.innerHeight;
		winwidth = window.innerWidth;
		if (objheader) {
			headerleft = objheader.left;
			headerwidth = objheader.clip.width;
			headerheight = objheader.clip.height;
		}
		if (objleftnav) {
			leftnavtop = objleftnav.top;
			leftnavheight = objleftnav.clip.height;
		}
		if (objlefttext) {
			lefttexttop = objlefttext.top;
			lefttextheight = objlefttext.clip.height;
		}

		if (objcontent != null) {
			contenttop = objcontent.top;
			contentheight = objcontent.clip.height;
		}
		if (objonecol != null) { 
			onecoltop = objonecol.top;
			onecolheight = objonecol.clip.height;
		}
		if (objleftcol != null) {
			leftcoltop = objleftcol.top;
			leftcolheight = objleftcol.clip.height;
		}
		if (objrightcol != null) {
			rightcoltop = objrightcol.top;
			rightcolheight = objrightcol.clip.height;
		}
		if (objfooter != null) {
			footerheight = objfooter.clip.height;
			footerleft = objfooter.left;
		}
	}
	if(is.moz || is.opera || is.opera6) {
		winheight = document.body.clientHeight;
		winwidth = document.body.clientWidth;
		if (is.ns6 || ((!winheight) && (!winwidth))) {
			winheight = window.innerHeight;
			winwidth = window.innerWidth;
		}
		if (objheader) {
			headerleft = objheader.offsetLeft;
			headerwidth = objheader.offsetWidth;
			headerheight = objheader.offsetHeight;
		}
		if (objleftnav) {
			leftnavtop = objleftnav.offsetTop;
			leftnavheight = objleftnav.offsetHeight;
		}
		if (objlefttext) {
			lefttexttop = objlefttext.offsetTop;
			lefttextheight = objlefttext.offsetHeight;
		}

		if (objcontent != null) {
			contenttop = objcontent.offsetTop;
			contentheight = objcontent.offsetHeight;
		}
		if (objonecol != null) { 
			onecoltop = objonecol.offsetTop; 
			onecolheight = objonecol.offsetHeight;
		}
		if (objleftcol != null) {
			leftcoltop = objleftcol.offsetTop;
			leftcolheight = objleftcol.offsetHeight;
		}
		if (objrightcol != null) {
			rightcoltop = objrightcol.offsetTop;
			rightcolheight = objrightcol.offsetHeight;
		}
		if (objfooter != null) {
			footerheight = objfooter.offsetHeight;
			footerleft = objfooter.offsetLeft;
		}
	}
	if (footerpos == "none") {
		footerheight = 0;
		footerleft = 0;
		footermargin = 0;
	}
	if (onecolheight != 0) {
		colheight = onecoltop+onecolheight;
	}
	if (leftcolheight != 0) {
		colheight = getMax(leftcoltop+leftcolheight,rightcoltop+rightcolheight);		
	}
	bodyheight = getMax(contentheight,colheight);
	if (footerpos=="beside") {
		bottompos = getMax(leftnavtop + leftnavheight + lefttextheight - footermargin - footerheight,contenttop + bodyheight);
	} else {
		bottompos = getMax(leftnavtop + leftnavheight + lefttextheight,contenttop + bodyheight);
	}
	footertop = getMax(winheight - footerheight,bottompos+footermargin);
	if (footerpos=="beside") {
		lefttexttop = footertop + footerheight - lefttextheight;
	} else {
		lefttexttop = footertop - lefttextheight;
	}
}

function setLayerValues(footerpos,fw,hw) {
	contentheight = footertop - footermargin - contenttop;
	onecolheight = contentheight - onecoltop;
	leftcolheight = contentheight - leftcoltop;
	rightcolheight = contentheight - rightcoltop;
	if (footerpos == "beside") {
		leftnavheight = footertop + footerheight - leftnavtop;
	} else {
		leftnavheight = footertop - leftnavtop;
	}
	if (hw == "max") {
		headerwidth = winwidth - headerleft;
	}
	if (fw == "max") {
		footerwidth = winwidth - footerleft;
	}
}

function setLayerObjects(footerpos,hw,fw) {
	if (is.ie || is.moz || is.opera || is.opera6) {
		if (objheader != null) { 	
			if (hw=="max") {
				objheader.style.width = headerwidth;
			}
			objheader.style.visibility  = "visible";							
		}
		if (objleftnav != null) { 
			objleftnav.style.height = leftnavheight;
			objleftnav.style.visibility  = "visible";
		}
		if (objlefttext != null) {
			objlefttext.style.top = lefttexttop;
			objlefttext.style.visibility  = "visible";
		}
		if (objcontent != null) { 
			objcontent.style.height = contentheight;
			objcontent.style.visibility  = "visible";
		}
		if (objonecol != null) {
			objonecol.style.height = onecolheight;
			objonecol.style.visibility  = "visible";
		}
		if (objleftcol != null) { 
			objleftcol.style.height = leftcolheight;
			objleftcol.style.visibility  = "visible";
		}
		if (objrightcol != null) { 
			objrightcol.style.height = rightcolheight;
			objrightcol.style.visibility  = "visible";
		}
		if (objfooter != null && footerpos!="none") { 
			objfooter.style.top = footertop;
			if (fw=="max") {
				objfooter.style.width = footerwidth;
			}
			if (footerpos!="none") {
				objfooter.style.visibility  = "visible";
			}
		}
	}
	if (is.ns4) {
		if (objheader != null) { 	
			if (hw=="max") {
				objheader.width = headerwidth;
				objheader.clip.width = headerwidth;
			}
			objheader.visibility  = "show";			
		}
		if (objleftnav != null) { 
			objleftnav.height = leftnavheight;
			objleftnav.clip.height = leftnavheight;
			objleftnav.visibility  = "show";
		}
		if (objlefttext != null) {
			objlefttext.moveToAbsolute(objlefttext.left,lefttexttop);
			objlefttext.visibility  = "show";
		}
		if (objcontent != null) { 
			objcontent.height = contentheight;
			objcontent.clip.height = contentheight;
			objcontent.visibility  = "show";
		}
		if (objonecol != null) {
			objonecol.height = onecolheight;
			objonecol.clip.height = onecolheight;			
			objonecol.visibility  = "show";
		}
		if (objleftcol != null) { 
			objleftcol.height = leftcolheight;
			objleftcol.clip.height = leftcolheight;			
			objleftcol.visibility  = "show";
		}
		if (objrightcol != null) { 
			objrightcol.height = rightcolheight;
			objrightcol.clip.height = rightcolheight;			
			objrightcol.visibility  = "show";
		}
		if (objfooter != null && footerpos!="none") { 
			objfooter.moveToAbsolute(objfooter.left,footertop);
			if (fw=="max") {
				objfooter.width = footerwidth;
				objfooter.clip.width = footerwidth;
			}
			objfooter.visibility  = "show";
		}
	}
}

function displayValues() {
	alert("winheight = "+winheight + "\n" + 
"winwidth = "+ winwidth  + "\n" +
"headerleft = "+headerleft + "\n" +
"headerwidth = " + headerwidth + "\n" +
"headerheight = " + headerheight + "\n" +
"leftnavtop = " + leftnavtop + "\n" +
"leftnavheight = " + leftnavheight + "\n" +
"lefttexttop = " + lefttexttop + "\n" +
"contenttop = " + contenttop + "\n" +
"contentheight = " + contentheight + "\n" +
"onecoltop = " + onecoltop + "\n" +
"onecolheight = " + onecolheight + "\n" +
"leftcoltop = " + leftcoltop + "\n" +
"leftcolheight = " + leftcolheight + "\n" +
"rightcoltop = " + rightcoltop + "\n" +
"rightcolheight = " + rightcolheight + "\n" +
"footermargin = " + footermargin + "\n" +
"footertop = " + footertop + "\n" +
"footerleft = " + footerleft + "\n" +
"footerheight = " + footerheight + "\n" +
"footerwidth = " + footerwidth + "\n" +
"colheight = " + colheight + "\n" +
"bodyheight = " + bodyheight + "\n" +
"bottompos = " + bottompos);
}
	
function setLayerElements(footerpos,hw,fw) {
	getLayerObjects();
	getLayerValues(footerpos);
	// displayValues();
	setLayerValues(footerpos,hw,fw);
	// displayValues();	
	setLayerObjects(footerpos,hw,fw);
}

/* ********************************************************************************** */

var saveInnerWidth=0;
var saveInnerHeight=0;
if(!saveInnerWidth) {
	if(is.ns4 || is.opera) {
		window.onresize = resizeIt;
		saveInnerWidth = window.innerWidth;
		saveInnerHeight = window.innerHeight;
	} 
}
function resizeIt() {
    if (saveInnerWidth != window.innerWidth || saveInnerHeight != window.innerHeight )  {
        window.history.go(0);
    }
}

/* ********************************************************************************** */

function initPullDown() {
    n=0;
    for(i=0;i<arrdocnumbers.length;i++) {
        layername = "pulldown"+arrdocnumbers[i];
        if (is.ns4) {
            obj = document.layers[layername];
            if (obj) {
                m = arrleft[n++];
                obj.pageX = leftpos + m;
                obj.pageY = toppos;
            }
        }
        if (is.ie) {
            obj = document.all[layername];
            if (obj) {
                m = arrleft[n++];
                obj.style.left = leftpos + m;
                obj.style.top = toppos;
            }
        }
        if (is.moz || is.opera || is.opera6) {
            obj = document.getElementById(layername);
            if (obj) {
                m = arrleft[n++];
                obj.style.left = leftpos + m;
                obj.style.top = toppos;
            }
        }
        leftpos += arrxsize[i]+1;
    }
}

/* ********************************************************************************** */
