//-----------------------------------------------------------------------
//    iSatats Tracker and Counter code
//    Copyrights (c) 2007 www.istats.com. All rights reserved.
//-----------------------------------------------------------------------

// Common data
var is_query  = "r="+Math.random()+"&amp;p="+escape(window.location.href.substring(0,255));
document.cookie="istats.com=1; path=/"; 
is_query+="&amp;c="+(document.cookie?"1":"0");

try {
	is_query+="&amp;j="+(navigator.javaEnabled()?"1":"0");
}
catch (e) {
	is_query+="&amp;j=0";
}

if (parent != window)
	is_query+="&amp;rf="+parent.document.referrer;
else 
	is_query+="&amp;rf="+document.referrer;

is_query+="&amp;fr="+((self != top) ? '1' : '0');

var is_js_ver='';
document.write('<scr'+'ipt language="javascr'+'ipt">is_js_ver=1;</scr'+'ipt>');
document.write('<scr'+'ipt language="javascr'+'ipt1.1">is_js_ver=1.1;</scr'+'ipt>');
document.write('<scr'+'ipt language="javascr'+'ipt1.2">is_js_ver=1.2;</scr'+'ipt>');
document.write('<scr'+'ipt language="javascr'+'ipt1.3">is_js_ver=1.3;</scr'+'ipt>');
document.write('<scr'+'ipt language="javascr'+'ipt1.4">is_js_ver=1.4;</scr'+'ipt>');
document.write('<scr'+'ipt language="javascr'+'ipt1.5">is_js_ver=1.5;</scr'+'ipt>');
document.write('<scr'+'ipt language="javascr'+'ipt1.6">is_js_ver=1.6;</scr'+'ipt>');

is_query+="&amp;js="+is_js_ver;

//Detect Flash version (http://blog.deconcept.com/swfobject/)
var is_flash_version = '';

if(navigator.plugins && navigator.mimeTypes.length){ //Mozilla & Firefox
	var x = navigator.plugins["Shockwave Flash"];
	if(x && x.description) {
		is_flash_version = x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split('.')[0];
	}
}
else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ //Windows Mobile
	var is_flash_check = 1;
	var is_try_version = 3;
	while(is_flash_check) {
		try {
			is_try_version++;
			is_flash_check = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ is_try_version);
			if(is_flash_check) is_flash_version = is_try_version;
		} catch (e) {
			is_flash_check = null;
		}
	}
} 
else { // Windows + Internet Explorer
    var is_flash_check = null;
	try{
		is_flash_check = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
	}catch(e){}

	if (is_flash_check != null) {
		is_flash_version = is_flash_check.GetVariable("$version").split(" ")[1].split(",")[0];
	}
}


//Browser and Screen data
is_query+="&amp;scr="+screen.width+'x'+screen.height+"&amp;col="+(((navigator.appName.substring(0,3)=="Mic"))?screen.colorDepth:screen.pixelDepth)+"&amp;f="+is_flash_version;


var is_proto = 'http';
if(document.location.href.match(/^https/i)) {
	is_proto = "https";
}
else {
	is_proto = "http";
}

if(is_host && is_project && is_project_key) {
	document.write('<a href="http://www.istats.com/" target="_blank"><img src="'+is_proto+'://'+is_host+'.istats.com/counter/counter.php?id='+escape(is_project)+'&amp;k='+escape(is_project_key)+'&amp;'+is_query+'" border="0"  alt="iStats - Best Free Web Tracker and Counter" title="iStats - Best Free Web Tracker and Counter"></a>');
}
else {
	document.write('iStats code is corrupted. Please insert fresh copy.');
}
