// (c) 2005,2006 Spylog

document.write("<div STYLE=\"behavior:url(#default#clientCaps);visiblity: hidden; position: absolute; Z-INDEX:3; left: 0px; top: 0px;\" ID=\"MC\"></div>");

function spylog_tracker(counter, part)
{
    first =	Math.floor(counter / 100);
    second = counter - first * 100;
    first = spylog_str_pad(first.toString(), 3, '0');
    second = spylog_str_pad(second.toString(), 2, '0');

    Mu = "u" + first + "." + second + ".spylog.com";

    Md = document; 
    Mnv = navigator;
    Mp = 0;
    Md.cookie = "b=b";
    Mc = 0;
    if (Md.cookie)
        Mc = 1;
    Mrn = Math.random();
    Mn = (Mnv.appName.substring(0, 2) == "Mi") ? 0 : 1;
    Mt = (new Date()).getTimezoneOffset();
    Mz = "p=" + Mp + "&rn=" + Mrn + "&c=" + Mc + "&t=" + Mt;
    Mz += '&title=' + escape(Md.title);
    if ((part != undefined) && (part != '')) {
        part = part.toString();
        Mz += '&partname=' + spylog_escape(part.replace(/^\s+/, '').replace(/\s+$/, ''));
    }
    if (self != top)
        Mfr = 1;
    else
        Mfr = 0;

    if ((navigator.appVersion.indexOf("Mac") != -1) && (navigator.userAgent.indexOf("MSIE") != -1)
        && (parseInt(navigator.appVersion) == 3))
        Msl = "1";
    else {
        is = new Is();
        Msl = is.js;
    }
    var Mct='';
	Mfl = spylog_fix_flash();
    if(!Mct)Mct = 'lan';
    
	if ((Mfl != undefined) && (Mfl != '') && (Mfl.replace(/\s/ig, '') != '')) {
        Mz += '&fl=' + Mfl + '&ct=' + Mct;
    }
    switch (Msl) {
    default:
    case '1.2':
        Ms = screen;
        Mpx = (Mn == 0) ? Ms.colorDepth : Ms.pixelDepth;
        Mz += "&wh=" + Ms.width + 'x' + Ms.height + "&px=" + Mpx;
    case '1.1':
        Mpl = "";
        Mj = (Mnv.javaEnabled()? "Y" : "N");
        Mz += '&j=' + Mj;
    case '1':
    case '1.0':
    }
    if (parent != window)
        Mfm = "&r1=" + escape(Md.referrer) + "&r=" + escape(parent.document.referrer);
    else
        Mfm = "&r=" + escape(Md.referrer);
	
    My = "";
    My += "<a href='http://" + Mu + "/cnt?cid=" + counter + "&f=3&p=" + Mp + "&rn=" + Mrn + "' target='_blank'>";
    if (document.location.protocol == 'https:')
        Mu = "s://sec01-hits.spylog.com/cnt.cgi";
    else
        Mu = "://" + Mu + "/cnt";
    My +=
        "<img src='http" + Mu + "?cid=" + counter + "&" + Mz + "&sl=" + Msl + Mfm + "&fr=" + Mfr + "&pg=" +
        escape(window.location.href);
    My += "' border=0 alt='SpyLOG'>";
    My += "</a>";
    Md.write(My);
}

function Is()
{
    var agt = navigator.userAgent.toLowerCase();
	
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.nav = ((agt.indexOf('mozilla') != -1) && (agt.indexOf('spoofer') == -1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera') == -1)
                && (agt.indexOf('webtv') == -1) && (agt.indexOf('hotjava') == -1));
    this.ff = ((agt.indexOf('firefox') != -1) && (this.major = 5));
    this.nav2 = (this.nav && (this.major == 2));
    this.nav3 = (this.nav && (this.major == 3));
    this.nav4 = (this.nav && (this.major == 4));
    this.nav6 = (this.nav && (this.major == 5));
    this.nav6up = (this.nav && (this.major > 5));
    this.gecko = (agt.indexOf('gecko') != -1);
    this.ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    this.ie3 = (this.ie && (this.major < 4));
    this.ie4 = (this.ie && (this.major == 4) && (agt.indexOf("msie 4") != -1));
    this.ie4up = (this.ie && (this.major >= 4));
    this.ie5 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0") != -1));
    this.ie5_5 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.5") != -1));
    this.ie5up = (this.ie && !this.ie3 && !this.ie4);
    this.ie5_5up = (this.ie && !this.ie3 && !this.ie4 && !this.ie5);
    this.ie6 = (this.ie && (this.major == 4) && (agt.indexOf("msie 6.") != -1));
    this.ie6up = (this.ie && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie5_5);
    this.opera = (agt.indexOf("opera") != -1);
    this.opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
    this.opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
    this.opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
    this.opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
    this.opera5up = (this.opera && !this.opera2 && !this.opera3 && !this.opera4);
    this.opera7up = (this.opera5up && !this.opera6);
    this.hotjava = (agt.indexOf("hotjava") != -1);
    this.hotjava3 = (this.hotjava && (this.major == 3));
    this.hotjava3up = (this.hotjava && (this.major >= 3));
    if (this.nav2 || this.ie3)
        this.js = 1.0;
    else if (this.nav3)
        this.js = 1.1;
    else if (this.opera7up)
        this.js = 1.5;
    else if (this.opera5up)
        this.js = 1.3;
    else if (this.opera)
        this.js = 1.1;
    else if ((this.nav4 && (this.minor <= 4.05)) || this.ie4) {
        this.js = 1.2;
    }
    else if ((this.nav4 && (this.minor > 4.05)) || this.ie5)
        this.js = 1.3;
    else if (this.hotjava3up)
        this.js = 1.4;
    else if (this.nav6up) {
        this.js = 1.5;
    }
    else if (this.ff) {
        this.js = 1.6;
    }
    else if (this.nav6 || this.gecko) {
        this.js = 1.5;
    }
    else if (this.nav4) {
        this.js = 1.5;
    }
    else if (this.ie4up)
        this.js = 1.3
        else
        this.js = 1.0;
}

function spylog_escape(str)
{
    var unicod = '';
    var len = str.length;

    for (var i = 0; i < len; i++) {
        var cod = str.charCodeAt(i);

        if (cod < 255) {
            unicod += str.charAt(i);
            continue;
        }
        cod = cod.toString(16);
        unicod += '%u' + spylog_str_pad(cod.toLowerCase(), 4, '0');
    }
    return unicod;
}

function spylog_str_pad(str, len, pad)
{
    var length = str.length;

    if (length >= len)
        return str;
    var count = len - length;

    for (var i = 0; i < 1; i++)
        str = pad + str;
    return str;
}

function spylog_fix_flash() 
{
	var f="", n=navigator;
	if (n.plugins && n.plugins.length) {
		for (var ii=0;ii<n.plugins.length;ii++) {
			if (n.plugins[ii].name.indexOf('Shockwave Flash')!=-1) {
				f=n.plugins[ii].description.split('Shockwave Flash ')[1];
				break;
			}
		}
	} else if (window.ActiveXObject) {
		for (var ii=10;ii>=2;ii--) {
			try {
				var fl=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+ii+"');");
				if (fl) { f=ii + '.0'; break; }
			}
			catch(e) {}
		}
		if((f=="")&&!Mn&&(n.appVersion.indexOf("MSIE 5")>-1||n.appVersion.indexOf("MSIE 6")>-1))
		{
			Mct=MC.connectionType;
			FV=clientInformation.appMinorVersion;
			if(FV.indexOf('SP2') != -1)
			f = '>=7';
			if(f==''){
				f =MC.getComponentVersion("{D27CDB6E-AE6D-11CF-96B8-444553540000}","ComponentID");
			}
		}
	}
	return f;
}
