/*
  MERLIX DEVELOPMENT LIBRARY
  ==========================
    This is a commercial software product. You may use it
    freely for testing on your local system. Any commercial
    use without a license is strictly prohibited.

  Copyright (C) 2003,2005 Merlix LLC/Graphix Omnimedia Group. All rights reserved.
*/



/* xWindow()
   Create an xWindow object for each child window the page will need.
   Pass a zero for width, height, left, and top and the window will
   have default size and position. Pass a zero or one for the boolean
   parameters (location field, menubar, etc.).
*/
function xWindow(name, w, h, x, y, loc, men, res, scr, sta, too)
{
  var f = '';
  if (w && h) {
    if (document.layers) f = 'screenX=' + x + ',screenY=' + y;
    else f = 'left=' + x + ',top=' + y;
    f += ',width=' + w + ',height=' + h + ',';
  }
  f += ('location='+loc+',menubar='+men+',resizable='+res
    +',scrollbars='+scr+',status='+sta+',toolbar='+too);
  this.features = f;
  this.name = name;
  this.load = function(sUrl) {
    //if (this.wnd && !this.wnd.closed) this.wnd.location.href = sUrl;
    //alert(1);
    this.wnd = window.open(sUrl, this.name, this.features);
    this.wnd.focus();
    return false;
  }
}

function xSlideTo(e,x,y,uTime) {
  if (!(e=documentX.getElementById(e))) return;
  if (!e.timeout) e.timeout = 25;
  e.xTarget = x; e.yTarget = y; e.slideTime = uTime; e.stop = false;
  e.yA = e.yTarget - documentX.elementTop(e); e.xA = e.xTarget - documentX.elementLeft(e); // A = distance
  e.B = Math.PI / (2 * e.slideTime); // B = period
  e.yD = documentX.elementTop(e); e.xD = documentX.elementLeft(e); // D = initial position
  var d = new Date(); e.C = d.getTime();
  if (!e.moving) xSlide(e);
}
function xSlide(e) {
  if (!(e=documentX.getElementById(e))) return;
  var now, s, t, newY, newX;
  now = new Date();
  t = now.getTime() - e.C;
  if (e.stop) { e.moving = false; }
  else if (t < e.slideTime) {
    setTimeout("xSlide('"+e.id+"')", e.timeout);
    s = Math.sin(e.B * t);
    newX = Math.round(e.xA * s + e.xD);
    newY = Math.round(e.yA * s + e.yD);
    documentX.moveElement(e, newX, newY);
    e.moving = true;
  }
  else {
    documentX.moveElement(e, e.xTarget, e.yTarget);
    e.moving = false;
  }
}

/* Event handling stuff
  Must be sorted out
*/


function xAddEventListener(e,eventType,eventListener,useCapture) {
  if(!(e=documentX.getElementById(e))) return;
  eventType=eventType.toLowerCase();
  if((!navigatorX.isIE4UP && !navigatorX.isOP7) && e==window) {
    if(eventType=='resize') { window.xPCW=documentX.clientWidth(); window.xPCH=documentX.clientHeight(); window.xREL=eventListener; xResizeEvent(); return; }
    if(eventType=='scroll') { window.xPSL=documentX.getScrollLeft(); window.xPST=documentX.getScrollTop(); window.xSEL=eventListener; xScrollEvent(); return; }
  }
  var eh='e.on'+eventType+'=eventListener';
  if(e.addEventListener) e.addEventListener(eventType,eventListener,useCapture);
  else if(e.attachEvent) e.attachEvent('on'+eventType,eventListener);
  else if(e.captureEvents) {
    if(useCapture||(eventType.indexOf('mousemove')!=-1)) { e.captureEvents(eval('Event.'+eventType.toUpperCase())); }
    eval(eh);
  }
  else eval(eh);
}
function xRemoveEventListener(e,eventType,eventListener,useCapture) {
  if(!(e=documentX.getElementById(e))) return;
  eventType=eventType.toLowerCase();
  if((!navigatorX.isIE4UP && !navigatorX.isOP7) && e==window) {
    if(eventType=='resize') { window.xREL=null; return; }
    if(eventType=='scroll') { window.xSEL=null; return; }
  }
  var eh='e.on'+eventType+'=null';
  if(e.removeEventListener) e.removeEventListener(eventType,eventListener,useCapture);
  else if(e.detachEvent) e.detachEvent('on'+eventType,eventListener);
  else if(e.releaseEvents) {
    if(useCapture||(eventType.indexOf('mousemove')!=-1)) { e.releaseEvents(eval('Event.'+eventType.toUpperCase())); }
    eval(eh);
  }
  else eval(eh);
}

function xEvent(evt) { // cross-browser event object prototype
  this.type = '';
  this.target = null;
  this.pageX = 0;
  this.pageY = 0;
  this.offsetX = 0;
  this.offsetY = 0;
  this.keyCode = 0;
  this.isxEvent = true;
  var e = evt ? evt : window.event;
  if(!e) return;
  if(e.type) this.type = e.type;
  if(e.target) this.target = e.target;
  else if(e.srcElement) this.target = e.srcElement;
  if(navigatorX.isOP5OR6) { this.pageX = e.clientX; this.pageY = e.clientY; }
  else if(utilsX.defined(e.clientX,e.clientY)) { this.pageX = e.clientX + documentX.getScrollLeft(); this.pageY = e.clientY + documentX.getScrollTop(); }
  if(utilsX.defined(e.offsetX,e.offsetY)) { this.offsetX = e.offsetX; this.offsetY = e.offsetY; }
  else { this.offsetX = this.pageX - documentX.elementX(this.target); this.offsetY = this.pageY - documentX.elementY(this.target); }
  if (e.keyCode) { this.keyCode = e.keyCode; } // for moz/fb, if keyCode==0 use which
  else if (utilsX.defined(e.which)) { this.keyCode = e.which; }
}

function xResizeEvent() { // window resize event simulation
  if (window.xREL) setTimeout('xResizeEvent()', 250);
  var cw = documentX.clientWidth(), ch = documentX.clientHeight();
  if (window.xPCW != cw || window.xPCH != ch) { window.xPCW = cw; window.xPCH = ch; if (window.xREL) window.xREL(); }
}

function xScrollEvent() { // window scroll event simulation
  if (window.xSEL) setTimeout('xScrollEvent()', 250);
  var sl = documentX.getScrollLeft(), st = documentX.getScrollTop();
  if (window.xPSL != sl || window.xPST != st) { window.xPSL = sl; window.xPST = st; if (window.xSEL) window.xSEL(); }
}



/* BEGIN MXHTML */

/*
  Class TmxHTMLEvents
    This sorts the events for the documentX.events object.
*/

function TmxHTMLEvents()
{
  // onloads array holds array of strings to be evaluated when
  // window loads
  this.onloads      = new Array();
  this.onresizes    = new Array();
  this.onmousemoves = new Array();
  this.onscrolls    = new Array();
  this.onclicks = new Array();
}

TmxHTMLEvents.prototype.addOnLoad = function(AOnLoadEvent) {
  this.onloads[this.onloads.length]=AOnLoadEvent;
}
TmxHTMLEvents.prototype.addOnClick = function(AOnClickEvent) {
  this.onclicks[this.onclicks.length]=AOnClickEvent;
}

TmxHTMLEvents.prototype.addOnResize = function(AOnResizeEvent) {
  this.onresizes[this.onresizes.length]=AOnResizeEvent;
}
TmxHTMLEvents.prototype.addOnMouseMove = function(AOnMouseMoveEvent) {
  this.onmousemoves[this.onmousemoves.length]=AOnMouseMoveEvent;
}
TmxHTMLEvents.prototype.addOnScroll = function(AOnScrollEvent) {
  this.onscrolls[this.onscrolls.length]=AOnScrollEvent;
}

TmxHTMLEvents.prototype.executeEvents = function(AEvents,oEvent)
{
  var i,aEvent;
  aEvent = new xEvent(oEvent);
  if (AEvents) {
    var seval;
    for (i=0;i<AEvents.length;++i) {
      seval = AEvents[i];
      if (utilsX.isString(seval) && (seval.length!=0)) {
        eval(seval);
      }
      else {
        if (!(utilsX.isString(seval))) {
          seval(aEvent);
        }
      }
    }
  }
}

TmxHTMLEvents.prototype.windowLoaded = function() {
  this.executeEvents(this.onloads,null);
  this.executeEvents(this.onresizes,null);
  this.executeEvents(this.onscrolls,null);
  this.executeEvents(this.onmousemoves,null);
  xAddEventListener(window, 'resize', mxHTML_WindowOnResize, false);
  xAddEventListener(document, 'mousemove', mxHTML_WindowOnMouseMove, false);
  xAddEventListener(window, 'scroll', mxHTML_WindowOnScroll, false);
  xAddEventListener(document, 'click', mxHTML_DocClick, false);
}

function mxHTML_DocClick(oEvent) {
  documentX.events.executeEvents(documentX.events.onclicks,oEvent);
}
function mxHTML_WindowOnResize(oEvent) {
  documentX.events.executeEvents(documentX.events.onresizes,oEvent);
}
function mxHTML_WindowOnScroll(oEvent) {
  documentX.events.executeEvents(documentX.events.onscrolls,oEvent);
}
function mxHTML_WindowOnMouseMove(oEvent) {
  documentX.events.executeEvents(documentX.events.onmousemoves,oEvent);
}

/*
  TWindowX object is a cross browser window object replacing
  the usual window object.
*/
function TWindowX() {
}

TWindowX.prototype.showHelp = function(AURL) {            
  var xw = new xWindow("windowXHelpWnd", 360, 420, 320, 20, 0, 0, 1, 1, 0, 0);
  xw.load(AURL);
}

TWindowX.prototype.open = function(url,name,features,replace) {
}

// Cross-Browser "navigator" object .
function TNavigatorX() {
  this.isNN4         = false;
  this.isOP7         = false;
  this.isOP5OR6      = false;
  this.isIE4Up       = false;
  this.isIE4         = false;
  this.isIE5         = false;
  this.isIE          = false;
  this.userAgent     = navigator.userAgent.toLowerCase();
  this.isIE = ((this.userAgent.indexOf('msie')!=-1) && (this.userAgent.indexOf('opera')==-1));
  if(window.opera){
    this.isOP7 = (this.userAgent.indexOf('opera 7')!=-1 || this.userAgent.indexOf('opera/7')!=-1);
    if (!this.userAgent) this.userAgent=(this.userAgent.indexOf('opera 5')!=-1 || this.userAgent.indexOf('opera/5')!=-1 || this.userAgent.indexOf('opera 6')!=-1 || this.userAgent.indexOf('opera/6')!=-1);
  }
  else if (document.all) {
    this.isIE4UP = this.userAgent.indexOf('msie')!=-1 && parseInt(navigator.appVersion)>=4;
    this.isIE4   = this.userAgent.indexOf('msie 4')!=-1;
    this.isIE5   = this.userAgent.indexOf('msie 5')!=-1;
  }
}

// _!METHOD: TDocumentX
// _!DESCRIPTION:
// Creates an instance of the TDocumentX class. You should never need to call this, as
// the documentX global object is always created just by including mxHTML.js.
function TDocumentX() // Cross Browser "Document" object
{
  this.events = new TmxHTMLEvents();
  this.utilWnd = null;
}

TDocumentX.prototype.windowLoaded = function() {
  this.events.windowLoaded();
}

// _!METHOD: setCookie
// _!DESCRIPTION:
// Sets a cookie for the current page.
TDocumentX.prototype.setCookie = function(name, value, expire, path) {
  document.cookie = name + "=" + escape(value) + ((!expire) ? "" : ("; expires=" + expire.toGMTString())) + "; path=/";
}

// _!METHOD: getCookie
// _!DESCRIPTION:
// Returns a cookie value for the current page.
TDocumentX.prototype.getCookie = function(name) {
  var value=null, search=name+"=";
  if (document.cookie.length > 0) {
    var offset = document.cookie.indexOf(search);
    if (offset != -1) {
      offset += search.length;
      var end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      value = unescape(document.cookie.substring(offset, end));
    }
  }
  return value;
}

// _!METHOD: getElementById
// _!DESCRIPTION:
// Returns an element from the document given it's id.
TDocumentX.prototype.getElementById = function(AElementId) {
  var result;
  if (typeof(AElementId)!='string') {
    return AElementId;
  }
  if (document.getElementById) {
    result=document.getElementById(AElementId);
  }
  else if(document.all) {
    result=document.all[AElementId];
  }
  else result=null;
  return result;
}

// _!METHOD: getElementsByTagName
// _!DESCRIPTION:
// Returns an array of elements which are
// descendants of parentEle and have tagName.
// If parentEle is null or not present, document will be used.
// if tagName is null or not present, "*" will be used.
TDocumentX.prototype.getElementsByTagName = function(tagName, AParentElement) {
  var fElements = null;
  tagName = tagName || '*';
  AParentElement = AParentElement || document;
  if (navigatorX.isIE4 || navigatorX.isIE5) {
    if (tagName == '*') fElements = AParentElement.all;
    else fElements = AParentElement.all.tags(tagName);
  }
  else if (AParentElement.getElementsByTagName) fElements = AParentElement.getElementsByTagName(tagName);
  return fElements || new Array();
}

// _!METHOD: getElementsById
// _!DESCRIPTION:
// Return element collection by id. Like in a form where you
// have many checkboxes with same id but with different values.
TDocumentX.prototype.getElementsById = function(Aid, AParentElement)
{
  var xCol = this.getElementsByTagName('');
  var fElements = new Array();
  var i;
  Aid = Aid || '*';
  if ((Aid!="*")) {
    for (i=0;i<xCol.length;++i) {
      if (xCol[i].id==Aid) {
        fElements[fElements.length] = xCol[i];
      }
    }
    return fElements;
  }
  else {
    return xCol;
  }
}


// _!METHOD: getElementsByClassName
// _!DESCRIPTION:
// Returns an array of elements which are
// descendants of parentEle and have tagName and clsName.
// If parentEle is null or not present, document will be used.
// if tagName is null or not present, "*" will be used.
TDocumentX.prototype.getElementsByClassName = function(clsName, parentEle, tagName) {
  var found = new Array();
  var re = new RegExp('\\b'+clsName+'\\b', 'i');
  var list = this.getElementsByTagName(tagName, parentEle);
  for (var i = 0; i < list.length; ++i) {
    if (list[i].className.search(re) != -1) {
      found[found.length] = list[i];
    }
  }
  return found;
}

// _!METHOD: getParentElement
// _!DESCRIPTION:
// Return a given elements parent element.
TDocumentX.prototype.getParentElement = function(e,bNode){
  if (!(e=this.getElementById(e))) return null;
  var p=null;
  if (!bNode && utilsX.defined(e.offsetParent)) p=e.offsetParent;
  else if (utilsX.defined(e.parentNode)) p=e.parentNode;
  else if (utilsX.defined(e.parentElement)) p=e.parentElement;
  return p;
}


// Appearance:

// _!METHOD: showElement
// _!DESCRIPTION:
// Sets an elements visibility property to visible.
TDocumentX.prototype.showElement = function(e) {
  if(!(e=this.getElementById(e))) return;
  if(e.style && utilsX.defined(e.style.visibility)) e.style.visibility='visible';
}
// _!METHOD: hideElement
// _!DESCRIPTION:
// Hides an element.
TDocumentX.prototype.hideElement = function(e) {
  if(!(e=this.getElementById(e))) return;
  if(e.style && utilsX.defined(e.style.visibility)) e.style.visibility='hidden';
}

// _!METHOD: moveElement
// _!DESCRIPTION:
// Positions element e at the x,y location specified by iX and iY.
TDocumentX.prototype.moveElement = function(e,iX,iY) {
  this.elementLeft(e,iX);
  this.elementTop(e,iY);
}

// _!METHOD: elementLeft
// _!DESCRIPTION:
// Returns the pixel position of an elements left most side.
TDocumentX.prototype.elementLeft = function(e,iX) {
if(!(e=this.getElementById(e))) return 0;
  var css=utilsX.defined(e.style);
  if (css && utilsX.isString(e.style.left)) {
    if(utilsX.isNumber(iX)) e.style.left=iX+'px';
    else {
      iX=parseInt(e.style.left);
      if(isNaN(iX)) iX=0;
    }
  }
  else if(css && utilsX.defined(e.style.pixelLeft)) {
    if(utilsX.isNumber(iX)) e.style.pixelLeft=iX;
    else iX=e.style.pixelLeft;
  }
  return iX;
}

// _!METHOD: elementTop
// _!DESCRIPTION:
// Returns the top position of an element.
TDocumentX.prototype.elementTop = function(e,iY) {
  if(!(e=this.getElementById(e))) return 0;
  var css=utilsX.defined(e.style);
  if(css && utilsX.isString(e.style.top)) {
    if(utilsX.isNumber(iY)) e.style.top=iY+'px';
    else {
      iY=parseInt(e.style.top);
      if(isNaN(iY)) iY=0;
    }
  }
  else if(css && utilsX.defined(e.style.pixelTop)) {
    if(utilsX.isNumber(iY)) e.style.pixelTop=iY;
    else iY=e.style.pixelTop;
  }
  return iY;
}
// _!METHOD: elementX
// _!DESCRIPTION:
// Returns the X position of an element on the page.
TDocumentX.prototype.elementX = function(e) {
  if (!(e=this.getElementById(e))) return 0;
  var x = 0;
  while (e) {
    if (utilsX.defined(e.offsetLeft)) x += e.offsetLeft;
    e = utilsX.defined(e.offsetParent) ? e.offsetParent : null;
  }
  return x;
}

// _!METHOD: elementY
// _!DESCRIPTION:
// Returns the Y position of an element on a page.
TDocumentX.prototype.elementY = function(e) {
  if (!(e=this.getElementById(e))) return 0;
  var y = 0;
  while (e) {
    if (utilsX.defined(e.offsetTop)) y += e.offsetTop;
    e = utilsX.defined(e.offsetParent) ? e.offsetParent : null;
  }
//  if (xOp7) return y - document.body.offsetTop; // v3.14, temporary hack for opera bug 130324
  return y;
}

// _!METHOD: elementWidth
// _!DESCRIPTION:
// Returns the width of an element in pixels.
TDocumentX.prototype.elementWidth = function(e,uW) {
  if(!(e=this.getElementById(e))) return 0;
  if (utilsX.isNumber(uW)) {
    if (uW<0) uW = 0;
    else uW=Math.round(uW);
  }
  else uW=0;
  var css=utilsX.defined(e.style);
  if(css && utilsX.defined(e.offsetWidth) && utilsX.isString(e.style.width)) {
    if(uW) this.setClientWidth(e, uW);
    uW=e.offsetWidth;
  }
  else if(css && utilsX.defined(e.style.pixelWidth)) {
    if(uW) e.style.pixelWidth=uW;
    uW=e.style.pixelWidth;
  }
  return uW;
}
// _!METHOD: elementHeight
// _!DESCRIPTION:
// Returns the height of an element in pixels.
TDocumentX.prototype.elementHeight = function(e,uH) {
  if(!(e=this.getElementById(e))) return 0;
  if (utilsX.isNumber(uH)) {
    if (uH<0) uH = 0;
    else uH=Math.round(uH);
  }
  else uH=0;
  var css=utilsX.defined(e.style);
  if(css && utilsX.defined(e.offsetHeight) && utilsX.isString(e.style.height)) {
    if(uH) this.setClientHeight(e, uH);
    uH=e.offsetHeight;
  }
  else if(css && utilsX.defined(e.style.pixelHeight)) {
    if(uH) e.style.pixelHeight=uH;
    uH=e.style.pixelHeight;
  }
  return uH;
}

// _!METHOD: elementOffsetLeft
// _!DESCRIPTION:
// Returns the elements left offset.
TDocumentX.prototype.elementOffsetLeft = function(e) {
  if (!(e=documentX.getElementById(e))) return 0;
  if (utilsX.defined(e.offsetLeft)) return e.offsetLeft;
  else return 0;
}
// _!METHOD: elementOffsetTop
// _!DESCRIPTION:
// Returns the elements to offset
TDocumentX.prototype.elementOffsetTop = function(e) {
  if (!(e=this.getElementById(e))) return 0;
  if (utilsX.defined(e.offsetTop)) return e.offsetTop;
  else return 0;
}
// _!METHOD: getScrollLeft
// _!DESCRIPTION:
// Returns the elements scroll left.
TDocumentX.prototype.getScrollLeft = function(e) {
  var offset=0;
  if (!(e=this.getElementById(e))) {
    if(document.documentElement && document.documentElement.scrollLeft) offset=document.documentElement.scrollLeft;
    else if(document.body && utilsX.defined(document.body.scrollLeft)) offset=document.body.scrollLeft;
  }
  else { if (utilsX.isNumber(e.scrollLeft)) offset = e.scrollLeft; }
  return offset;
}
// _!METHOD: getScrollTop
// _!DESCRIPTION:
// Returns the elements scroll top.
TDocumentX.prototype.getScrollTop = function(e) {
  var offset=0;
  if (!(e=this.getElementById(e))) {
    if(document.documentElement && document.documentElement.scrollTop) offset=document.documentElement.scrollTop;
    else if(document.body && utilsX.defined(document.body.scrollTop)) offset=document.body.scrollTop;
  }
  else { if (utilsX.isNumber(e.scrollTop)) offset = e.scrollTop; }
  return offset;
}
// _!METHOD: elementHasPoint
// _!DESCRIPTION:
// Returns true if a given point is inside an element.
TDocumentX.prototype.elementHasPoint = function(ele, iLeft, iTop, iClpT, iClpR, iClpB, iClpL) {
  if (!utilsX.isNumber(iClpT)){iClpT=iClpR=iClpB=iClpL=0;}
  else if (!utilsX.isNumber(iClpR)){iClpR=iClpB=iClpL=iClpT;}
  else if (!utilsX.isNumber(iClpB)){iClpL=iClpR; iClpB=iClpT;}
  var thisX = this.elementX(ele), thisY = this.elementY(ele);
  return (iLeft >= thisX + iClpL && iLeft <= thisX + this.elementWidth(ele) - iClpR &&
          iTop >=thisY + iClpT && iTop <= thisY + this.elementHeight(ele) - iClpB );
}

// _!METHOD: resizeElement
// _!DESCRIPTION:
// Resizes element e to the specified height and width.
TDocumentX.prototype.resizeElement = function(e,uW,uH) {
  this.elementWidth(e,uW);
  this.elementHeight(e,uH);
}
// _!METHOD: getComputedStyle
// _!DESCRIPTION:
// Returns the computed style for a given element ele.
TDocumentX.prototype.getComputedStyle = function(ele,sP) {
  return parseInt(document.defaultView.getComputedStyle(ele,'').getPropertyValue(sP));
}
// _!METHOD: setClientWidth
// _!DESCRIPTION:
// Sets the client width of element ele to width uW
TDocumentX.prototype.setClientWidth = function(ele,uW){
  var pl=0,pr=0,bl=0,br=0;
  if(utilsX.defined(document.defaultView) && utilsX.defined(document.defaultView.getComputedStyle)){
    pl=this.getComputedStyle(ele,'padding-left');
    pr=this.getComputedStyle(ele,'padding-right');
    bl=this.getComputedStyle(ele,'border-left-width');
    br=this.getComputedStyle(ele,'border-right-width');
  }
  else if(utilsX.defined(ele.currentStyle,document.compatMode)){
    if(document.compatMode=='CSS1Compat'){
      pl=parseInt(ele.currentStyle.paddingLeft);
      pr=parseInt(ele.currentStyle.paddingRight);
      bl=parseInt(ele.currentStyle.borderLeftWidth);
      br=parseInt(ele.currentStyle.borderRightWidth);
    }
  }
  else if(utilsX.defined(ele.offsetWidth,ele.style.width)){ // ?
    ele.style.width=uW+'px';
    pl=ele.offsetWidth-uW;
  }
  if(isNaN(pl)) pl=0; if(isNaN(pr)) pr=0; if(isNaN(bl)) bl=0; if(isNaN(br)) br=0;
  var cssW=uW-(pl+pr+bl+br);
  if(isNaN(cssW)||cssW<0) return;
  else ele.style.width=cssW+'px';
}
// _!METHOD: setClientHeight
// _!DESCRIPTION:
// Sets the client height of element ele.
TDocumentX.prototype.setClientHeight = function(ele,uH){
  var pt=0,pb=0,bt=0,bb=0;
  if(utilsX.defined(document.defaultView) && utilsX.defined(document.defaultView.getComputedStyle)){
    pt=this.getComputedStyle(ele,'padding-top');
    pb=this.getComputedStyle(ele,'padding-bottom');
    bt=this.getComputedStyle(ele,'border-top-width');
    bb=this.getComputedStyle(ele,'border-bottom-width');
  }
  else if(utilsX.defined(ele.currentStyle,document.compatMode)){
    if(document.compatMode=='CSS1Compat'){
      pt=parseInt(ele.currentStyle.paddingTop);
      pb=parseInt(ele.currentStyle.paddingBottom);
      bt=parseInt(ele.currentStyle.borderTopWidth);
      bb=parseInt(ele.currentStyle.borderBottomWidth);
    }
  }
  else if(utilsX.defined(ele.offsetHeight,ele.style.height)){ // ?
    ele.style.height=uH+'px';
    pt=ele.offsetHeight-uH;
  }
  if(isNaN(pt)) pt=0; if(isNaN(pb)) pb=0; if(isNaN(bt)) bt=0; if(isNaN(bb)) bb=0;
  var cssH=uH-(pt+pb+bt+bb);
  if(isNaN(cssH)||cssH<0) return;
  else ele.style.height=cssH+'px';
}

TDocumentX.prototype.utilWindow = function() {
}

// _!METHOD: showWindow
// _!DESCRIPTION:
// Handy utility function for showing a default window. It always has all toolbars
// and options enabled and is always 600 by 480 pixels in size.
TDocumentX.prototype.showWindow = function(loc) {
  var xWnd = new xWindow('xutilWnd', 600, 480, 20, 20, 1, 1, 1, 1, 1, 1);
  xWnd.load(loc);
}

// _!METHOD: showXWindow
// _!DESCRIPTION:
// Same as showWindow but disables the toolbar, menu and location bar.
TDocumentX.prototype.showXWindow = function(loc) {
  var xWnd = new xWindow('xutilWnd', 600, 480, 20, 20, 0, 0, 1, 1, 1, 0);
  xWnd.load(loc);
}

TDocumentX.prototype.setElementClip = function(e,iTop,iRight,iBottom,iLeft) {
  if(!(e=this.getElementById(e))) return;
  if(e.style) {
    if (utilsX.isNumber(iLeft)) e.style.clip='rect('+iTop+'px '+iRight+'px '+iBottom+'px '+iLeft+'px)';
    else e.style.clip='rect(0 '+parseInt(e.style.width)+'px '+parseInt(e.style.height)+'px 0)';
  }
}

// _!METHOD: clientWidth
// _!DESCRIPTION:
// Returns the visible client width of the browser.
TDocumentX.prototype.clientWidth = function() {
  var w=0;
  if(navigatorX.isOP5OR6) w=window.innerWidth;
  else if(!window.opera && document.documentElement && document.documentElement.clientWidth) // v3.12
    w=document.documentElement.clientWidth;
  else if(document.body && document.body.clientWidth)
    w=document.body.clientWidth;
  else if(utilsX.defined(window.innerWidth,window.innerHeight,document.height)) {
    w=window.innerWidth;
    if(document.height>window.innerHeight) w-=16;
  }
  return w;
}

// _!METHOD: clientHeight
// _!DESCRIPTION:
// Returns the client height of the browser in pixels.
TDocumentX.prototype.clientHeight = function() {
  var h=0;
  if (navigatorX.isOP5OR6) h=window.innerHeight;
  else if(!window.opera && document.documentElement && document.documentElement.clientHeight) // v3.12
    h=document.documentElement.clientHeight;
  else if(document.body && document.body.clientHeight)
    h=document.body.clientHeight;
  else if(utilsX.defined(window.innerWidth,window.innerHeight,document.width)) {
    h=window.innerHeight;
    if(document.width>window.innerWidth) h-=16;
  }
  return h;
}

// utility class
function TUtilsX() {
}

// _c!METHOD: isString
// _!DESCRIPTION:
// Returns true if the aVar parameter is a string.
TUtilsX.prototype.isString = function(aVar) {
  return typeof(aVar)=='string';
}
// _c!METHOD: isNumber
// _!DESCRIPTION:
// Returns true if the aVar parameter is a number
TUtilsX.prototype.isNumber = function(aVar) {
  return typeof(aVar)=='number';
}

// _c!METHOD: defined
// _!DESCRIPTION:
// Returns true if all the arguments are not undefined.
TUtilsX.prototype.defined = function() {
  for (var i=0; i<arguments.length; ++i) {
    if (typeof(arguments[i])=='undefined') {
      return false;
    }
  }
  return true;
}


  var utilsX      = new TUtilsX(); // Cross browser utility object
  var navigatorX  = new TNavigatorX(); // Cross browser navigator object
  var documentX   = new TDocumentX(); // Cross browser document object .
  var windowX     = new TWindowX(); // Cross browser document object .

  // initial onload handler
  function mxHTML_WindowOnLoad()
  {
    documentX.windowLoaded();
  }
  window.onload = mxHTML_WindowOnLoad;

  function mxHTML_undefined() {
    return false;
  }

  function mxpassive() {
    void('');
  }

      function selectAllOptions(AId,ASelected) {
        var x;
        var e = documentX.getElementById(AId);
        if (e) {
          for (x=0;x<e.length;x++) {
            //if (x < 5) {
            //  alert(1);
           // }
            e.options[x].selected = ASelected;
          }
        }
      }


/* END MXHTML */

