//*************************************************************************************************
//**                                                                               
//*************************************************************************************************

function HTMLUtilClass(){

  this.GetEventX=GetEventX;
  this.GetEventY=GetEventY;
  function GetEventX(event){ if(theClientInfo.family=="ie4") return event.x; else return event.layerX; }
  function GetEventY(event){ if(theClientInfo.family=="ie4") return event.y; else return event.layerY; }
}

function MathUtilClass(){
  this.Position2Time=Position2Time;  
  function Position2Time(aPos){
  	aPos = Math.floor(aPos);
  	var hours = aPos / 3600;
  	var rounded_hours = Math.floor(hours);
  	var minutes = (hours - rounded_hours) * 60;
  	var rounded_minutes = Math.floor(minutes);
  	var seconds = (minutes - rounded_minutes) * 60;
  	var rounded_seconds = Math.floor(seconds);
    var myTime=(rounded_minutes<10?"0":"") + rounded_minutes + ":" +
      (rounded_seconds<10?"0":"") + rounded_seconds;
    if(rounded_hours>0) myTime= (rounded_hours<10?"0":"") + rounded_hours + ":" + myTime
    return myTime
  }
}

function ClientInfoClass(){  
  var oldOnError = window.onerror;
  var element = null;
  window.onerror = null;
  
  // work around bug in xpcdom Mozilla 0.9.1
  window.saveNavigator = window.navigator;
  this.OS      = '';
  this.version = parseFloat(navigator.appVersion);
  this.org     = '';
  this.family  = '';
  this.flash   = FlashInstalled();
  var platform;
  
  if (typeof(window.navigator.platform) != 'undefined'){
    platform = window.navigator.platform.toLowerCase();
    if (platform.indexOf('win') != -1)
      this.OS = 'win';
    else if (platform.indexOf('mac') != -1)
      this.OS = 'mac';
    else if (platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1)
      this.OS = 'nix';
  }
  
  var i = 0;
  var ua = window.navigator.userAgent.toLowerCase();
  if (ua.indexOf('opera') != -1){
    i = ua.indexOf('opera');
    this.family  = 'opera';
    this.org    = 'opera';
    this.version  = parseFloat('0' + ua.substr(i+6), 10);
  }else if ((i = ua.indexOf('msie')) != -1){
    this.org    = 'microsoft';
    this.version  = parseFloat('0' + ua.substr(i+5), 10);
    if (this.version < 4)
      this.family = 'ie3';
    else
      this.family = 'ie4'
  } else if (ua.indexOf('gecko') != -1){
    this.family = 'gecko';
    var rvStart = navigator.userAgent.indexOf('rv:') + 3;
    var rvEnd = navigator.userAgent.indexOf(')', rvStart);
    var rv = navigator.userAgent.substring(rvStart, rvEnd);
    var decIndex = rv.indexOf('.');
    if (decIndex != -1){
      rv = rv.replace(/\./g, '')
      rv = rv.substring(0, decIndex-1) + '.' + rv.substr(decIndex)
    }
    this.version = parseFloat(rv);
    if (ua.indexOf('netscape') != -1)
      this.org = 'netscape';
    else if (ua.indexOf('compuserve') != -1)
      this.org = 'compuserve';
    else
      this.org = 'mozilla';
  } else if ((ua.indexOf('mozilla') !=-1) && (ua.indexOf('spoofer')==-1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera')==-1)&& (ua.indexOf('webtv')==-1) && (ua.indexOf('hotjava')==-1)){
    var is_major = parseFloat(navigator.appVersion);
    if (is_major < 4)
      this.version = is_major;
    else{
      i = ua.lastIndexOf('/')
      this.version = parseFloat('0' + ua.substr(i+1), 10);
    }
    this.org = 'netscape';
    this.family = 'nn' + parseInt(navigator.appVersion);
  }else if ((i = ua.indexOf('aol')) != -1 ){
    // aol
    this.family  = 'aol';
    this.org    = 'aol';
    this.version  = parseFloat('0' + ua.substr(i+4), 10);
  }else if ((i = ua.indexOf('hotjava')) != -1 ){
    // hotjava
    this.family  = 'hotjava';
    this.org    = 'sun';
    this.version  = parseFloat(navigator.appVersion);
  }
  
  function FlashInstalled(){
  	result = false;
  	if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]){
  		result = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
  	}
  	else if (document.all && (navigator.appVersion.indexOf("Mac")==-1)){
  		eval ('try {var xObj = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if (xObj)	result = true; xObj = null;	} catch (e)	{}');
  	}
  	return result;
  }
  
}