function addEvent( elm , evType , fn , useCapture ){
  if( elm.addEventListener ){
    elm.addEventListener( evType , fn , useCapture );
    return true;
  } 
  else if( elm.attachEvent ){
    var r = elm.attachEvent( 'on' + evType , fn );
    return r;
  }
  else {
    elm['on' + evType ] = fn;
  }
}

function removeEvent( elm , evType , fn , useCapture ){
  if( elm.removeEventListener ){
    elm.removeEventListener( evType , fn , useCapture );
    return true;
  } 
  else if( elm.detachEvent ){
    var r = elm.detachEvent( 'on' + evType , fn );
    return r;
  }
  else {
    elm['on' + evType ] = null;
  }
}

function ascendDOM( e , target ){
  if( e.nodeName.toLowerCase() != 'html') e = e.parentNode;
  while( e.nodeName.toLowerCase() != target && e.nodeName.toLowerCase() != 'html' ){
    e = e.parentNode;
  }
  return (e.nodeName.toLowerCase() == 'html') ? null : e;
}

function switchclass( cur_obj , oldclass , newclass ){
  if( cur_obj != null ){
    y = ( typeof cur_obj.className != 'undefined' ) ? cur_obj.className : '';
    x = replace( replace( y + ' ' + oldclass , oldclass , '' ) , newclass , '' ) + ' ' + newclass;;
    cur_obj.className = (x.replace(/^\W+/,'')).replace(/\W+$/,'');
  }
}

function addclass( cur_obj , newclass ){
  if( cur_obj != null ){
    x = ( cur_obj.className == null ) ? cur_obj.className : '';
    x += ' ' + newclass;
    cur_obj.className = (x.replace(/^\W+/,'')).replace(/\W+$/,'');
  }
}

function replace(string,text,by) {
  var strLength = string.length, txtLength = text.length;
  if ((strLength == 0) || (txtLength == 0)) return string;

  var i = string.indexOf(text);
  if ((!i) && (text != string.substring(0,txtLength))) return string;
  if (i == -1) return string;

  var newstr = string.substring(0,i) + by;
  
  if (i+txtLength < strLength){
  newstr += replace(string.substring(i+txtLength,strLength),text,by);
  }
  return newstr;
}


<!--
//Server:WWb01
-->
