// clientinfo.js
// joseph wang, jan 3, 2005

window.onerror=null;

function getLanguage() 
{
	var nl;
	if (navigator.appName == 'Netscape')
		var lg = navigator.language;
	else
		var lg = navigator.browserLanguage;
	if (lg.indexOf('en') > -1) {
		if (lg.indexOf('us') > -1) nl='English [United States]';
		else if (lg.indexOf('gb') > -1) nl='English [United Kingdom]';
		else if (lg.indexOf('ca') > -1) nl='English [Canada]';
		else if (lg.indexOf('au') > -1) nl='English [Australia]';
		else if (lg.indexOf('ie') > -1) nl='English [Ireland]';
		else nl='English';
	}
	else if (lg.indexOf('nl') > -1) {
		if (lg.indexOf('be') > -1) nl='Dutch [Belgium]';
		else nl='Dutch';
	}
	else if (lg.indexOf('zh') > -1) {
		if (lg.indexOf('cn') > -1) nl='Chinese [China]';
		else if (lg.indexOf('tw') > -1) nl='Chinese [Taiwan]';
		else if (lg.indexOf('hk') > -1) nl='Chinese [Hongkong]';
		else nl='Chinese';
	}
	else if (lg.indexOf('fr') > -1) nl='French';
	else if (lg.indexOf('de') > -1) nl='German';
	else if (lg.indexOf('ja') > -1) nl='Japanese';
	else if (lg.indexOf('it') > -1) nl='Italian';
	else if (lg.indexOf('pt') > -1) nl='Portuguese';
	else if (lg.indexOf('es') > -1) nl='Spanish';
	else if (lg.indexOf('sv') > -1) nl='Swedish';
	else nl='Others';
	return nl;
}

function testCookie()
{
  var tmpcookie = new Date();
  chkcookie = (tmpcookie.getTime() + '');
  document.cookie = "chkcookie=" + chkcookie + "; path=/";
  if (document.cookie.indexOf(chkcookie,0) < 0)
    return "no";
  else
    return "yes";
}

function getInfo() 
{

  var hostName,hostAddr,scrRes,winW,winH,broswerJava;

  if(navigator.javaEnabled() && (navigator.appName != "Microsoft Internet Explorer")) 
  {
    if (parseInt(navigator.appVersion)>="4")
      hostName = java.net.InetAddress.getLocalHost().getHostName();
    else
      hostName.value = java.net.InetAddress.getLocalHostName();
    hostAddr = java.net.InetAddress.getLocalHost().getHostAddress();
    scrRes = java.awt.Toolkit.getDefaultToolkit().getScreenResolution();
	}
	else 
	{
    hostName = "";
    hostAddr = "";
    scrRes = "";
	}

	if (navigator.userAgent.indexOf("MSIE") > 0) 
	{
		scrW = window.document.body.clientWidth;
		scrH = window.document.body.clientHeight;
	}
	else {                                                
		scrW = window.outerWidth;
		scrH = window.outerHeight;
	}

  if (navigator.javaEnabled()) broswerJava="yes"; else broswerJava="no";

  return "HostName=\"" + hostName + "\"" + 
	   " HostAddr=\"" + hostAddr + "\"" +
	   " ScrResolution=\"" + scrRes + "\"" +
	   " CookieEnabled=\"" + testCookie() + "\"" +
	   " JavaEnabled=\"" + broswerJava + "\"" +
	   " Language=\"" + getLanguage() + "\"" +
	   " ScrWidth=\"" +window.screen.width + "\"" +
	   " ScrHeight=\"" +window.screen.height + "\"" +
	   " DesktopWidth=\"" + window.screen.availWidth + "\"" +
	   " DesktopHeight=\"" + window.screen.availHeight + "\"" +
	   " WindowWidth=\"" + scrW + "\"" +
	   " WindowHeight=\"" + scrH + "\"" +
	   " BrowserName=\"" + navigator.appName + "\"" +	   
	   " BrowserVersion=\"" + navigator.appVersion + "\"" +
	   " BrowserCode=\"" + navigator.appCodeName + "\"" +
	   " Platform=\"" + navigator.platform + "\"" +
	   " ColorDepth=\"" + window.screen.colorDepth + "\"" +
      " Colors=\"" + Math.pow (2, window.screen.colorDepth) + "\"" +
	   " UserAgent=\"" + navigator.userAgent + "\"" +
	   ""
}

