/* cbe_core.js $Revision: 0.22 $
 * CBE v4.19, Cross-Browser DHTML API from Cross-Browser.com
 * Copyright (c) 2002 Michael Foster (mike@cross-browser.com)
 * Distributed under the terms of the GNU LGPL from gnu.org
*/
var cbeVersion="4.19", cbeDocumentId='idDocument', cbeWindowId='idWindow', cbeAll=new Array();
window.onload=function(){cbeInitialize("DIV", "SPAN", "A"); if (window.windowOnload) window.windowOnload();}
window.onunload=function(){if(window.windowOnunload){window.windowOnunload();}if(window.cbeDebugObj){window.cbeDebugObj=null;}for(var i=0; i<cbeAll.length; i++){if(cbeAll[i]){if(cbeAll[i].ele){if(cbeAll[i].ele.cbe){cbeAll[i].ele.cbe=null;}cbeAll[i].ele=null;}cbeAll[i]=null;}}}
function CrossBrowserNode(){this.parentNode=null; this.childNodes=0; this.firstChild=null; this.lastChild=null; this.previousSibling=null; this.nextSibling=null;}
CrossBrowserNode.prototype.appendNode=function(cbeChild){if (cbeChild){if (!this.firstChild){this.firstChild=cbeChild;} else{cbeChild.previousSibling=this.lastChild; this.lastChild.nextSibling=cbeChild;}cbeChild.parentNode=this; this.lastChild=cbeChild; ++this.childNodes;}return cbeChild;}
CrossBrowserElement.prototype=new CrossBrowserNode;
function CrossBrowserElement(){
  this.contains=this.left=this.top=this.offsetLeft=this.offsetTop=this.pageX=this.pageY=this.zIndex=_retZero;
  this.show=this.hide=this.moveTo=this.moveBy=this.sizeTo=this.sizeBy=this.resizeTo=this.resizeBy=_retVoid;
  this.visibility=this.color=this.background=this.clip=this.innerHtml=_retEStr;
  if (cbeAll.length < 2){this.width=cbeInnerWidth; this.height=cbeInnerHeight; this.scrollLeft=cbePageXOffset; this.scrollTop=cbePageYOffset;}
  else{this.width=this.height=this.scrollLeft=this.scrollTop=_retZero;}
  this.id=""; this.index=cbeAll.length; cbeAll[this.index]=this; this.w=this.h=0; this.x=this.y=0;
  if (window.cbeEventJsLoaded) this.listeners=new Array();
}
function cbeBindElement(cbe, ele){
  if (!cbe || !ele) return;
  cbe.ele=ele; cbe.ele.cbe=cbe; cbe.parentElement=cbeGetParentElement(ele);
  if (ele==window){cbe.id=ele.id=cbeWindowId; return;} else if (ele==document){cbe.id=ele.id=cbeDocumentId; return;} else{cbe.id=ele.id;}
  if (_def(ele.clip)){cbe.w=ele.clip.width; cbe.h=ele.clip.height;}
  var css=_def(ele.style);
  // width, height
  cbe.width=_domWidth; cbe.height=_domHeight;
  // visibility
  cbe.show=_cbeShow; cbe.hide=_cbeHide; if (css && _def(ele.style.visibility)){cbe.visibility=_domVisibility;} else if (_def(ele.visibility)){cbe.visibility=_nnVisibility;} else{_sup(false,"visibility","show","hide");}
  // offsetLeft, offsetTop
  if (_def(ele.offsetLeft, ele.offsetTop, ele.offsetParent)){cbe.offsetLeft=_ieOffsetLeft; cbe.offsetTop=_ieOffsetTop;}else if (_def(ele.pageX, ele.pageY)){cbe.offsetLeft=_nnOffsetLeft; cbe.offsetTop=_nnOffsetTop;}else{_sup(false,"offsetLeft","offsetTop");}
  // pageX, pageY
  cbe.contains=_cbeContains; if (_def(ele.pageX, ele.pageY)){cbe.pageX=_nnPageX; cbe.pageY=_nnPageY;}else if (document.cbe.isSupported("offsetLeft")){cbe.pageX=_cbePageX; cbe.pageY=_cbePageY;}else{_sup(false,"pageX","pageY","contains");}
  // scrollLeft, scrollTop
  if (_def(ele.scrollLeft, ele.scrollTop)){cbe.scrollLeft=_cbeScrollLeft; cbe.scrollTop=_cbeScrollTop;}else{_sup(false,"scrollLeft","scrollTop");}
}
function cbeInitialize(sTagNames){
  var t,i,ele,eleList,cbe;
  cbe=new CrossBrowserElement(window);
  cbeBindElement(cbe, window);
  cbe=new CrossBrowserElement(document);
  cbeBindElement(cbe, document);
  if (!document.getElementById) document.getElementById=cbeGetElementById;
  document.cbe.isSupported=_cbeIsSupported;
  document.cbe.supported=new Array();
  _sup(true,"left","top","width","height","zIndex","show","hide","visibility","background","color","clip","offsetLeft","offsetTop","pageX","pageY","innerHtml","scrollLeft","scrollTop","moveTo","moveBy","sizeTo","sizeBy","resizeTo","resizeBy","contains");
  for (t=0; t < arguments.length; ++t){
    eleList=cbeGetElementsByTagName(arguments[t]);
    for (i=0; i < eleList.length; ++i){
      ele=eleList[i];
      if ( ele.id && ele.id !=""){
        cbe=new CrossBrowserElement();
        cbeBindElement(cbe, ele);
     }
   }
    if (document.layers) break;
 }
  _cbeCreateTree();
  if (window.cbeEventJsLoaded && (document.layers || is.opera5or6)){window.cbe.addEventListener("resize", cbeDefaultResizeListener);}
}
function _cbeIsSupported(sMethods){var i; for (i=0; i<arguments.length; ++i){if (!document.cbe.supported[arguments[i]]) return false;}return true;}
function _sup(bValue, sMethods){var i; for (i=1; i<arguments.length; ++i) document.cbe.supported[arguments[i]]=bValue;}
function _cbeCreateTree(){var parent; for (var i=1; i < cbeAll.length; ++i){parent=cbeAll[i].parentElement; if (!parent.cbe){while (parent && !parent.cbe){parent=cbeGetParentElement(parent);}if (!parent) parent=document;}parent.cbe.appendNode(cbeAll[i]);}}
function cbeGetElementById(sId){var ele=null; if (sId==window.cbeWindowId) ele=window; else if (sId==window.cbeDocumentId) ele=document; else if (is.dom1getbyid) ele=document.getElementById(sId); else if (document.all) ele=document.all[sId]; else if (document.layers) ele=nnGetElementById(sId); if (!ele && window.cbeUtilJsLoaded){ele=cbeGetImageByName(sId); if (!ele){ele=cbeGetFormByName(sId);}} return ele;}
function cbeGetElementsByTagName(sTagName){
  var eleList;
  if (document.getElementsByTagName) eleList=document.getElementsByTagName(sTagName); // standard
  else if (document.body && document.body.getElementsByTagName) eleList=document.body.getElementsByTagName(sTagName); // opera5or6
  return eleList;
}
function cbeGetParentElement(child){
  var parent=document;
  if (child==window) parent=null;
  else if (child==document) parent=window;
  else{
    if (child.parentNode) parent=child.parentNode;
    else if (child.offsetParent) parent=child.offsetParent;
    else if (child.parentElement) parent=child.parentElement;
 }
  return parent;
}
function _def(){var i; for (i=0; i<arguments.length; ++i){if (typeof(arguments[i])=="" || typeof(arguments[i])=="undefined") return false;}return true;}
function _retZero(){return 0;}
function _retNull(){return null;}
function _retEStr(){return "";}
function _retVoid(){}
////// when optimizing, don't remove anything above this comment //////
function _cbeContains(iLeft, iTop, iClipTop, iClipRight, iClipBottom, iClipLeft){
    if (arguments.length==2){
         iClipTop=iClipRight=iClipBottom=iClipLeft=0;
    } else if (arguments.length==3){
         iClipRight=iClipBottom=iClipLeft=iClipTop;
    } else if (arguments.length==4){
         iClipLeft=iClipRight; iClipBottom=iClipTop;
    }
    var thisX=this.offsetLeft(), thisY=this.offsetTop();
    return ( iLeft >=thisX + iClipLeft && 
             iLeft <=thisX + this.width() - iClipRight && 
             iTop >=thisY + iClipTop && 
             iTop <=thisY + this.height() - iClipBottom 
    );
}
function _domLeft(iX){if (arguments.length){this.ele.style.left=iX + "px";} else{iX=parseInt(this.ele.style.left); if (isNaN(iX)) iX=0;}return iX;}
function _ieLeft(iX){if (arguments.length){this.ele.style.pixelLeft=iX;} else{iX=this.ele.style.pixelLeft;} return iX;}
function _nnLeft(iX){if (arguments.length){this.ele.left=iX;} else{iX=this.ele.left;} return iX;}
function _domTop(iY){if (arguments.length){this.ele.style.top=iY + "px";} else{iY=parseInt(this.ele.style.top); if (isNaN(iY)) iY=0;}return iY;}
function _ieTop(iY){if (arguments.length){this.ele.style.pixelTop=iY;} else{iY=this.ele.style.pixelTop;} return iY;}
function _nnTop(iY){if (arguments.length){this.ele.top=iY;} else{iY=this.ele.top;} return iY;}
function _nnOffsetLeft(){var ol=this.ele.pageX - this.parentElement.pageX; if (isNaN(ol)){ol=this.ele.pageX;} return ol;}
function _nnOffsetTop(){var ot=this.ele.pageY - this.parentElement.pageY; if (isNaN(ot)){ot=this.ele.pageY;} return ot;}
function _ieOffsetLeft(){
    var x=this.ele.offsetLeft, parent=this.ele.offsetParent;
    while(parent){
        x +=parent.offsetLeft;
        parent=parent.offsetParent;
    }
    return x;
}
function _ieOffsetTop(){
    var y=this.ele.offsetTop, parent=this.ele.offsetParent;
    while(parent){
        y +=parent.offsetTop;
        parent=parent.offsetParent;
    }
    return y;
}
function _nnPageX(){return this.ele.pageX;}
function _nnPageY(){return this.ele.pageY;}
function _cbePageX(){var x=this.offsetLeft(), parent=this.parentNode; if (parent){while(parent.index > 1){x +=parent.offsetLeft(); parent=parent.parentNode;}} return x;}
function _cbePageY(){var y=this.offsetTop(), parent=this.parentNode; if (parent){while(parent.index > 1){y +=parent.offsetTop(); parent=parent.parentNode;}} return y;}
function _domWidth(uW){if (arguments.length){uW=Math.round(uW); _domSetWidth(this.ele, uW);}return this.ele.offsetWidth;}
function _domHeight(uH){if (arguments.length){uH=Math.round(uH); _domSetHeight(this.ele, uH);}return this.ele.offsetHeight;}
function _domSetWidth(ele,uW){
  if (uW < 0) return;
  var pl=0,pr=0,bl=0,br=0;
  if (_def(document.defaultView) && _def(document.defaultView.getComputedStyle)){// gecko and standard
    pl=parseInt(document.defaultView.getComputedStyle(ele, "").getPropertyValue("padding-left"));
    pr=parseInt(document.defaultView.getComputedStyle(ele, "").getPropertyValue("padding-right"));
    bl=parseInt(document.defaultView.getComputedStyle(ele, "").getPropertyValue("border-left-width"));
    br=parseInt(document.defaultView.getComputedStyle(ele, "").getPropertyValue("border-right-width"));
 }
  else if (_def(ele.currentStyle, document.compatMode)){
    if (document.compatMode=="CSS1Compat"){// ie6up in css1compat mode
      pl=parseInt(ele.currentStyle.paddingLeft);
      pr=parseInt(ele.currentStyle.paddingRight);
      bl=parseInt(ele.currentStyle.borderLeftWidth);
      br=parseInt(ele.currentStyle.borderRightWidth);
   }
 }
  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;
  ele.style.width=cssW + "px";
}
function _domSetHeight(ele,uH){
  if (uH < 0) return;
  var pt=0,pb=0,bt=0,bb=0;
  if (_def(document.defaultView) && _def(document.defaultView.getComputedStyle)){
    pt=parseInt(document.defaultView.getComputedStyle(ele, "").getPropertyValue("padding-top"));
    pb=parseInt(document.defaultView.getComputedStyle(ele, "").getPropertyValue("padding-bottom"));
    bt=parseInt(document.defaultView.getComputedStyle(ele, "").getPropertyValue("border-top-width"));
    bb=parseInt(document.defaultView.getComputedStyle(ele, "").getPropertyValue("border-bottom-width"));
 }
  else if (_def(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);
   }
 }
  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;
  ele.style.height=cssH + "px";
}
function _cbeScrollLeft(){return this.ele.scrollLeft;}
function _cbeScrollTop(){return this.ele.scrollTop;}
function _cbeShow(){this.visibility(1);}
function _cbeHide(){this.visibility(0);}
function _domVisibility(vis){if (arguments.length){if (vis){this.ele.style.visibility='inherit';} else{this.ele.style.visibility='hidden';}}else return (this.ele.style.visibility=='visible' || this.ele.style.visibility=='inherit' || this.ele.style.visibility=='');}
function _nnVisibility(vis){if (arguments.length){if (vis){this.ele.visibility='inherit';} else{this.ele.visibility='hide';}}else return (this.ele.visibility=='show' || this.ele.visibility=='inherit' || this.ele.visibility=='');}
function cbeInnerWidth(){
  var w=0;
  if (is.opera5or6){w=window.innerWidth;}
  else if (is.ie && document.documentElement && document.documentElement.clientWidth) w=document.documentElement.clientWidth; // ie6 compat mode
  else if (document.body && document.body.clientWidth) w=document.body.clientWidth; // ie4up and gecko
  else if (_def(window.innerWidth,window.innerHeight,document.height)){// nn4
    w=window.innerWidth;
    if (document.height > window.innerHeight) w -=16;
 }
  return w;
}
function cbeInnerHeight(){
  var h=0;
  if (is.opera5or6){h=window.innerHeight;}
  else if (is.ie && document.documentElement && document.documentElement.clientHeight) h=document.documentElement.clientHeight;
  else if (document.body && document.body.clientHeight) h=document.body.clientHeight;
  else if (_def(window.innerWidth,window.innerHeight,document.width)){
    h=window.innerHeight;
    if (document.width > window.innerWidth) h -=16;
 }
  return h;
}
function cbePageXOffset(){
  var offset=0;
  if (_def(window.pageXOffset)) offset=window.pageXOffset; // gecko, nn4, opera
  else if (document.documentElement && document.documentElement.scrollLeft) offset=document.documentElement.scrollLeft; // ie6 compat mode
  else if (document.body && _def(document.body.scrollLeft)) offset=document.body.scrollLeft; // ie4up
  return offset;
}
function cbePageYOffset(){
  var offset=0;
  if (_def(window.pageYOffset)) offset=window.pageYOffset;
  else if (document.documentElement && document.documentElement.scrollTop) offset=document.documentElement.scrollTop;
  else if (document.body && _def(document.body.scrollTop)) offset=document.body.scrollTop;
  return offset;
}
function cbeEval(exp, arg1, arg2, arg3, arg4, arg5, arg6){
  if (typeof(exp)=="function") exp(arg1, arg2, arg3, arg4, arg5, arg6);
  else if (typeof(exp)=="object" && typeof(arg1)=="function") {
    exp._cbeEval_ = arg1;
    exp._cbeEval_(arg2, arg3, arg4, arg5, arg6);
  }  
  else if (typeof(exp)=="string") eval(exp);
}
function ClientSnifferJr(){
  this.ua=navigator.userAgent.toLowerCase();
  this.major=parseInt(navigator.appVersion);
  this.minor=parseFloat(navigator.appVersion);
  if (document.addEventListener && document.removeEventListener) this.dom2events=true;
  if (document.getElementById) this.dom1getbyid=true;
  if (window.opera){
    this.opera=true;
    this.opera6=(this.ua.indexOf("opera 6") !=-1 || this.ua.indexOf("opera/6") !=-1);
    this.opera5or6=this.opera5 || this.opera6;
    this.opera7=(this.ua.indexOf("opera 7") !=-1 || this.ua.indexOf("opera/7") !=-1);
    return;
 }
  this.konq=this.ua.indexOf('konqueror') !=-1;
  this.ie=this.ua.indexOf('msie') !=-1;
  if (this.ie){
   this.ie5=(this.major==4 && this.ua.indexOf('msie 5.0') !=-1);
    this.ie5up=!this.ie3 && !this.ie4;
    this.ie6=(this.major==4 && this.ua.indexOf('msie 6.0') !=-1);
    this.ie6up=(!this.ie3 && !this.ie4 && !this.ie5 && this.ua.indexOf("msie 5.5")==-1);
    return;
 }
  // Gecko, NN4, and NS6
  this.gecko=this.ua.indexOf('gecko') !=-1;
  this.nav=(this.ua.indexOf('mozilla') !=-1 && this.ua.indexOf('spoofer')==-1 && this.ua.indexOf('compatible')==-1);
  if (this.nav){
    this.nav5up=this.major >=5;
    this.nav6=this.major==5;
    this.nav6up=this.nav5up;
 }
}
window.is=new ClientSnifferJr();
// End cbe_core.js
