/*
 * e107.js
 */
<!--

if(parent.frames[0])
{
	parent.location.href = self.location.href;
}
/*
 * NOTE: localTime is recorded ASAP after page load; SyncWithServerTime is called at the END
 * of page processing. We want localTime and serverTime set in close chronological order.
 * Page Processing order is as follows:
 * A) All PHP code encountered sequentially in page
 * B) All Javascript code encountered sequentially in page NOT including function internals
 * So best proximity is serverTime at END of php code, and localTime at START of js code.
 * NOTE: this method means reported times include transfer delay. Slightly MORE accurate this way!
 * Final product: tdOffset cookie contains server-browser time difference in seconds,
 * independent of time zone. tzOffset contains browser time zone in minutes.
 */

var nowLocal = new Date();		/* time at very beginning of js execution */
var localTime = Math.floor(nowLocal.getTime()/1000);	/* time, in ms -- recorded at top of jscript */
/* NOTE: if serverDelta is needed for js functions, you must pull it from
 * the cookie (as calculated during a previous page load!)
 * The value calculated in SyncWithServerTime is not known until after the
 * entire page has been processed.
 */
function SyncWithServerTime(serverTime)
{
	if (serverTime) {
	  	/* update time difference cookie */
		tdCookie='e107_tdOffset=';
		tdSetTimeCookie='e107_tdSetTime=';
		serverDelta=Math.floor(localTime-serverTime);
	  	document.cookie = tdCookie+serverDelta;
	  	document.cookie = tdSetTimeCookie+(localTime-serverDelta); /* server time when set */
	}

	tzCookie = 'e107_tzOffset=';
	if (document.cookie.indexOf(tzCookie) < 0) {
		/* set if not already set */
		timezoneOffset = nowLocal.getTimezoneOffset(); /* client-to-GMT in minutes */
		document.cookie = tzCookie + timezoneOffset;
	}
}
	  
if(document.getElementById&&!document.all){ns6=1;}else{ns6=0;}
var agtbrw=navigator.userAgent.toLowerCase();
var operaaa=(agtbrw.indexOf('opera')!=-1);
var head="display:''";
var folder='';

function expandit(curobj){
if(document.getElementById(curobj)){
  folder=document.getElementById(curobj).style;
  }else{

if(ns6==1||operaaa==true){
	folder=curobj.nextSibling.nextSibling.style;
}else{
	folder=document.all[curobj.sourceIndex+1].style;
}
   }
if (folder.display=="none"){folder.display="";}else{folder.display="none";}
}


function urljump(url){
	top.window.location = url; 
}

function open_window(url,type) {
	if('full' == type){
		pwindow = window.open(url);
	} else {
		if (type > 0 ) {
			mywidth=type;
		} else { 
			mywidth=600;
		}
		pwindow = window.open(url,'Name', 'top=100,left=100,resizable=yes,width='+mywidth+',height=400,scrollbars=yes,menubar=yes')
	}
	pwindow.focus();
}

function ejs_preload(ejs_path, ejs_imageString){
	var ejs_imageArray = ejs_imageString.split(','); 
	for(ejs_loadall=0; ejs_loadall<ejs_imageArray.length; ejs_loadall++){ 
		var ejs_LoadedImage=new Image(); 
		ejs_LoadedImage.src=ejs_path + ejs_imageArray[ejs_loadall]; 
	} 
} 

function textCounter(field,cntfield) {
	cntfield.value = field.value.length;
}

function openwindow() {
	opener = window.open("htmlarea/index.php", "popup","top=50,left=100,resizable=no,width=670,height=520,scrollbars=no,menubar=no");
	opener.focus();
}
function setCheckboxes(the_form, do_check){
	var elts = (typeof(document.forms[the_form].elements['perms[]']) != 'undefined') ? document.forms[the_form].elements['perms[]'] : document.forms[the_form].elements['perms[]'];
    var elts_cnt  = (typeof(elts.length) != 'undefined') ? elts.length : 0;
    if(elts_cnt){
		for(var i = 0; i < elts_cnt; i++){
			elts[i].checked = do_check;
        }
	}else{
		elts.checked        = do_check;
    }
	return true;
}

var ref=""+escape(top.document.referrer);
var colord = window.screen.colorDepth; 
var res = window.screen.width + "x" + window.screen.height;
var eself = document.location;

// From http://phpbb.com
var clientPC = navigator.userAgent.toLowerCase();
var clientVer = parseInt(navigator.appVersion);
var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1) && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1) && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;
var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);
var e107_selectedInputArea;
var e107_selectedRange;

// From http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close){
	var selLength = txtarea.textLength;
	var selStart = txtarea.selectionStart;
	var selEnd = txtarea.selectionEnd;
	if (selEnd == 1 || selEnd == 2) selEnd = selLength;
	var s1 = (txtarea.value).substring(0,selStart);
	var s2 = (txtarea.value).substring(selStart, selEnd)
	var s3 = (txtarea.value).substring(selEnd, selLength);
	txtarea.value = s1 + open + s2 + close + s3;
	return;
}

function storeCaret (textAr){
	e107_selectedInputArea = textAr;
	if (textAr.createTextRange){
		e107_selectedRange = document.selection.createRange().duplicate();
	}
}

function addtext(text){
	if (window.e107_selectedInputArea){
		var ta = e107_selectedInputArea;
		val = text.split('][');
				
		if ((clientVer >= 4) && is_ie && is_win){
			theSelection = document.selection.createRange().text; /* wrap selected text */
			if (theSelection) {
				document.selection.createRange().text = val[0] +']' +  theSelection + '[' + val[1];
				ta.focus();
				theSelection = '';
				return;
			}
			
		}else if (ta.selectionEnd && (ta.selectionEnd - ta.selectionStart > 0)){
			mozWrap(ta, val[0] +']', '[' + val[1]); /* wrap selected text */
			return;
		}
		text = ' ' + text + ' ';
		if (ta.createTextRange && e107_selectedRange) {
			var caretPos = e107_selectedRange; /* IE */
			caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
		} else if (ta.selectionStart || ta.selectionStart == '0') { /* Moz */
		   	var startPos = ta.selectionStart;
			var endPos = ta.selectionEnd;
			var charb4 = ta.value.charAt(endPos-1);
			ta.value = ta.value.substring(0, endPos)+ text + ta.value.substring(endPos);
		} else {
			ta.value  += text;
		}
		ta.focus();
	} 
}

function help(help){
	document.getElementById('dataform').helpb.value = help;
}
function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank"; 
 } 
} 

/*
 * theme.js
 */

/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
/*
 * Customize x offset of tooltip
 * Customize y offset of tooltip. see below -- can be top or bottom
 */
var offsetxpoint=0; 
var offsetypoint=-20;
/* var tt_vadjust = 0; */ /* This for top-origin.  Below, set to height for bottom-origin */

var ie=document.all;
var dom=document.getElementById && !document.all;
var enabletip=false;
var opera, ie, dom = 0;
var tipobj=0;
var tt_showDelay=1000; /* ms before actually showing */

/*
 * mod by plh : do set point based on bottom OR top
 */


if (navigator.userAgent.indexOf("Opera") != -1) opera = true;
else if (document.all && !opera) ie = true;
else if (!document.all && document.getElementById) dom = true;

function iebodybase(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function tton(thetext,thewidth,thecolor ){
	if (!thetext.length) return false; /* ignore null strings */
	if (dom||ie){
	if (typeof thewidth!="undefined" && thewidth!="") tipobj.style.width=thewidth+"px";
	if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor;
	tipobj.innerHTML=thetext;

	if (tipobj.showTimer) {window.clearTimeout(tipobj.showTimer);}
	tipobj.showTimer = window.setTimeout("ttonactivate()", tt_showDelay);
	enabletip=true; /* enabled but not yet visible... */
	return false;
	}
}

function ttonactivate(){
	tipobj.style.visibility="visible";
	return false;
}

function positiontt(e){
if (enabletip) {
var tt_vadjust = tipobj.offsetHeight; /* plh mod - use bottom not top. Set to 0 for top. */
var curX=(dom)?e.pageX : event.x+iebodybase().scrollLeft;
var curY=(dom)?e.pageY : event.y+iebodybase().scrollTop;

//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? iebodybase().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20;
var bottomedge=ie&&!window.opera? iebodybase().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20;

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000;

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? iebodybase().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px";
else if (curX<leftedge)
tipobj.style.left="5px";
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px";

//same concept with the vertical position
if (bottomedge<(tipobj.offsetHeight+tt_vadjust)) {
 tipobj.style.top=ie? iebodybase().scrollTop+event.clientY-tipobj.offsetHeight+tt_vadjust-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-tt_vadjust-offsetypoint+"px";
} else {
 newtop = curY+offsetypoint-tt_vadjust;
 if (newtop < 5 ) newtop = 5;
 tipobj.style.top=newtop+"px";
}

}
}

function ttoff(){
if (dom||ie){
enabletip=false;
if (tipobj.showTimer) window.clearTimeout(tipobj.showTimer);
tipobj.style.visibility="hidden";
tipobj.style.left="-1000px";
tipobj.style.backgroundColor='';
tipobj.style.width='';
}
}

function ttrksetup() {
  document.onmousemove=positiontt;
  if (ie||dom) {
    tipobj=document.all? document.all["ttip"] : document.getElementById? document.getElementById("ttip") : "";
    tipobj.showTimer = false;
  }
}

/*
 * marquee as improved/integrated by plh
 */

var preloadimg=new Array();
var ie=document.all;
var dom=document.getElementById && !document.all;

var curpos=0;
var afst=0;
var afsb=0;
var afsr=0;
var afsl=0;
var pxdelta=2;
var curcanvas="canvas0";
var curimgidx=linkidx=0;
var nextimgidx=1;
var afsslide=null;
var tempobj=null;

/*      tempobj.style.left=curpos+"px"; */
function movepic(){
    if (curpos<0){
        curpos=Math.min(curpos+pxdelta,0);
        tempobj.style.clip="rect(" + afst + "px " + (+afsr+curpos) + "px " + afsb + "px " + afsl + "px)"; /* t,r,b,l */
    } else {
        clearInterval(afsslide);
        tempobj = afsslide = null;
        nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1";
        tempobj=ie? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas);
        var slideimg='<img src="'+afsimg[curimgidx]+'" title="'+afstitle[curimgidx]+'" border=0>';
        tempobj.innerHTML=(afsurl[curimgidx]!="")? '<a href="'+afsurl[curimgidx]+'">'+slideimg+'</a>' : slideimg;
        nextimgidx=(nextimgidx<afsimg.length-1)? nextimgidx+1 : 0;
        setTimeout("nextimg()",afs_pause);
    }
}

function nextimg(){
    if (ie||dom){
        clearInterval(afsslide);
        tempobj = afsslide = null;
        resetafs(curcanvas);
        var curobj=tempobj=ie? eval("document.all."+curcanvas) : document.getElementById(curcanvas);
        curobj.style.zIndex++;
        var temp='setInterval("movepic()",'+afs_tick+')';
        afsslide=eval(temp);
        curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0";
    } else {
        document.images.defaultslide.src=afsimg[curimgidx];
    }
    linkidx=curimgidx;
    curimgidx=(curimgidx<afsimg.length-1)? curimgidx+1 : 0;
}

function afslink(){
    if (afsurl[linkidx]!="")
      window.location=afsurl[linkidx];
}

function resetafs(what){
    curpos=parseInt(afs_width)*(-1);
    var curobj=ie? eval("document.all."+what) : document.getElementById(what);
/*    curobj.style.left=curpos+"px"; */
    curobj.style.left=0;
    curobj.style.clip="rect(" + afst + "px " + (+afsr+curpos) + "px " + afsb + "px " + afsl + "px)"; /* t,r,b,l */
}

function startafs(){
    var curobj=ie? eval("document.all."+curcanvas) : document.getElementById(curcanvas);
    curobj.innerHTML='<a href="'+afsurl[curimgidx]+'"><img src="'+afsimg[curimgidx]+'" title="'+afstitle[curimgidx]+'" border=0></a>';
    nextimg();
}
function stopafs() {
        var curobj=ie? eval("document.all."+curcanvas) : document.getElementById(curcanvas);
        curobj.innerHTML='';
        clearInterval(afsslide);
        tempobj = afsslide = null;
}
function afssetup() {
    curpos=parseInt(afs_width)*(-1);
    afst=0;
    afsb=afs_height;
    afsr=afs_width;
    afsl=0;
    
    for (p=0;p<afsimg.length;p++){
        preloadimg[p]=new Image();
        preloadimg[p].src=afsimg[p];
    }

    if (ie||dom) {
        document.write('<div style="position:relative;margin:0 auto;width:'+afs_width+'px;height:'+afs_height+'px;overflow:hidden"><div id="canvas0" style="position:absolute;width:'+afs_width+'px;height:'+afs_height+'px;background-color:'+afsbgcolor+';left:-'+afs_width+'px"></div><div id="canvas1" style="position:absolute;width:'+afs_width+'px;height:'+afs_height+'px;background-color:'+afsbgcolor+';left:-'+afs_width+'px"></div></div>');
        window.onload=startafs;
        window.onresize=startafs;
        window.onunload=stopafs;
    } else {
        document.write('<a href="javascript:afslink()"><img name="defaultslide" src="'+afsimg[0]+'" border=0></a>');
        setInterval("nextimg()",afs_pause);
    }
}

/* END MARQUEE */
/*
 * clock.js from clock plugin
 */
function twochar(i) {
    if (i < 10) return "0"+i;
    return ""+i;
}

function tick(e107_datepref,e107_dateformat,e107_datesuffixes) {
  if(e107_datepref=='undefined'){e107_datepref = '';}
  var hours, minutes, seconds, ap, idxSuffix, aSuffixes;
  var intHours, intMinutes, intSeconds, today;
  today = new Date();
  intDay = today.getDay();
  intDate = today.getDate();
  intMonth = today.getMonth();
  intYear = today.getYear();
  intHours = today.getHours();
  intMinutes = today.getMinutes();
  intSeconds = today.getSeconds();
  timeString = DayNam[intDay]+" "+e107_datepref+" "+intDate;
  if (!e107_datesuffixes.length) e107_datesuffixes = "st|nd|rd|th";
  aSuffixes=e107_datesuffixes.split('|');
  switch (intDate) {
  case 1:
  case 21:
  case 31:
    idxSuffix=0; break;
  case 2:
  case 22:
    idxSuffix=1; break;
  case 3:
  case 23:
    idxSuffix=2; break;  
  default:
    idxSuffix=3;
}
    timeString += aSuffixes[idxSuffix] + " ";
  if (intYear < 2000){
	intYear += 1900;
  }
  timeString += " "+MnthNam[intMonth]+" "+intYear;
  if(e107_dateformat == 1){
    ap = "am.";
    switch (intHours) {
    case 12:
        ap = "pm.";
    case 0:
        hours = "12:";
        break;
    default:
        if (intHours > 12) {
            intHours -= 12;
            ap = "pm.";
        }
        hours = intHours + ":";
    }
  }else{
    hours = twochar(intHours)+":";
    ap = '';
  }
  minutes = twochar(intMinutes);
  seconds = ":"+twochar(intSeconds);
  timeString = (document.all)? timeString+", "+hours+minutes+seconds+" "+ap : timeString+" "+hours+minutes+" "+ap;
  var clock = (document.all) ? document.all("Clock") : document.getElementById("Clock");
  clock.innerHTML = timeString;
  window.setTimeout("tick('"+e107_datepref+"','"+e107_dateformat+"','"+e107_datesuffixes+"');", (document.all) ? 1000 : 6000);
}

/* =================================================================================================
 * TrM 
 * March, 2003
 *
 * Customizable multi-level animated DHTML menus with transparency.
 *
 * Copyright 2003-2004, Aaron Boodman (www.youngpup.net)
 * =================================================================================================
 * "Can I use this?"
 * 
 * Use of this library is governed by the Creative Commons Attribution 2.0 License. You can check it 
 * out at: http://creativecommons.org/licenses/by/2.0/
 *
 * Basically: You may copy, distribute, and eat this code as you wish. But you must give me credit 
 * for writing it. You may not misrepresent yourself as the author of this code.
 * =================================================================================================
 * "It's kinda hard to read, though"
 *
 * The uncompressed, commented version of this script can be found at: 
 * http://youngpup.net/projects/TrMs
 * =================================================================================================
 * updates:
 * 04.19.04 fixed cascade problem with menus nested greater than two levels.
 * 12.23.03 added hideCurrent for menu actuators with no menus. renamed to TrM.
 * 04.18.03	fixed render bug in IE 5.0 Mac by removing that browser from compatibility table ;)
 *			also made gecko check a little more strict by specifying build no.
 * ============================================================================================== */



/* TRM TOP */

var dmesg = (function(msg){ /* FireBug debugging */
if (typeof(console)!="undefined"
&& typeof(console.log)=="function") {
return function(msg) { console.log(msg);  };
}
return function (msg) { }
})();

function padStr(str, len, chr) {
	var padding = (str.length >= len) ? '' : Array(1 + len - str.length >>> 0).join(chr);
	return padding + str;
}


function px2em( ipx )
{ /* Based on 13px = 1em */
	return ipx + 'px';
	return ((parseFloat(ipx)/13.0).toFixed(3))+'em';
}
function em2px( iem )
{ /* Based on 13px = 1em */
	return parseFloat(iem);
	return (parseFloat(iem)*13.0).toFixed(3);
}


//==================================================================================================
// Configuration properties
//==================================================================================================
// TrM.spacerGif = "images/x.gif";                     // path to a transparent spacer gif
// TrM.dingbatOn = "images/submenu-off.gif";            // path to the active sub menu dingbat
// TrM.dingbatOff = "images/submenu-off.gif";          // path to the inactive sub menu dingbat
// TrM.dingbatSize = 14;                            // size of the dingbat (square shape assumed)
// TrM.menuPadding = 5;                             // padding between menu border and items grid
// TrM.itemPadding = 3;                             // additional padding around each item
// TrM.shadowSize = 2;                              // size of shadow under menu
// TrM.shadowOffset = 3;                            // distance shadow should be offset from leading edge
// TrM.shadowColor = "#888";                        // color of shadow (transparency is set in CSS)
// TrM.shadowPng = "images/grey-40.png";               // a PNG graphic to serve as the shadow for mac IE5
// TrM.backgroundColor = "white";                   // color of the background (transparency set in CSS)
// TrM.backgroundPng = "images/white-90.png";          // a PNG graphic to server as the background for mac IE5
// TrM.hideDelay = 1000;                            // number of milliseconds to wait before hiding a menu
// TrM.slideTime = 400;                             // number of milliseconds it takes to open and close a menu


//==================================================================================================
// Internal use properties
//==================================================================================================
TrM.ref = {topLeft:1,topRight:2,bottomLeft:3,bottomRight:4};
TrM.dir = {down:1,right:2};
TrM.reg = [];
TrM._maxZ = 100;



//==================================================================================================
// Static methods
//==================================================================================================
// supporting win ie5+, mac ie5.1+ and gecko >= mozilla 1.0
TrM.isSupported = function() {
        var ua = navigator.userAgent.toLowerCase();
		var pf = navigator.platform.toLowerCase();
        var an = navigator.appName;
        var r = false;

        if (ua.indexOf("gecko") > -1 && navigator.productSub >= 20020605) r = true; // gecko >= moz 1.0
        else if (an == "Microsoft Internet Explorer") {
                if (document.getElementById) { // ie5.1+ mac,win
                        if (pf.indexOf("mac") == 0) {
							r = /msie (\d(.\d*)?)/.test(ua) && Number(RegExp.$1) >= 5.1;
						}
						else r = true;
                }
        }

        return r;
}

// call this in onload once menus have been created
TrM.initialize = function() {
        for (var i = 0, menu = null; menu = this.reg[i]; i++) {
                menu.initialize();
        }
}

// call this in document body to write out menu html
TrM.renderAll = function() {
        var aMenuHtml = [];
        for (var i = 0, menu = null; menu = this.reg[i]; i++) {
                aMenuHtml[i] = menu.toString();
        }
        document.write(aMenuHtml.join(""));
}

//==================================================================================================
// TrM constructor (only called internally)
//==================================================================================================
// oActuator            : The thing that causes the menu to be shown when it is mousedover. Either a
//                        reference to an HTML element, or a TrMItem from an existing menu.
// iDirection           : The direction to slide out. One of TrM.dir.
// iLeft                : Left pixel offset of menu from actuator
// iTop                 : Top pixel offset of menu from actuator
// iReferencePoint      : Corner of actuator to measure from. One of TrM.refPoint.
// parentMenuSet        : Menuset this menu will be added to.
//==================================================================================================
function TrM(oActuator, iDirection, iLeft, iTop, iReferencePoint, parentMenuSet, idMenuTip) {
        // public methods
        this.addItem = addItem;
        this.addMenu = addMenu;
        this.toString = toString;
        this.initialize = initialize;
        this.isOpen = false;
        this.show = show;
        this.hide = hide;
        this.items = [];
        this.idTip = idMenuTip;
        this.oAct = oActuator;

        // events
        this.onactivate = new Function();       // when the menu starts to slide open
        this.ondeactivate = new Function();     // when the menu finishes sliding closed
        this.onmouseover = new Function();      // when the menu has been moused over
        this.onqueue = new Function();          // hack .. when the menu sets a timer to be closed a little while in the future
		this.ondequeue = new Function();

        // initialization
        this.index = TrM.reg.length;
        TrM.reg[this.index] = this;

        var id = "TrM" + this.index;
        var contentHeight = null;
        var contentWidth = null;
        var childMenuSet = null;
        var animating = false;
        var childMenus = [];
        var slideAccel = -1;
        var TrSav = null;
        var ready = false;
        var _this = this;
        var a = null;
        var oTTipOuter = null;
        var oTTipInner = null;
        var curTTip = null;
        var sCurNav = null;
        var curHN   = null;

        var pos = iDirection == TrM.dir.down ? "top" : "left";
        var dim = null;

        // private and public method implimentations
        function addItem(sText, sUrl, idItemTip) {
                var item = new TrMItem(sText, sUrl, this, idItemTip);
                item._index = this.items.length;
                this.items[item._index] = item;
        }

        function addMenu(oMenuItem, idMenuTip) {
                if (!oMenuItem.parentMenu == this) throw new Error("Cannot add a menu here");

                if (childMenuSet == null) childMenuSet = new TrMSet(TrM.dir.right, 0, 0, TrM.ref.topRight); // was -5,2

                var m = childMenuSet.addMenu(oMenuItem, idMenuTip);

                childMenus[oMenuItem._index] = m;
                m.onmouseover = child_mouseover;
                m.ondeactivate = child_deactivate;
                m.onqueue = child_queue;
					m.ondequeue = child_dequeue;

                return m;
        }

        function initialize() {
                initCache();
                initEvents();
                initSize();
                if (TrM.showToolTips) {
                	oTTipOuter=document.all? document.all["ttip_outer"] : 
    									document.getElementById? document.getElementById("ttip_outer") : "";
                	oTTipInner=document.all? document.all["ttip_inner"] : 
    									document.getElementById? document.getElementById("ttip_inner") : "";
    				}
                ready = true;
        }

        function show() {
                //dbg_dump("show");
                if (ready) {
                        _this.isOpen = true;
                        ttip_show( this.idTip );
                        if (_this.items.length) {
	                        animating = true;
	                        setContainerPos();
	                        TrSav["clip"].style.visibility = "visible";
	                        TrSav["clip"].style.zIndex = TrM._maxZ++;
	                        //dbg_dump("maxZ: " + TrM._maxZ);
	                        slideStart();
	                        WCH.Apply(id);
	                        _this.onactivate();
	                     }
                }
        }

        function hide() {
                if (ready) {
                        _this.isOpen = false;
                        ttip_hide( this.idTip );
                        if (_this.items.length) {
	                        animating = true;
	
	                        for (var i = 0, item = null; item = TrSav.item[i]; i++) 
	                                dehighlight(item);
	
	                        if (childMenuSet) childMenuSet.hide();
	
	                        slideStart();
	                        WCH.Discard(id);
	                        _this.ondeactivate();
                     	}
                }
        }

         function setContainerPos() {
                var sub = oActuator.constructor == TrMItem; 
                var act = sub ? oActuator.parentMenu.TrSav["item"][oActuator._index] : oActuator; 
                var el = act;
                
                var x = 0;
                var y = 0;

                
                var minX = 0;
                var maxX = (window.innerWidth ? window.innerWidth : document.body.clientWidth) - em2px(TrSav["clip"].style.width);
                var minY = 0;
                var maxY = (window.innerHeight ? window.innerHeight : document.body.clientHeight) - em2px(TrSav["clip"].style.height);
                var myTxt = 'DEBUGOUT: maxX/inwid/clipstywid/clip2px='+maxX+'/'+window.innerWidth+'/'+TrSav["clip"].style.width+'/'+em2px(TrSav["clip"].style.width);
             //   dmesg(myTxt);
                if (maxX < minX) maxX = 0;
                if (maxY < minY) maxY = 0;
               // dmesg("TEST maxX/Y"+maxX+'/'+maxY);

                // add up all offsets... subtract any scroll offset
                while (sub ? el.parentNode.className.indexOf("TrM") == -1 : el.parentNode && (el.parentNode.id.indexOf("menubar") == -1)) {
                	      opN = el.parentNode;
                	      opNt = opN.tagName+'#'+opN.id+'.'+opN.className;
                	      opN = el.offsetParent;
                	      opOt = opN.tagName+'#'+opN.id+'.'+opN.className;
                	      opN = el;
                	      opMt = opN.tagName+'#'+opN.id+'.'+opN.className;
                	      myTxt += 'po++';
                	      if (opNt != opOt ) {
                	      	myTxt +='//parent Mismatch: node='+opNt+'/offs='+opOt+'//';
                	      }
                	      myTxt +='->(me='+opMt+')';
                        x += el.offsetLeft;
                        y += el.offsetTop;
                        myTxt += padStr(el.offsetTop,3,' ');

                        if (el.scrollLeft) x -= el.scrollLeft;
                        if (el.scrollTop) {y -= el.scrollTop; myTxt += '-s'+el.ScrollTop;}
                        
                        el = el.offsetParent;
                }

                if (oActuator.constructor == TrMItem) {
                        x += em2px(el.parentNode.style.left);
                        y += em2px(el.parentNode.style.top);
                        myTxt += 'pNs'+padStr(em2px(el.parentNode.style.top),3,' ');
                }
								myTxt += 'actW='+act.offsetWidth+',actH='+act.offsetHeight;
                switch (iReferencePoint) {
                        case TrM.ref.topLeft:
                                break;
                        case TrM.ref.topRight:
                                x += act.offsetWidth;
                                break;
                        case TrM.ref.bottomLeft:
                                y += act.offsetHeight;
		                        myTxt += 'ao'+padStr(act.offsetHeight,3,' ');
                                break;
                        case TrM.ref.bottomRight:
                                x += act.offsetWidth;
                                y += act.offsetHeight;
		                        myTxt += 'ao'+padStr(act.offsetHeight,3,' ');
                                break;
                }
                
                //  Begin fix for Safari 1.2 Submenu Positions

					if (act.tagName == "TR" && act.childNodes[0] && act.childNodes[1] && act.offsetWidth == 0 && act.offsetHeight == 0)
					{
                      myTxt += ',Safari,';
					    switch (iReferencePoint)
					    {
					        case TrM.ref.topLeft:
					                break;
					        case TrM.ref.topRight:
					                x += act.childNodes[1].offsetLeft + act.childNodes[1].offsetWidth;
					                y += act.childNodes[0].offsetTop;
					                break;
					        case TrM.ref.bottomLeft:
					                y += act.childNodes[0].offsetTop + act.childNodes[0].offsetHeight;
					                break;
					        case TrM.ref.bottomRight:
					            x += act.childNodes[1].offsetLeft + act.childNodes[1].offsetWidth;
					            y += act.childNodes[0].offsetTop + act.childNodes[0].offsetHeight;
					            break;
					    }
					}
					//  End fix for Safaria 1.2 Submenu Positions

                x += iLeft;
                y += iTop;
                myTxt+= 'iTop'+padStr(iTop,3,' ');

                myTxt += ',Tot='+ padStr(y,3,' ');
                x = Math.max(Math.min(x, maxX), minX);
                y = Math.max(Math.min(y, maxY), minY);
                myTxt += 'Min='+padStr(minY,3,' ')+',Max='+padStr(maxY,3,' ')+',Out='+ padStr(y,3,' ');
               //dmesg(myTxt);
//dmesg("setting clip L/T="+px2em(x)+'/'+px2em(y));
                TrSav["clip"].style.left = px2em(x);
                TrSav["clip"].style.top = px2em(y);
        }

        function slideStart() {
                var x0 = parseFloat(TrSav["content"].style[pos]);
                var x1 = parseFloat(px2em(_this.isOpen ? 0 : -dim));
//dmesg('slidestart x0/x1='+x0+'/'+x1);
                if (a != null) a.stop();
                a = new Acim(x0, x1, TrM.slideTime, slideAccel);

                a.onframe = slideFrame;
                a.onend = slideEnd;

                a.start();
        }

        function slideFrame(x) {
     //   	dmesg('slideto='+x);//+'/'+px2em(x));
                TrSav["content"].style[pos] = x+a.unit;
        }

        function slideEnd() {
                if (!_this.isOpen) {
                	TrSav["clip"].style.visibility = "hidden";
               }
                animating = false;
        }

        function initSize() {
                // everything is based off the size of the items table...
                var ow = TrSav["items"].offsetWidth;
                var oh = TrSav["items"].offsetHeight;
                var ua = navigator.userAgent.toLowerCase();
                var xtraSize = TrM.shadowSize + TrM.menuPadding;
                //dmesg('ow, oh, xtra='+ow+'/'+oh+'/'+xtraSize);

                // clipping container should be ow/oh + the size of the shadow
                TrSav["clip"].style.width = px2em(ow + xtraSize);
                TrSav["clip"].style.height = px2em(oh + xtraSize);

                // same with content...
                TrSav["content"].style.width = px2em(ow + TrM.shadowSize);
                TrSav["content"].style.height = px2em(oh + TrM.shadowSize);

                contentHeight = oh + xtraSize; /* TrM.shadowSize; */
                contentWidth = ow + xtraSize; /* TrM.shadowSize; */
                
                dim = iDirection == TrM.dir.down ? contentHeight : contentWidth;

                // set initially closed
                //dmesg('dim, shadow, -dim-shadow = '+dim+'/'+TrM.shadowSize+'/'+(-dim-TrM.shadowSize)+'='+px2em(-dim - TrM.shadowSize));
                TrSav["content"].style[pos] = px2em(-dim - TrM.shadowSize);
                TrSav["clip"].style.visibility = "hidden";

                // if *not* mac/ie 5
                if (ua.indexOf("mac") == -1 || ua.indexOf("gecko") > -1) {
                        // set background div to offset size
                        TrSav["background"].style.width = px2em(ow);
                        TrSav["background"].style.height = px2em(oh);
                        TrSav["background"].style.backgroundColor = TrM.backgroundColor;

                        // shadow left starts at offset left and is offsetHeight pixels high
                        TrSav["shadowRight"].style.top = px2em(TrM.shadowOffset);
                        TrSav["shadowRight"].style.left = px2em(ow);
                        TrSav["shadowRight"].style.width = px2em(TrM.shadowSize);
                        TrSav["shadowRight"].style.height = px2em(oh + TrM.shadowSize - TrM.shadowOffset);
                        TrSav["shadowRight"].style.backgroundColor = TrM.shadowColor;

                        // shadow bottom starts at offset height and is offsetWidth - shadowOffset 
                        // pixels wide (we don't want the bottom and right shadows to overlap or we 
                        // get an extra bright bottom-right corner)
                        TrSav["shadowBottom"].style.top = px2em(oh);
                        TrSav["shadowBottom"].style.left = px2em(TrM.shadowOffset);
                        TrSav["shadowBottom"].style.width = px2em(ow - TrM.shadowOffset);
                        TrSav["shadowBottom"].style.height = px2em(TrM.shadowSize);
                        TrSav["shadowBottom"].style.backgroundColor = TrM.shadowColor;
                }
                // mac ie is a little different because we use a PNG for the transparency
                else {
                        // set background div to offset size
                        TrSav["background"].firstChild.src = TrM.backgroundPng;
                        TrSav["background"].firstChild.width = px2em(ow);
                        TrSav["background"].firstChild.height = px2em(oh);

                        // shadow left starts at offset left and is offsetHeight pixels high
                        TrSav["shadowRight"].firstChild.src = TrM.shadowPng;
                        TrSav["shadowRight"].style.top = px2em(TrM.shadowOffset);
                        TrSav["shadowRight"].style.left = px2em(ow);
                        TrSav["shadowRight"].firstChild.width = px2em(TrM.shadowSize);
                        TrSav["shadowRight"].firstChild.height = px2em(oh + TrM.shadowSize - TrM.shadowOffset);;

                        // shadow bottom starts at offset height and is offsetWidth - shadowOffset 
                        // pixels wide (we don't want the bottom and right shadows to overlap or we 
                        // get an extra bright bottom-right corner)
                        TrSav["shadowBottom"].firstChild.src = TrM.shadowPng;
                        TrSav["shadowBottom"].style.top = px2em(oh);
                        TrSav["shadowBottom"].style.left = TrM.shadowOffset;
                        TrSav["shadowBottom"].firstChild.width = px2em(ow - TrM.shadowOffset);
                        TrSav["shadowBottom"].firstChild.height = px2em(TrM.shadowSize);
                }
        }
        
        function initCache() {
                var menu = document.getElementById(id);
                var all = menu.all ? menu.all : menu.getElementsByTagName("*"); // IE/win doesn't support * syntax, but does have the document.all thing

                TrSav = {};
                TrSav["clip"] = menu;
                TrSav["item"] = [];
                
                for (var i = 0, elm = null; elm = all[i]; i++) {
                        switch (elm.className) {
                                case "items":
                                case "content":
                                case "background":
                                case "shadowRight":
                                case "shadowBottom":
                                        TrSav[elm.className] = elm;
                                        break;
                                case "item":
                                        elm._index = TrSav["item"].length;
                                        TrSav["item"][elm._index] = elm;
                                        break;
                        }
                }

                // hack!
                _this.TrSav = TrSav;
        }

        function initEvents() {
                // hook item mouseover
                for (var i = 0, item = null; item = TrSav.item[i]; i++) {
                        item.onmouseover = item_mouseover;
                        item.onmouseout = item_mouseout;
                        item.onclick = item_click;
                }

                // hook actuation
                if (typeof oActuator.tagName != "undefined") {
                        oActuator.onmouseover = actuator_mouseover;
                        oActuator.onmouseout = actuator_mouseout;
                }

                // hook menu mouseover
                TrSav["content"].onmouseover = content_mouseover;
                TrSav["content"].onmouseout = content_mouseout;
        }

        function highlight(oRow) {
                oRow.className = "item hover";
                if (childMenus[oRow._index]) 
                        oRow.lastChild.firstChild.src = TrM.dingbatOn;
        }

        function dehighlight(oRow) {
                oRow.className = "item";
                if (childMenus[oRow._index]) 
                        oRow.lastChild.firstChild.src = TrM.dingbatOff;
        }
        
        
        function ttip_show( idTip ) {
        		if (TrM.showToolTips && idTip) {
        			sTip = tt_[idTip];
        			if (sTip.length) { /* or '1' to always show even if null */
        				curTTip = idTip;
                 	oTTipInner.innerHTML= sTip;
                  oTTipOuter.style.visibility= "visible";
               }
		      }
		  }
		  function ttip_hide( idTip ) {
		  		if (TrM.showToolTips) {
		  			if (!idTip) idTip = curTTip;
		  			if (curTTip && idTip == curTTip) { /* only hide if this is the current object */
		  				oTTipOuter.style.visibility= "hidden";
		  				curTTip = 0;
		  			}
		  		}
		  }

        function hovernav_show( oObj,idHN ) {					/* activators can have alternate nav text :) */

        		if (!curHN && TrM.showHoverNav && idHN) {
        			sHov = hovernav_[idHN];

        			if (sHov && sHov.length) {
        				curHN = idHN;
        				curHText = oObj.oAct.innerHTML;
                 	oObj.oAct.innerHTML= sHov;
               }
		      }
		  }
		  function hovernav_hide( oObj,idHN ) {
		  		if (TrM.showHoverNav) {
		  			if (!idHN) idHN = curHN;
		  			if (curHN && idHN == curHN) { /* only hide if this is the current object */
						oObj.oAct.innerHTML = curHText;
		  				curHN = 0;
		  			}
		  		}
		  }
		  
        function item_mouseover() {
                if (1||!animating) {
                        highlight(this);
                        ttip_show( _this.items[this._index].idTip );
                        if (childMenus[this._index]) 
                                childMenuSet.showMenu(childMenus[this._index]);
                        else if (childMenuSet) childMenuSet.hide();
                }
        }

        function item_mouseout() {
                if (1||!animating) {
                        ttip_hide( _this.items[this._index].idTip );
                        if (childMenus[this._index])
                                childMenuSet.hideMenu(childMenus[this._index]);
                        else    // otherwise child_deactivate will do this
                                dehighlight(this);
                }
        }

        function item_click() {
                if (!animating) {
                        if (_this.items[this._index].url) 
                                location.href = _this.items[this._index].url;
                }
        }

        function actuator_mouseover() {
        	       ttip_show( _this.idTip );
        	       hovernav_show( _this,_this.idTip );
                parentMenuSet.showMenu(_this);
        }

        function actuator_mouseout() {
        			 hovernav_hide( _this,_this.idTip );
                parentMenuSet.hideMenu(_this);
        }

        function content_mouseover() {
                if (1||!animating) {
                        parentMenuSet.showMenu(_this);
                        _this.onmouseover();
                }
        }

        function content_mouseout() {
                if (1||!animating) {
                        parentMenuSet.hideMenu(_this);
                }
        }

        function child_mouseover() {
                if (1||!animating) {
                        parentMenuSet.showMenu(_this);
                }
        }

        function child_deactivate() {
                for (var i = 0; i < childMenus.length; i++) {
                        if (childMenus[i] == this) {
                                dehighlight(TrSav["item"][i]);
                                break;
                        }
                }
        }

        function child_queue() {
                parentMenuSet.hideMenu(_this);
        }

		function child_dequeue() {
				parentMenuSet.showMenu(_this);
		}

        function toString() {
                var aHtml = [];
                var sClassName = "TrM" + (oActuator.constructor != TrMItem ? " top" : "");

                for (var i = 0, item = null; item = this.items[i]; i++) {
                        aHtml[i] = item.toString(childMenus[i]);
                }

                return '<div id="' + id + '" class="' + sClassName + '">' + 
                        '<div class="content"><table class="items" cellpadding="0" cellspacing="0" border="0">' + 
                        (TrM.menuPadding ? '<tr><td colspan="2"><img src="' + TrM.spacerGif + '" width="1" height="' + TrM.menuPadding + '"></td></tr>' : '') + 
                        aHtml.join('') + 
                        '<tr><td colspan="2"><img src="' + TrM.spacerGif + '" width="1" height="' + TrM.menuPadding + '"></td></tr></table>' + 
                        '<div class="shadowBottom"><img src="' + TrM.spacerGif + '" width="1" height="1"></div>' + 
                        '<div class="shadowRight"><img src="' + TrM.spacerGif + '" width="1" height="1"></div>' + 
		        '<div class="background"><img src="' + TrM.spacerGif + '" width="1" height="1"></div>' + 
	                '</div></div>';
        }
}


//==================================================================================================
// TrMSet
//==================================================================================================
// iDirection           : The direction to slide out. One of TrM.dir.
// iLeft                : Left pixel offset of menus from actuator
// iTop                 : Top pixel offset of menus from actuator
// iReferencePoint      : Corner of actuator to measure from. One of TrM.refPoint.
//==================================================================================================
TrMSet.reg = [];

function TrMSet(iDirection, iLeft, iTop, iReferencePoint) {
        // public methods
        this.addMenu = addMenu;
        this.showMenu = showMenu;
        this.hideMenu = hideMenu;
        this.hide = hide;
        this.hideCurrent = hideCurrent;

        // initialization
        var menus = [];
        var _this = this;
        var current = null;

        this.index = TrMSet.reg.length;
        TrMSet.reg[this.index] = this;

        // method implimentations...
        function addMenu(oActuator, idActTip) {
        //	dmesg("DGBACT: oa='+oActuator.tagName+'#'+oActuator.id+'.'+oActuator.className+'// iLeft='+iLeft);
                var m = new TrM(oActuator, iDirection, iLeft, iTop, iReferencePoint, this, idActTip);
                menus[menus.length] = m;
                return m;
        }

        function showMenu(oMenu) {
                if (oMenu != current) {
                        // close currently open menu
                        if (current != null) hide(current);        

                        // set current menu to this one
                        current = oMenu;

                        // if this menu is closed, open it
                        oMenu.show();
                }
                else {
                        // hide pending calls to close this menu
                        cancelHide(oMenu);
                }
        }

        function hideMenu(oMenu) {
                //dbg_dump("hideMenu a " + oMenu.index);
                if (current == oMenu && oMenu.isOpen) {
                        //dbg_dump("hideMenu b " + oMenu.index);
                        if (!oMenu.hideTimer) scheduleHide(oMenu);
                }
        }

        function scheduleHide(oMenu) {
                //dbg_dump("scheduleHide " + oMenu.index);
                oMenu.onqueue();
                oMenu.hideTimer = window.setTimeout("TrMSet.reg[" + _this.index + "].hide(TrM.reg[" + oMenu.index + "])", TrM.hideDelay);
        }

        function cancelHide(oMenu) {
                //dbg_dump("cancelHide " + oMenu.index);
                if (oMenu.hideTimer) {
						oMenu.ondequeue();
                        window.clearTimeout(oMenu.hideTimer);
                        oMenu.hideTimer = null;
                }
        }

        function hide(oMenu) {   
                if (!oMenu && current) oMenu = current;

                if (oMenu && current == oMenu && oMenu.isOpen) {
                        hideCurrent();
                }
        }

        function hideCurrent() {
				if (null != current) {
                cancelHide(current);
                current.hideTimer = null;
                current.hide();
                current = null;
        }
}
}

//==================================================================================================
// TrMItem (internal)
// represents an item in a dropdown
//==================================================================================================
// sText        : The item display text
// sUrl         : URL to load when the item is clicked
// oParent      : Menu this item is a part of
// idTip        : (string) id of ToolTip in tt_[] array
//==================================================================================================
function TrMItem(sText, sUrl, oParent, idItemTip) {
        this.toString = toString;
        this.text = sText;
        this.url = sUrl;
        this.parentMenu = oParent;
        this.idTip = idItemTip;

        function toString(bDingbat) {
                var sDingbat = bDingbat ? TrM.dingbatOff : TrM.spacerGif;
                var iEdgePadding = TrM.itemHPadding + TrM.menuPadding;
                var sPaddingLeft = "padding:" + px2em(TrM.itemVPadding) + "; padding-left:" + px2em(iEdgePadding) + ";"
                var sPaddingRight = "padding:" + px2em(TrM.itemVPadding) + "; padding-right:" + px2em(iEdgePadding) + ";"

                return '<tr class="item"><td nowrap style="' + sPaddingLeft + '">' + 
                        sText + '</td><td width="14" style="' + sPaddingRight + '">' + 
                        '<img src="' + sDingbat + '" width="14" height="14"></td></tr>';
        }
}


//=====================================================================
// Accel[erated] [an]imation object
// change a property of an object over time in an accelerated fashion
//=====================================================================
// obj  : reference to the object whose property you'd like to animate
// prop : property you would like to change eg: "left"
// to   : final value of prop
// time : time the animation should take to run
// zip	: optional. specify the zippiness of the acceleration. pick a 
//		  number between -1 and 1 where -1 is full decelerated, 1 is 
//		  full accelerated, and 0 is linear (no acceleration). default
//		  is 0.
// unit	: optional. specify the units for use with prop. default is 
//		  "px".
//=====================================================================
// bezier functions lifted from the lib_animation.js file in the 
// 13th Parallel API. www.13thparallel.org
//=====================================================================

function Acim(from, to, time, zip) {
	if (typeof zip  == "undefined") zip  = 0;
	if (typeof unit == "undefined") unit = "px";
//	if (typeof unit == "undefined") unit = "em";

        this.x0         = from;
        this.x1		= to;
	this.dt		= time;
	this.zip	= -zip;
	this.unit	= unit;
	this.timer	= null;
	this.onend	= new Function();
        this.onframe    = new Function();
}



//=====================================================================
// public methods
//=====================================================================

// after you create an Acim, you call this to start it-a runnin'
Acim.prototype.start = function() {
	this.t0 = new Date().getTime();
	this.t1 = this.t0 + this.dt;
	var dx	= this.x1 - this.x0;
	this.c1 = this.x0 + ((1 + this.zip) * dx / 3);
	this.c2 = this.x0 + ((2 + this.zip) * dx / 3);
	Acim._add(this);
}

// and if you need to stop it early for some reason...
Acim.prototype.stop = function() {
	Acim._remove(this);
}



//=====================================================================
// private methods
//=====================================================================

// paints one frame. gets called by Acim._paintAll.
Acim.prototype._paint = function(time) {
	if (time < this.t1) {
		var elapsed = time - this.t0;
	        this.onframe(Acim._getBezier(elapsed/this.dt,this.x0,this.x1,this.c1,this.c2));
        }
	else this._end();
}

// ends the animation
Acim.prototype._end = function() {
	Acim._remove(this);
        this.onframe(this.x1);
	this.onend();
}



//=====================================================================
// static methods (all private)
//=====================================================================

// add a function to the list of ones to call periodically
Acim._add = function(o) {
	var index = this.instances.length;
	this.instances[index] = o;
	// if this is the first one, start the engine
	if (this.instances.length == 1) {
		this.timerID = window.setInterval("Acim._paintAll()", this.targetRes);
	}
}

// remove a function from the list
Acim._remove = function(o) {
	for (var i = 0; i < this.instances.length; i++) {
		if (o == this.instances[i]) {
			this.instances = this.instances.slice(0,i).concat( this.instances.slice(i+1) );
			break;
		}
	}
	// if that was the last one, stop the engine
	if (this.instances.length == 0) {
		window.clearInterval(this.timerID);
		this.timerID = null;
	}
}

// "engine" - call each function in the list every so often
Acim._paintAll = function() {
	var now = new Date().getTime();
	for (var i = 0; i < this.instances.length; i++) {
		this.instances[i]._paint(now);
	}
}


// Bezier functions:
Acim._B1 = function(t) { return t*t*t }
Acim._B2 = function(t) { return 3*t*t*(1-t) }
Acim._B3 = function(t) { return 3*t*(1-t)*(1-t) }
Acim._B4 = function(t) { return (1-t)*(1-t)*(1-t) }


//Finds the coordinates of a point at a certain stage through a bezier curve
Acim._getBezier = function(percent,startPos,endPos,control1,control2) {
	return endPos * this._B1(percent) + control2 * this._B2(percent) + control1 * this._B3(percent) + startPos * this._B4(percent);
}


//=====================================================================
// static properties
//=====================================================================

Acim.instances = [];
Acim.targetRes = 10;
Acim.timerID = null;
/* TRM END */




//=====================================================================
// IE win memory cleanup
//=====================================================================

if (window.attachEvent) {
	var cearElementProps = [
		'data',
		'onmouseover',
		'onmouseout',
		'onmousedown',
		'onmouseup',
		'ondblclick',
		'onclick',
		'onselectstart',
		'oncontextmenu'
	];

	window.attachEvent("onunload", function() {
        var el;
        for(var d = document.all.length;d--;){
            el = document.all[d];
            for(var c = cearElementProps.length;c--;){
                el[cearElementProps[c]] = null;
            }
        }
	});
}

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	WCH.js - Windowed Controls Hider v3.10
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	(c) Copyright 2003, Aleksandar Vacic, aleck@sezampro.yu, www.aplus.co.yu
	## This work is licensed under the Creative Commons Attribution-ShareAlike License.
	## To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/1.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Credits: Mike Foster for x functions (cross-browser.com)
	Credits: Tim Connor for short and sweet way of dealing with IE5.0 - dynamic creation of style rule (www.infosauce.com)
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Based on idea presented by Joe King. Works with IE5.0+/Win
	IE 5.5+: place iFrame below the layer to hide windowed controls
	IE 5.0 : hide/show all elements that have "WCHhider" class
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
var WCH_Constructor = function() {
	//	exit point for anything but IE5.0+/Win
	if ( !(document.all && document.getElementById && !window.opera && navigator.userAgent.toLowerCase().indexOf("mac") == -1) ) {
		this.Apply = function() {};
		this.Discard = function() {};
		return;
	}

	//	private properties
	var _bIE55 = false;
	var _bIE6 = false;
	var _oRule = null;
	var _bSetup = true;
	var _oSelf = this;

	//	public: hides windowed controls
	this.Apply = function(vLayer, vContainer, bResize) {
		if (_bSetup) _Setup();

		if ( _bIE55 && (oIframe = _Hider(vLayer, vContainer, bResize)) ) {
			oIframe.style.visibility = "visible";
		} else if(_oRule != null) {
			_oRule.style.visibility = "hidden";
		}

	};

	//	public: shows windowed controls
	this.Discard = function(vLayer, vContainer) {
		if ( _bIE55 && (oIframe = _Hider(vLayer, vContainer, false)) ) {
			oIframe.style.visibility = "hidden";
		} else if(_oRule != null) {
			_oRule.style.visibility = "visible";
		}
	};

	//	private: returns iFrame reference for IE5.5+
	function _Hider(vLayer, vContainer, bResize) {
		var oLayer = _GetObj(vLayer);
		var oContainer = ( (oTmp = _GetObj(vContainer)) ? oTmp : document.getElementsByTagName("body")[0] );
		if (!oLayer || !oContainer) return;
		//	is it there already?
		var oIframe = document.getElementById("WCHhider" + oLayer.id);
		
		//	if not, create it
		if ( !oIframe ) {
			//	IE 6 has this property, IE 5 not. IE 5.5(even SP2) crashes when filter is applied, hence the check
			var sFilter = (_bIE6) ? "filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);" : "";
			//	get z-index of the object
			var zIndex = oLayer.style.zIndex;
			if ( zIndex == "" ) zIndex = oLayer.currentStyle.zIndex;
			zIndex = parseInt(zIndex);
			//	if no z-index, do nothing
			if ( isNaN(zIndex) ) return null;
			//	if z-index is below 2, do nothing (no room for Hider)
			if (zIndex < 2) return null;
			//	go one step below for Hider
			zIndex--;
			var sHiderID = "WCHhider" + oLayer.id;
			oContainer.insertAdjacentHTML("afterBegin", '<iframe class="WCHiframe" src="javascript:false;" id="' + sHiderID + '" scroll="no" frameborder="0" style="position:absolute;visibility:hidden;' + sFilter + 'border:0;top:0;left;0;width:0;height:0;background-color:#ccc;z-index:' + zIndex + ';"></iframe>');
			oIframe = document.getElementById(sHiderID);
			//	then do calculation
			_SetPos(oIframe, oLayer);
		} else if (bResize) {
			//	resize the iFrame if asked
			_SetPos(oIframe, oLayer);
		}
		return oIframe;
	};

	//	private: set size and position of the Hider
	function _SetPos(oIframe, oLayer) {
		//	fetch and set size
		oIframe.style.width = oLayer.offsetWidth + "px";
		oIframe.style.height = oLayer.offsetHeight + "px";
		//	move to specified position
		oIframe.style.left = oLayer.offsetLeft + "px";
		oIframe.style.top = oLayer.offsetTop + "px";
	};

	//	private: returns object reference
	function _GetObj(vObj) {
		var oObj = null;
		switch( typeof(vObj) ) {
			case "object":
				oObj = vObj;
				break;
			case "string":
				oObj = document.getElementById(vObj);
				break;
		}
		return oObj;
	};

	//	private: setup properties on first call to Apply
	function _Setup() {
		_bIE55 = (typeof(document.body.contentEditable) != "undefined");
		_bIE6 = (typeof(document.compatMode) != "undefined");

		if (!_bIE55) {
			if (document.styleSheets.length == 0)
				document.createStyleSheet();
			var oSheet = document.styleSheets[0];
			oSheet.addRule(".WCHhider", "visibility:visible");
			_oRule = oSheet.rules(oSheet.rules.length-1);
		}

		_bSetup = false;
	};
};
var WCH = new WCH_Constructor();


// Cookie code from: http://www.netspade.com/articles/javascript/cookies.xml
function XsetCookie(name, value, expires, path) {
	if (expires) {
		var expireDate = new Date();
		expireDate.setTime(expireDate.getTime() + 3600000*24*expires);
	}
	document.cookie= name + "=" + escape(value) +
		((expires) ? "; expires=" + expireDate.toGMTString() : "") +
		((path) ? "; path=" + path : "");
}

function XgetCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	}
	else {
		begin += 2;
	}
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) {
		end = dc.length;
	}
	return unescape(dc.substring(begin + prefix.length, end));
}

function XdeleteCookie(name, path) {
	if (getCookie(name)) {
		document.cookie = name + "=" + 
			((path) ? "; path=" + path : "") +
			"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

function styles() {
	var font = XgetCookie('slty_font');
	var marg = XgetCookie('slty_marg');
	
/*	createDropShadows(); */

	if (font == null) {
		font = 's';
	}
	var sizes = new Array(
		'xs'
		,'s'
		,'m'
		,'l'
		,'xl'
	);
	if (marg == null) {
		marg = 'flex';
	}
	var margins = new Array(
		'fix'
		,'flex'
		,'full'
	);
	
// from alistapart.com
	var froot = '';
	for (i = 0; (a = document.getElementsByTagName("link")[i]); i++) {
		if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("href")) {
			a.rel = 'stylesheet';
			var fname = a.getAttribute("href");
			if (fname.indexOf('text-') != -1) {a.disabled = true;}
			if (fname.indexOf('text-' + font) != -1) {a.disabled = false;}
			if (fname.indexOf('marg-') != -1) {
				a.disabled = true;
				froot = fname.substring(0,fname.indexOf('marg-'));
			}
			if (fname.indexOf('marg-' + marg) != -1) {a.disabled = false;}
		}
	}
	
	var pNode = document.getElementById('font_size');
	pNode.innerHTML = '';
	
	for (var i = 0; i < sizes.length; i++) {
		var size = document.createElement('li');
			var link = document.createElement('a');
				var text = document.createElement('span');
				text.innerHTML = sizes[i];
			link.id = 'font_' + sizes[i];
			link.href = "javascript:void(setStyle('" + sizes[i] + "'));";
			if (font == sizes[i]) {
				link.className = 'selected';
			}
			link.appendChild(document.createTextNode('A'));
			link.appendChild(text);
		size.appendChild(link);
		pNode.appendChild(size);
	}

	var pNode = document.getElementById('margin_width');
	pNode.innerHTML = '';
	
	for (var i = 0; i < margins.length; i++) {
		var liMarg = document.createElement('li');
			var link = document.createElement('a');
				var img = document.createElement('img');
				img.src = froot+'images/'+margins[i]+'.gif';
				img.alt = margins[i];
				img.title=margins[i];
				img.id  = margins[i];
			link.id = 'marg_' + margins[i];
			link.href = "javascript:void(setMargin('" + margins[i] + "'));";
			if (marg == margins[i]) {
				img.className = 'selected';
			}
		link.appendChild(img);
		liMarg.appendChild(link);
		pNode.appendChild(liMarg);
	}

}

function setStyle(size) {
	urchinTracker('/pageSet/FontSize/'+size);
	XsetCookie('slty_font', size, 365, '/');
	styles();
}
function setMargin(marg) {
	urchinTracker('/pageSet/Margin/'+marg);
	XsetCookie('slty_marg', marg, 365, '/');
	styles();
}
/*------------------------------------
	Title: Cross-Browser Text Drop Shadows
	Author: Scott Jehl, www.scottjehl.com, scott@scottjehl.com
	Date: 7/19/06
http://creativecommons.org/licenses/by-nc-sa/2.5/
--------------------------------------*/

/*
addDomLoadEvent function from http://www.thefutureoftheweb.com/blog/2006/6/adddomloadevent
*/
function addDOMLoadEvent(func) { if (!window.__load_events) { var init = function () { if (arguments.callee.done) return; arguments.callee.done = true; if (window.__load_timer) { clearInterval(window.__load_timer); window.__load_timer = null;}
for (var i=0;i < window.__load_events.length;i++) { window.__load_events[i]();}
window.__load_events = null;}; if (document.addEventListener) { document.addEventListener("DOMContentLoaded", init, false);}
if (/WebKit/i.test(navigator.userAgent)) { window.__load_timer = setInterval(function() { if (/loaded|complete/.test(document.readyState)) { init();}
}, 10);}
window.onload = init; window.__load_events = [];}
window.__load_events.push(func);}



/*
getElementsByClass function (credit Dustin Diaz, www.dustindiaz.com)
ph: modify to find tags without classes if desired, and to only return elements with text inside
*/
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	if (searchClass == null ) {
		for (i = 0, j = 0; i < elsLen; i++) {
			if ( els[i].firstChild.nodeType==3 ) {
				classElements[j] = els[i];
				j++;
			}
		}
	} else {
		var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
		for (i = 0, j = 0; i < elsLen; i++) {
			if ( pattern.test(els[i].className) && els[i].firstChild.nodeType==3 ) {
				classElements[j] = els[i];
				j++;
			}
		}
	}
	return classElements;
}




/*
createDropShadows function 
*/

createDropShadows = function(){
//get all A tags
var highContrast = getElementsByClass(null,null,'A');
	for(i = 0; i < highContrast.length; i++){
		//current element
		var currentElement = highContrast[i];
		//current element's text
		var hcContent = currentElement.firstChild.data;
		//create a new span to replace the content text
		var contentSpan = document.createElement('span');
		var contentSpanText = document.createTextNode(hcContent);
		contentSpan.appendChild(contentSpanText);
		//create another span for the shadow text and give it the class "shadow1"
		var shadowSpan1 = document.createElement('span');
		var shadowSpanText1 = document.createTextNode(hcContent);
		shadowSpan1.appendChild(shadowSpanText1);
		shadowSpan1.className = "shadow1";
		//create a third span for the shadow text and give it the class "shadow2"
		var shadowSpan2 = document.createElement('span');
		var shadowSpanText2 = document.createTextNode(hcContent);
		shadowSpan2.appendChild(shadowSpanText2);
		shadowSpan2.className = "shadow2";
		//create one more span for the shadow text and give it the class "shadow3"
		var shadowSpan3 = document.createElement('span');
		var shadowSpanText3 = document.createTextNode(hcContent);
		shadowSpan3.appendChild(shadowSpanText3);
		shadowSpan3.className = "shadow3";
		
		//kill the original text and toss the spans in there with the content on top
		currentElement.firstChild.data = '';
		currentElement.appendChild(shadowSpan3);
		currentElement.appendChild(shadowSpan2);
		currentElement.appendChild(shadowSpan1);
		currentElement.appendChild(contentSpan);
	}
}

var e7FirstTabId;
function e7SetFirstTab() {
	var TabId = "e107FirstTab"; /* Use this id  on first form tab */
	e7FirstTabId = document.getElementById(TabId);
	if (typeof(e7FirstTabId) != "undefined" && e7FirstTabId != null) {
		self.focus();
		e7FirstTabId.focus();
	}
}
addDOMLoadEvent(e7SetFirstTab);
/* addDOMLoadEvent(createDropShadows); */
