
function web_trends(SERVER, ACCOUNT_NUMBER, CONTENTGROUP, URL, TITLE) {

  function D8( d) {
    var fwd  = 0;
    var seed = new Date('01/01/2000');
    var key  = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
    var s    = key.charAt( d.getFullYear()-2000) + key.charAt( d.getMonth()+1)+key.charAt( d.getDate());

    s+= key.charAt( d.getHours())+key.charAt( d.getMinutes())+key.charAt( d.getSeconds());
    while( seed.getDay()!=fwd) seed= new Date(seed.getTime() + 86400000);
    var w= Math.floor( (d.getTime()-(seed.getTime()+86400000)) / 604800000 );
    s+= key.charAt( (w-(w%16))/16 );
    s+= key.charAt( w%16);
    return s;
  }

  function A( B, C)	{
    W+="&"+B+"="+escape(C);
  }


  var t = new Date();
  var W = "http"+(document.URL.indexOf('https:')==0?'s':'')+"://statse.webtrendslive.com/S"+ACCOUNT_NUMBER+"/button5.asp?tagver=5&si="+ACCOUNT_NUMBER+"&fw=0";
  A( "server", typeof(SERVER)== "string" ? SERVER : "");
  A( "Group", typeof(CONTENTGROUP)== "string" ? CONTENTGROUP : "");
  A( "tz", t.getTimezoneOffset());
  A( "ch", t.getHours());
  A( "cl", D8(t));
  A( "ti", typeof(TITLE)== "string" ? TITLE : document.title);
  A( "url", typeof(URL)== "string" ? URL : document.URL);
  A( "rf", window.document.referrer);
  A( "js", "Yes");
  A( "ul", navigator.appName=="Netscape" ? navigator.language : navigator.userLanguage);

  if(typeof(screen)=="object") {
    A( "sr", screen.width+"x"+screen.height);
    A( "cd", screen.colorDepth);
    A( "jo", navigator.javaEnabled()?"Yes":"No");
  }
  
  if( W.length>2048 && navigator.userAgent.indexOf('MSIE')>=0)
  W= W.substring( 0, 2043)+"&tu=1";

  document.write('<IMG ID="WTL_TAG" BORDER="0" WIDTH="1" HEIGHT="1" SRC="'+W+'">');
}


function newPopwin(page,tools) {
  var agt=navigator.userAgent.toLowerCase();
  var isNav = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1)&& (agt.indexOf('compatible') == -1)));
  if (tools) {
    Popwin = window.open(page,'','width=480,height=500,scrollbars=1,resizable=1,menubar=1,toolbar=1,location=0,directories=0,status=0,copyhistory=0');
  }
  else {
    Popwin = window.open(page,'','width=480,height=500,scrollbars=1,resizable=1,menubar=0,toolbar=0,location=0,directories=0,status=0,copyhistory=0');
  }
  
  if (isNav) {
    Popwin.focus();
  }
}

function betterPopwin(page,tools, winname, locationbar, 
width, height, posX, posY, scrollbar) 
{

var agt=navigator.userAgent.toLowerCase();
var isNav = ((agt.indexOf('mozilla')!=-1) && 
((agt.indexOf('spoofer')==-1)&&
(agt.indexOf('compatible') == -1)));

if (isNav) {
    if (winname == null || winname == undefined) {
        winname = '';
        }
    if (locationbar == null) {
        locationbar = 0;
    }
    if (width == null || width == undefined)
         width = "480";
    if (width == -1 || width == "-1")
         width = "";
    if (height == null || height == undefined)
         height = "500";
    if (posX == null || posX == undefined)
         posX = "";
    if (posY == null || posY == undefined)
         posY = "";
    if (scrollbar == null || scrollbar == undefined)
         scrollbar = "1";
    } 
else {
    if (winname == null || winname.length == 0) {
        winname = '';
        }
    if (locationbar == null) {
        locationbar = 0;
        }
    if (width == null || width.length == 0)
        width = "480";
    if (width == -1 || width == "-1")
        width = "";
    if (height == null || height.length == 0)
        height = "500";
    if (posX == null)
        posX = "";
    if (posY == null)
        posY = "";
    if (scrollbar == null || scrollbar.length == 0)
        scrollbar = "1";
    }

 scrollbar = "scrollbars=" + scrollbar;
 if (height == -1 || height == "-1")
     height = "";

if (tools) 
	{
    if (locationbar) {
       	attribute = scrollbar + ',resizable=1,menubar=1,toolbar=1,location=1,directories=0,status=1,copyhistory=0';
    	if (width.length != 0)
       		attribute = attribute + ',width=' + width;
    	if (height.length != 0)
        	attribute = attribute + ',height=' + height;
    	if (posX.length != 0)
        	attribute = attribute + ',screenX=' + posX;
    	if (posY.length != 0)
        	attribute = attribute + ',screenY=' + posY;
    	Popwin = window.open(page,winname,attribute);
		}
    } 
 else 
	{
	if (locationbar) 
		{
        attribute = scrollbar + ',resizable=1,menubar=0,toolbar=1,location=0,directories=0,status=1,copyhistory=0';
        if (width.length != 0)
            attribute = attribute + ',width=' + width;
        if (height.length != 0)
            attribute = attribute + ',height=' + height;
        if (posX.length != 0)
            attribute = attribute + ',screenX=' + posX;
        if (posY.length != 0)
                attribute = attribute + ',screenY=' + posY;
        Popwin = window.open(page,winname,attribute);
        } 
	else 
		{
        attribute = scrollbar + ',resizable=1,menubar=0,toolbar=0,location=0,directories=0,status=0,copyhistory=0';
        if (width.length != 0)
           attribute = attribute + ',width=' + width;
        if (height.length != 0)
           attribute = attribute + ',height=' + height;
        if (posX.length != 0)
           attribute = attribute + ',screenX=' + posX;
        if (posY.length != 0)
           attribute = attribute + ',screenY=' + posY;
        Popwin = window.open(page,winname,attribute);
        }
   }
   Popwin.focus();
   }
