
/*
  --------------------------------------------------------------------------------------------------------------------------

    counter.js - funções javascript do Onda Stats

    Copyright (C) Ondaware

  --------------------------------------------------------------------------------------------------------------------------
*/



// --- determinar o browser ------------------------------------------------------------------------------------------------

function getBrowser()
{

  if(checkIt('epiphany'))    return 'epiphany';
  if(checkIt('galeon'))      return 'galeon';
  if(checkIt('mosaic'))      return 'mosaic';
  if(checkIt('lynx'))        return 'lynx';
  if(checkIt('links'))       return 'links';
  if(checkIt('elinks'))      return 'elinks';
  if(checkIt('konqueror'))   return 'konqueror';
  if(checkIt('safari'))      return 'safari';
  if(checkIt('omniweb'))     return 'omniweb';
  if(checkIt('opera'))       return 'opera';
  if(checkIt('webtv'))       return 'webtv';
  if(checkIt('icab'))        return 'icab';
  if(checkIt('msie'))        return 'msie';
  if(checkIt('firefox'))     return 'firefox';
  if(checkIt('gecko'))       return 'mozilla';
  if(!checkIt('compatible')) return 'compatible';
  return 'unknown';
}



// --- determinar o sistema operativo --------------------------------------------------------------------------------------

function getOS()
{
  if(checkIt('linux')) return 'linux';
  if(checkIt('x11'))   return 'unix';
  if(checkIt('mac'))   return 'mac';
  if(checkIt('win'))   return 'win';
  return 'unknown';
}



// --- verificar ocorrências -----------------------------------------------------------------------------------------------

function checkIt(string)
{
  place = navigator.userAgent.toLowerCase().indexOf(string) + 1;
  thestring = string;
  return place;
}



// --- colocar o ícone do contador -----------------------------------------------------------------------------------------

var query = "";

query += "HTTP_REFERER=" + escape(top.document.referrer) + "&";
query += "HTTP_USER_AGENT=" + escape(getBrowser())  + "&";
query += "HTTP_USER_AGENT_PLATFORM=" + escape(getOS());

document.write("<a href='http://www.ondaware.com/' target='_blank'><img style='border:0' src='/onda/w2.1.lib/counter.php?" + query + "' border='0' alt='Onda Stats' title='Onda Stats'/></a>");
