	var prop_x = 1, prop_y = 2, prop_height = 3, prop_width = 4, prop_clip_bottom = 5, prop_vis = 6, prop_bgcolor = 7, prop_content = 8, prop_border = 9, prop_fontweight=10, prop_display=11;
	var useragent = navigator.userAgent;
	var browser = (useragent.indexOf('Mozilla') > -1) ? 'Mozilla' : (useragent.indexOf('Opera') > -1) ? 'Opera' : navigator.appName;
	var ns = browser == 'Netscape';
	var useelementbyid = (typeof(document.getElementById) != 'undefined');
	var lastobj;
	var lasthelpobject;

	var threads = new Array(5);
	var wantedadrypos = 0;
	var wantedxpos = 0;
	var newwindow = '';

	function openUpload( pageToLoad, winName, width, height, center, fieldname)
	{
		uploadfield=AllDivs(fieldname);
		openAWindow(pageToLoad, winName, width, height, center);
	}
	function openAWindow( pageToLoad, winName, width, height, center) 
	{
	    xposition=0; yposition=0;
	    if ((parseInt(navigator.appVersion) >= 4 ) && (center))
	    {
	        xposition = (screen.width - width) / 2;
	        yposition = (screen.height - height) / 2;
	    }
	    args = "width=" + width + "," 
	    + "height=" + height + "," 
	    + "location=0," 
	    + "menubar=0,"
	    + "resizable=1,"
	    + "scrollbars=1,"
	    + "status=0," 
	    + "titlebar=0,"
	    + "toolbar=0,"
	    + "hotkeys=0,"
	    + "screenx=" + xposition + ","  //NN Only
	    + "screeny=" + yposition + ","  //NN Only
	    + "left=" + xposition + ","     //IE Only
	    + "top=" + yposition;           //IE Only

	    newwindow = window.open( pageToLoad,winName,args );
	    if (window.focus) {newwindow.focus()}
	}
	
	function objinfo() {
		
		obj = AllDivs('txpropinfo');
		setprop(obj,prop_x,event.clientX + document.body.scrollLeft + 20);
		setprop(obj,prop_y,event.clientY + document.body.scrollTop + 20);
		if (event.srcElement!=lastobj && event.srcElement != obj) {
						setprop(obj,prop_content,'<table><tr><td class="propinfo" colspan="2"><b><u>trex objectinfo:</u></b></td></tr>' +
												   '<tr><td class="propinfo">Tagname:</td><td class="propinfo">' + window.event.srcElement.tagName + '</td></tr>' + 
												   '<tr><td class="propinfo">id/name:</td><td class="propinfo">' + event.srcElement.id + '/' + event.srcElement.name + '</td></tr>' + 
												   '<tr><td class="propinfo">class:</td><td class="propinfo">' + event.srcElement.className + '</td></tr>' + 
												   '<tr><td class="propinfo">src:</td><td class="propinfo">' + event.srcElement.src + '</td></tr>' + 
												   '<tr><td class="propinfo" colspan="2"><b><u>Parent:</b></u></td></tr>' + 
												   '<tr><td class="propinfo">Tagname:</td><td class="propinfo">' + window.event.srcElement.parentElement.tagName + '</td></tr>' + 
												   '<tr><td class="propinfo">id/name:</td><td class="propinfo">' + event.srcElement.parentElement.id + '/' + event.srcElement.parentElement.name + '</td></tr>' + 
												   '<tr><td class="propinfo">class:</td><td class="propinfo">' + event.srcElement.parentElement.className + '</td></tr>' + 
												   '<tr><td class="propinfo">src:</td><td class="propinfo">' + event.srcElement.parentElement.src + '</td></tr>' + 
												   '</table>');
						setprop(lastobj,prop_border,'');
						lastobj = event.srcElement;
						setprop(lastobj,prop_border,'1px solid black');
		}
		
	}

	function GetNSObj(doc,id) {
		if(id!="")
		{
			if ((newObj = eval('doc.' + id)) != null) return newObj;
			for (var i=0; i < doc.layers.length; i++) {
			  if (doc.layers[i].id == id) {
				return doc.layers[i];
			  } else {
				newObj = GetNSObj(doc.layers[i].document,id);
				if (newObj!=-1) return newObj;
			  }
			}
			if (doc.document != null) newObj = GetNSObj(doc.document,id);
		}	
		return -1;
	}	
	
	function AllDivs(objName) {
		var undefined, newobj;
		if (useelementbyid) {
			return document.getElementById(objName);
		} else if (ns) {
			return newobj = GetNSObj(document,objName);
			eval('document.' + objName + ' = newobj');
		} else {
			return document.all(objName);
		}
	}

	function getpropobj(obj) {
		if (typeof(obj) == 'string') {obj = AllDivs(obj)};
		var styleobj = (ns)?obj:obj.style;
		this.x = (ns)?styleobj.x:styleobj.pixelLeft;
		this.y = (ns)?styleobj.y:styleobj.pixelTop;
		this.height = (ns)?obj.document.height:obj.offsetHeight;
		this.width = (ns)?obj.document.width:obj.offsetWidth;
		this.clipheight = (ns)?0:(styleobj.clipBottom - styleobj.clipTop);
		this.vis = (ns)?styleobj.visibility:styleobj.visibility;
		this.display = (ns)?0:styleobj.display;
	}

	function setprop(obj,prop,val) {
		var undefined;
		if (typeof(obj) == 'string') obj = AllDivs(obj);
		if (obj != null) {
			var styleobj = (ns)?obj:obj.style;
			if (prop == prop_x) {(ns)?styleobj.x = val:styleobj.pixelLeft = val;}
			else if (prop == prop_y) {(ns)?styleobj.y = val:styleobj.pixelTop = val;}
			else if (prop == prop_height) {(ns)?obj.document.height = val:obj.height = val;}
			else if (prop == prop_content) {
					 if (ns) {
						obj.document.open();
						obj.document.write(val);
						obj.document.close();
					 } else {
						obj.innerHTML = val;
					 }
					}
			else if (prop == prop_border) {(ns)?styleobj.border=val:styleobj.border=val;}
			else if (prop == prop_clip_bottom) {styleobj.clipBottom = val}
			else if (prop == prop_vis) { if (val==2) {	  // toggle
											styleobj.visibility = (styleobj.visibility.indexOf((ns)?'show':'inherit') < 0) ? ((ns)?'show':'inherit') : ((ns)?'hide':'hidden');
										 } else {
											styleobj.visibility = (val) ? ((ns)?'show':'visible') : ((ns)?'hide':'hidden');
										 }
									    }

			else if (prop == prop_display) { if (val==2) {	  // toggle
											styleobj.display = ((ns)?'block':'');
										 } else {
											styleobj.display = (val) ? '':'none';
										 }
									    }
			else if (prop == prop_bgcolor) {(ns)?styleobj.bgColor = val:styleobj.background = val;}
			else if (prop == prop_fontweight) {(ns)?styleobj.fontWeight = val:styleobj.fontWeight = val;}
		}
	}

	function openwin(src,name,param) {
		var newwin = window.open(src,name,param);
		newwin.focus();
		return void(0);
	}
	
	
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}


function expandlayer(targetId) {
	if(!document.layers) {
		target = AllDivs(targetId);
		if(target.style.display=="none") {
			target.style.display="";
			imgSwap2("Images/Trex/img_faq_arrow_vert.gif", 'img'+targetId);
		}
		else {
			target.style.display="none";
			imgSwap2("Images/Trex/img_faq_arrow_horiz.gif", 'img'+targetId);
		}
	}
}

function imgSwap2(daSrc, daImage) {
	var objStr, obj;
	if(document.images) {
		if (typeof(daImage) == 'string') {
			objStr = daImage;
			obj = AllDivs(objStr);
			obj.src = daSrc;
		} else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
			daImage.src = daSrc;
		}
	}
}

function togglehelp(targetid, linkobj) {
	var target = AllDivs(targetid);
	var linkobj = AllDivs(linkobj);
	var linkprop = new getpropobj(linkobj);
	var targetprop = new getpropobj(target);
	
	if(targetprop.vis=="show" || targetprop.vis=="inherit") {
		setprop(target, prop_vis, false);
	}
	else {
		setprop(lasthelpobject, prop_vis, false);
		setprop(target, prop_vis, true);
		lasthelpobject = target;
	}
}

function slideto(nr, objname, wantedx, wantedy) {
	clearTimeout(threads[nr]);
	objprop = new getpropobj(objname);
	newx = newy = 0;
	if (wantedy != null) {
		newy = Math.round(objprop.y + 0.1 * (wantedy - objprop.y));
		if (Math.abs(wantedy - newy) < 5) {newy=wantedy};
		setprop(objname, prop_y, newy);
	}
	if (wantedx != null) {
		newx = Math.round(objprop.x + 0.1 * (wantedx - objprop.x));
		if (Math.abs(wantedx - newx) < 5) {newx=wantedx};
		setprop(objname, prop_x, newx);
	}
	if ((Math.abs(wantedy - newy) < 5 || wantedy == null) && (Math.abs(wantedx - newx) < 5 || wantedx == null)) {
		clearTimeout(threads[nr]);
	} 
	else {
		threads[nr] = setTimeout('slideto(' + nr + ',\'' + objname + '\',' + wantedx + ',' + wantedy + ');',20);				
	}
}

function moveobj(threadnr, objname, minx, miny, maxx, maxy, onoff) {
	objprop = new getpropobj(objname);
	if ((objprop.y < (miny + (maxy - miny) / 2) || objprop.x < minx + (maxx - minx ) / 2 || onoff == 0) && onoff != 1) {
		slideto(threadnr, objname, maxx, maxy);	
	} 
	else {
		slideto(threadnr, objname, minx, miny);
	}
}