var xOp7Up,xOp6Dn,xIE4Up,xIE4,xIE5,xNN4,xUA=navigator.userAgent.toLowerCase();
if(window.opera){
  var i=xUA.indexOf('opera');
  if(i!=-1){
    var v=parseInt(xUA.charAt(i+6));
    xOp7Up=v>=7;
    xOp6Dn=v<7;
  }
}
else if(navigator.vendor!='KDE' && document.all && xUA.indexOf('msie')!=-1){
  xIE4Up=parseFloat(navigator.appVersion)>=4;
  xIE4=xUA.indexOf('msie 4')!=-1;
  xIE5=xUA.indexOf('msie 5')!=-1;
}
else if(document.layers){xNN4=true;}
xMac=xUA.indexOf('mac')!=-1;

/////////////////////////////////////////////////////////////////////////////////////
function show_caption(evt, captionString)
{
	var e = evt || window.event;
	if(e.target) var target = e.target;
	else if(e.srcElement)var target = e.srcElement;
	temp_caption=document.getElementById("d_caption");
	var pageX, pageY;
	if(xOp6Dn) { pageX = e.clientX; pageY = e.clientY; }
	else if(xDef(e.pageX,e.pageY)) { pageX = e.pageX; pageY = e.pageY; }
	else if(xDef(e.clientX,e.clientY)) { pageX = e.clientX + xScrollLeft(); pageY = e.clientY + xScrollTop(); }
	xMoveTo(temp_caption, pageX+5, pageY+5);
	temp_caption.innerHTML=captionString;
	temp_caption.style.display="block";
}

function hide_caption()
{
	temp_caption=document.getElementById("d_caption");
	temp_caption.innerHTML="";
	temp_caption.style.display="none";
}
/////////////////////////////////////////////////////////////////////////////////////
function BMpage(siteUrl)
{
	if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion >= "4.0")
	{
		window.external.AddFavorite(siteUrl,document.title)
	}
	else
	{
		window.alert("Click 'Ok' and then press 'Ctrl+D' to enter this website to your bookmarks.")
	}
}
 
 /////////////////////////////////////////////////////////////////////////////////////
function xGetElementById(e)
{
  if(typeof(e)!='string') return e;
  if(document.getElementById) e=document.getElementById(e);
  else if(document.all) e=document.all[e];
  else e=null;
  return e;
}
////////////////////////////////////////////////////////////////////////////////
function xGetComputedStyle(oEle, sProp, bInt)
{
  var s, p = 'undefined';
  var dv = document.defaultView;
  if(dv && dv.getComputedStyle){
    s = dv.getComputedStyle(oEle,'');
    if (s) p = s.getPropertyValue(sProp);
  }
  else if(oEle.currentStyle) {
    // convert css property name to object property name for IE
    var a = sProp.split('-');
    sProp = a[0];
    for (var i=1; i<a.length; ++i) {
      c = a[i].charAt(0);
      sProp += a[i].replace(c, c.toUpperCase());
    }   
    p = oEle.currentStyle[sProp];
  }
  else return null;
  return bInt ? (parseInt(p) || 0) : p;
}
/////////////////////////////////////////////////////////////////////////////////////
function xMoveTo(e,x,y)
{
  if(x) xLeft(e,x);
  if(y) xTop(e,y);
}
/////////////////////////////////////////////////////////////////////////////////////

function xResizeTo(e,w,h)
{
	if(w) xWidth(e,w);
    if(h) xHeight(e,h);
}
/////////////////////////////////////////////////////////////////////////////////////
function xLeft(e, iX)
{
  if(!(e=xGetElementById(e))) return 0;
  var css=xDef(e.style);
  if (css && xStr(e.style.left)) {
    if(xNum(iX)) e.style.left=iX+'px';
    else {
      iX=parseInt(e.style.left);
      if(isNaN(iX)) iX=0;
    }
  }
  else if(css && xDef(e.style.pixelLeft)) {
    if(xNum(iX)) e.style.pixelLeft=iX;
    else iX=e.style.pixelLeft;
  }
  return iX;
}
////////////////////////////////////////////////////////////////////////////////
function xTop(e, iY)
{
  if(!(e=xGetElementById(e))) return 0;
  var css=xDef(e.style);
  if(css && xStr(e.style.top)) {
    if(xNum(iY)) e.style.top=iY+'px';
    else {
      iY=parseInt(e.style.top);
      if(isNaN(iY)) iY=0;
    }
  }
  else if(css && xDef(e.style.pixelTop)) {
    if(xNum(iY)) e.style.pixelTop=iY;
    else iY=e.style.pixelTop;
  }
  return iY;
}
////////////////////////////////////////////////////////////////////////////////
function xWidth(e,w)
{
  if(!(e=xGetElementById(e))) return 0;
  if (xNum(w)) {
    if (w<0) w = 0;
    else w=Math.round(w);
  }
  else w=-1;
  var css=xDef(e.style);
  if (e == document || e.tagName.toLowerCase() == 'html' || e.tagName.toLowerCase() == 'body') {
    w = xClientWidth();
  }
  else if(css && xDef(e.offsetWidth) && xStr(e.style.width)) {
    if(w>=0) {
      var pl=0,pr=0,bl=0,br=0;
      if (document.compatMode=='CSS1Compat') {
        var gcs = xGetComputedStyle;
        pl=gcs(e,'padding-left',1);
        if (pl !== null) {
          pr=gcs(e,'padding-right',1);
          bl=gcs(e,'border-left-width',1);
          br=gcs(e,'border-right-width',1);
        }
        // Should we try this as a last resort?
        // At this point getComputedStyle and currentStyle do not exist.
        else if(xDef(e.offsetWidth,e.style.width)){
          e.style.width=w+'px';
          pl=e.offsetWidth-w;
        }
      }
      w-=(pl+pr+bl+br);
      if(isNaN(w)||w<0) return;
      else e.style.width=w+'px';
    }
    w=e.offsetWidth;
  }
  else if(css && xDef(e.style.pixelWidth)) {
    if(w>=0) e.style.pixelWidth=w;
    w=e.style.pixelWidth;
  }
  return w;
}
////////////////////////////////////////////////////////////////////////////////
function xHeight(e,h)
{
  if(!(e=xGetElementById(e))) return 0;
  if (xNum(h)) {
    if (h<0) h = 0;
    else h=Math.round(h);
  }
  else h=-1;
  var css=xDef(e.style);
  if (e == document || e.tagName.toLowerCase() == 'html' || e.tagName.toLowerCase() == 'body') {
    h = xClientHeight();
  }
  else if(css && xDef(e.offsetHeight) && xStr(e.style.height)) {
    if(h>=0) {
      var pt=0,pb=0,bt=0,bb=0;
      if (document.compatMode=='CSS1Compat') {
        var gcs = xGetComputedStyle;
        pt=gcs(e,'padding-top',1);
        if (pt !== null) {
          pb=gcs(e,'padding-bottom',1);
          bt=gcs(e,'border-top-width',1);
          bb=gcs(e,'border-bottom-width',1);
        }
        // Should we try this as a last resort?
        // At this point getComputedStyle and currentStyle do not exist.
        else if(xDef(e.offsetHeight,e.style.height)){
          e.style.height=h+'px';
          pt=e.offsetHeight-h;
        }
      }
      h-=(pt+pb+bt+bb);
      if(isNaN(h)||h<0) return;
      else e.style.height=h+'px';
    }
    h=e.offsetHeight;
  }
  else if(css && xDef(e.style.pixelHeight)) {
    if(h>=0) e.style.pixelHeight=h;
    h=e.style.pixelHeight;
  }
  return h;
}
////////////////////////////////////////////////////////////////////////////////
function xClientWidth()
{
  var w=0;
  if(xOp6Dn) w=window.innerWidth;
  else if(document.compatMode == 'CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientWidth)
    w=document.documentElement.clientWidth;
  else if(document.body && document.body.clientWidth)
    w=document.body.clientWidth;
  else if(xDef(window.innerWidth,window.innerHeight,document.height)) {
    w=window.innerWidth;
    if(document.height>window.innerHeight) w-=16;
  }
  return w;
}

////////////////////////////////////////////////////////////////////////////////

function xClientHeight()
{
  var h=0;
  if(xOp6Dn) h=window.innerHeight;
  else if(document.compatMode == 'CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientHeight)
    h=document.documentElement.clientHeight;
  else if(document.body && document.body.clientHeight)
    h=document.body.clientHeight;
  else if(xDef(window.innerWidth,window.innerHeight,document.width)) {
    h=window.innerHeight;
    if(document.width>window.innerWidth) h-=16;
  }
  return h;
}
////////////////////////////////////////////////////////////////////////////////
function xScrollLeft(e, bWin)
{
  var offset=0;
  if (!xDef(e) || bWin || e == document || e.tagName.toLowerCase() == 'html' || e.tagName.toLowerCase() == 'body') {
    var w = window;
    if (bWin && e) w = e;
    if(w.document.documentElement && w.document.documentElement.scrollLeft) offset=w.document.documentElement.scrollLeft;
    else if(w.document.body && xDef(w.document.body.scrollLeft)) offset=w.document.body.scrollLeft;
  }
  else {
    e = xGetElementById(e);
    if (e && xNum(e.scrollLeft)) offset = e.scrollLeft;
  }
  return offset;
}
////////////////////////////////////////////////////////////////////////////////
function xScrollTop(e, bWin)
{
  var offset=0;
  if (!xDef(e) || bWin || e == document || e.tagName.toLowerCase() == 'html' || e.tagName.toLowerCase() == 'body') {
    var w = window;
    if (bWin && e) w = e;
    if(w.document.documentElement && w.document.documentElement.scrollTop) offset=w.document.documentElement.scrollTop;
    else if(w.document.body && xDef(w.document.body.scrollTop)) offset=w.document.body.scrollTop;
  }
  else {
    e = xGetElementById(e);
    if (e && xNum(e.scrollTop)) offset = e.scrollTop;
  }
  return offset;
}
////////////////////////////////////////////////////////////////////////////////
function xPageX(e)
{
  if (!(e=xGetElementById(e))) return 0;
  var x = 0;
  while (e) {
    if (xDef(e.offsetLeft)) x += e.offsetLeft;
    e = xDef(e.offsetParent) ? e.offsetParent : null;
  }
  return x;
}
////////////////////////////////////////////////////////////////////////////////
function xPageY(e)
{
  if (!(e=xGetElementById(e))) return 0;
  var y = 0;
  while (e) {
    if (xDef(e.offsetTop)) y += e.offsetTop;
    e = xDef(e.offsetParent) ? e.offsetParent : null;
  }
//  if (xOp7Up) return y - document.body.offsetTop; // v3.14, temporary hack for opera bug 130324 (reported 1nov03)
  return y;
}
////////////////////////////////////////////////////////////////////////////////
function xPreventDefault(e)
{
  if (e && e.preventDefault) e.preventDefault();
  else if (window.event) window.event.returnValue = false;
}
////////////////////////////////////////////////////////////////////////////////
function xDef()
{
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}
  return true;
}
////////////////////////////////////////////////////////////////////////////////
function xStr(s)
{
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])!='string') return false;}
  return true;
}
////////////////////////////////////////////////////////////////////////////////
function xNum()
{
  for(var i=0; i<arguments.length; ++i){if(isNaN(arguments[i]) || typeof(arguments[i])!='number') return false;}
  return true;
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
function xSlideTo(e, x, y, uTime, eposition, eclass, estatement)
{
  if (!(e=xGetElementById(e))) return;
  if (!e.timeout) e.timeout = 5;
  e.s_position=eposition;
  e.s_class=eclass;
  e.s_statement=estatement;
  e.xTarget = x; e.yTarget = y; e.slideTime = uTime; e.stop = false;
  e.yA = e.yTarget - xTop(e); e.xA = e.xTarget - xLeft(e); // A = distance
  if (e.slideLinear) e.B = 1/e.slideTime;
  else e.B = Math.PI / (2 * e.slideTime); // B = period
  e.yD = xTop(e); e.xD = xLeft(e); // D = initial position
  var d = new Date(); e.C = d.getTime();
  if (!e.moving) _xSlideTo(e);
}
function _xSlideTo(e)
{
  if (!(e=xGetElementById(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("_xSlideTo('"+e.id+"')", e.timeout);
    if (e.slideLinear) s = e.B * t;
    else s = Math.sin(e.B * t);
    newX = Math.round(e.xA * s + e.xD);
    newY = Math.round(e.yA * s + e.yD);
    xMoveTo(e, newX, newY);
    e.moving = true;
  }  
  else {
    xMoveTo(e, e.xTarget, e.yTarget);
    e.moving = false;
	if(e.s_position)
		e.style.position=e.s_position;
	if(e.s_class)
		e.className=e.s_class;
	if(e.s_statement)
	{
		eval(e.s_statement);
	}
  }  
}
////////////////////////////////////////////////////////////////////////////////
function xResizeToAnimated(e2, x2, y2, uTime2, e2position, e2class, e2statement)
{
  if (!(e2=xGetElementById(e2))) return;
  if (!e2.timeout) e2.timeout = 5;
  e2.s_position=e2position;
  e2.s_class=e2class;
  e2.s_statement=e2statement;
  if(x2)
  {
	  e2.xTarget2 = x2;
	  e2.xA2 = e2.xTarget2 - xWidth(e2);
  }
  if(y2)
  {
  e2.yTarget2 = y2; 
  e2.yA2 = e2.yTarget2 - xHeight(e2);
  }

  e2.slideTime2 = uTime2; e2.stop2 = false;

  if (e2.slideLinear2) e2.B2 = 1/e2.slideTime2;
  else e2.B2 = Math.PI / (2 * e2.slideTime2); // B = period
  e2.yD2 = xHeight(e2); e2.xD2 = xWidth(e2); // D = initial position
  var d2 = new Date(); e2.C2 = d2.getTime();
  if (!e2.moving2) _xResizeToAnimated(e2);
}
function _xResizeToAnimated(e2)
{
  if (!(e2=xGetElementById(e2))) return;
  var now2, s2, t2, newY2, newX2;
  now2 = new Date();
  t2 = now2.getTime() - e2.C2;
  if (e2.stop2) { e2.moving2 = false; }
  else if (t2 < e2.slideTime2) {
    setTimeout("_xResizeToAnimated('"+e2.id+"')", e2.timeout);
    if (e2.slideLinear2) s2 = e2.B2 * t2;
    else s2 = Math.sin(e2.B2 * t2);
	if(e2.xTarget2){
		newX2 = Math.round(e2.xA2 * s2 + e2.xD2);
	} else {
		newX2=null;
	}
    if(e2.yTarget2)	{
		newY2 = Math.round(e2.yA2 * s2 + e2.yD2);
	} else {
		newY2=null;
	}
	xResizeTo(e2, newX2, newY2);
    e2.moving2 = true;
  }  
  else {
    xResizeTo(e2, e2.xTarget2, e2.yTarget2);
    e2.moving2 = false;
	if(e2.s_position)
		e2.style.position=e2.s_position;
	if(e2.s_class)
		e2.className=e2.s_class;
	if(e2.s_statement)
	{
		eval(e2.s_statement);
	}
  }  
}
/////////////////////////////////////////////////////////////////////////////////////

function CCallWrapper(aObjectReference, 
                      aDelay,
                      aMethodName, 
                      aArgument0,
                      aArgument1,
                      aArgument2,
                      aArgument3,
                      aArgument4,
                      aArgument5,
                      aArgument6,
                      aArgument7,
                      aArgument8,
                      aArgument9
                      )
{
  this.mId = 'CCallWrapper_' + (CCallWrapper.mCounter++);
  this.mObjectReference = aObjectReference;
  this.mDelay     = aDelay;
  this.mTimerId = 0;
  this.mMethodName = aMethodName;
  this.mArgument0 = aArgument0;
  this.mArgument1 = aArgument1;
  this.mArgument2 = aArgument2;
  this.mArgument3 = aArgument3;
  this.mArgument4 = aArgument4;
  this.mArgument5 = aArgument5;
  this.mArgument6 = aArgument6;
  this.mArgument7 = aArgument7;
  this.mArgument8 = aArgument8;
  this.mArgument9 = aArgument9;
  CCallWrapper.mPendingCalls[this.mId] = this;
}

CCallWrapper.prototype.execute = function()
{
  this.mObjectReference[this.mMethodName](this.mArgument0,
                                          this.mArgument1,
                                          this.mArgument2,
                                          this.mArgument3,
                                          this.mArgument4,
                                          this.mArgument5,
                                          this.mArgument6,
                                          this.mArgument7,
                                          this.mArgument8,
                                          this.mArgument9
                                          );
  delete CCallWrapper.mPendingCalls[this.mId];
};

CCallWrapper.prototype.cancel = function()
{
  clearTimeout(this.mTimerId);
  delete CCallWrapper.mPendingCalls[this.mId];
};

CCallWrapper.asyncExecute = function (/* CCallWrapper */ callwrapper)
{
  CCallWrapper.mPendingCalls[callwrapper.mId].mTimerId = setTimeout('CCallWrapper.mPendingCalls["' + callwrapper.mId + '"].execute()', callwrapper.mDelay);
};

CCallWrapper.mCounter = 0;
CCallWrapper.mPendingCalls = {};

/////////////////////////////////////////////////////////////////////////////////////

