//v2.2
var dm='web-stats.org';
d='http://5630.web-stats.org/w.php?';
var detectableWithVB = false;
var pluginFound = false;
tmp_web_stats='';
n=0;
ns6=document.getElementById&&!document.all
ie4=document.all
ns4=document.layers
function canDetectPlugins() {
	if( detectableWithVB || (navigator.plugins && navigator.plugins.length > 0) ) {
		return true;
	} else {
		return false;
	}
}
// ShockwaveFlash.ShockwaveFlash.1
function detectFlash() {
	pluginFound = detectPlugin('Shockwave','Flash'); 
	// if not found, try to detect with VisualBasic
	if(!pluginFound && detectableWithVB) {
		pluginFound = detectActiveXControl('ShockwaveFlash.ShockwaveFlash.1');
	}
	if (pluginFound) return 1; 
	else return 0;
}
// SWCtl.SWCtl.1
function detectDirector() { 
	pluginFound = detectPlugin('Shockwave','Director'); 
	// if not found, try to detect with VisualBasic
	if(!pluginFound && detectableWithVB) {
		pluginFound = detectActiveXControl('SWCtl.SWCtl.1');
	}
	if (pluginFound) return 1; 
	else return 0;
}
//QuickTimeCheckObject.QuickTimeCheck.1
function detectQuickTime() {
	pluginFound = detectPlugin('QuickTime');
	// if not found, try to detect with VisualBasic
	if(!pluginFound && detectableWithVB) {
		pluginFound = detectQuickTimeActiveXControl();
	}
	if (pluginFound) return 1; 
		else return 0;
}

function detectReal() {
	pluginFound = detectPlugin('RealPlayer');
	// if not found, try to detect with VisualBasic
	if(!pluginFound && detectableWithVB) {
		pluginFound = (detectActiveXControl('rmocx.RealPlayer G2 Control') ||
			detectActiveXControl('RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)') ||
			detectActiveXControl('RealVideo.RealVideo(tm) ActiveX Control (32-bit)'));
	}
	if (pluginFound) return 1; 
	else return 0;
}
// MediaPlayer.MediaPlayer.1
function detectWindowsMedia() {
	pluginFound = detectPlugin('Windows Media');
	// if not found, try to detect with VisualBasic
	if(!pluginFound && detectableWithVB) {
		pluginFound = detectActiveXControl('MediaPlayer.MediaPlayer.1');
	}
	if (pluginFound) return 1; 
	else return 0;
}
//	application/pdf
function detectPDF() {
	pluginFound = detectPlugin('pdf');
	// if not found, try to detect with VisualBasic
	if(!pluginFound && detectableWithVB) {
		pluginFound = detectActiveXControl('PDF.PdfCtrl.5');
	}
	if (pluginFound) return 1; 
	else return 0;
}
// fonction a argument variable cross browser
function detectPlugin() {
	// allow for multiple checks in a single pass
	var daPlugins = detectPlugin.arguments;
	// consider pluginFound to be false until proven true
	var pluginFound = false;
	// if plugins array is there and not fake
	if (navigator.plugins && navigator.plugins.length > 0) {
		var pluginsArrayLength = navigator.plugins.length;
		// for each plugin...
		for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
			// loop through all desired names and check each against the current plugin name
			var numFound = 0;
			for(namesCounter=0; namesCounter < daPlugins.length; namesCounter++) {
				// if desired plugin name is found in either plugin name or description
				if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) || 
				(navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
					// this name was found
					numFound++;
				}
			}
			// now that we have checked all the required names against this one plugin,
			// if the number we found matches the total number provided then we were successful
			if(numFound == daPlugins.length) {
				pluginFound = true;
				// if we've found the plugin, we can stop looking through at the rest of the plugins
				break;
			}
		}
	}
	return pluginFound;
} // detectPlugin
// Here we write out the VBScript block for MSIE Windows
if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
	document.writeln('<script language="VBscript">');
	
	document.writeln('\'do a one-time test for a version of VBScript that can handle this code');
	document.writeln('detectableWithVB = False');
	document.writeln('If ScriptEngineMajorVersion >= 2 then');
	document.writeln('  detectableWithVB = True');
	document.writeln('End If');
	
	document.writeln('\'this next function will detect most plugins');
	document.writeln('Function detectActiveXControl(activeXControlName)');
	document.writeln('  on error resume next');
	document.writeln('  detectActiveXControl = False');
	document.writeln('  If detectableWithVB Then');
	document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
	document.writeln('  End If');
	document.writeln('End Function');
	
	document.writeln('\'and the following function handles QuickTime');
	document.writeln('Function detectQuickTimeActiveXControl()');
	document.writeln('  on error resume next');
	document.writeln('  detectQuickTimeActiveXControl = False');
	document.writeln('  If detectableWithVB Then');
	document.writeln('    detectQuickTimeActiveXControl = False');
	document.writeln('    hasQuickTimeChecker = false');
	document.writeln('    Set hasQuickTimeChecker = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")');
	document.writeln('    If IsObject(hasQuickTimeChecker) Then');
	document.writeln('      If hasQuickTimeChecker.IsQuickTimeAvailable(0) Then ');
	document.writeln('        detectQuickTimeActiveXControl = True');
	document.writeln('      End If');
	document.writeln('    End If');
	document.writeln('  End If');
	document.writeln('End Function');
	
	document.writeln('</scr' + 'ipt>');
}
function T(adUnit) 
{
	if (window.status) 
	{
		var y = new Date();
		var bug = new Image(); 
		bug.src=d+'U=' + mon_encodeURIComponent(document.URL) + '&D=' + mon_encodeURIComponent(window.status) + '&A=' + adUnit + "&T=" + y.getHours() + ':' + y.getMinutes() + ':' + y.getSeconds()+ ':' + y.getMilliseconds()+tmp_web_stats; 
		window.focus();
	}
}
function d1()
{
	y = new Date();
	mybug = new Image();
	mybug.src =d+'X='+y.getHours() + ':' + y.getMinutes() + ':' + y.getSeconds()+ ':' + y.getMilliseconds();			
}
function T0(){T(0);}function T1(){T(1);}function T2(){T(2);}function T3(){T(3);}
function v(){
	n++;
	if(ie4){ 
		var w=imgid.width;
	}else if(ns4){ 
		var w=imgid.width;
	}else{
		var w=document.getElementById("imgid").width;
	}
	if (w==12||w==1){
		if(ie4){ 
			imgidd.style.visibility = 'visible';
		}else if(ns4){ 
			document.imgidd.visibility = 'show';
		}else{ 
			document.getElementById("imgidd").style.visibility = 'visible';
		}
	}else if ( n<20 ){
		window.setTimeout('v()', 100);
	}
}
function v2(){
	nmy++;
	var w=mybug.width;
	if (w==1){
		document.location=redirURL;
	}else{ 
		if ( nmy<20 )
		{
			window.setTimeout('v2()', 10);
		}else{
			document.location=redirURL;
		}
	}
}
function commun(CHAP,my_code,USER)
{
	if (navigator.appName != "Netscape") var c=screen.colorDepth;
	else var c=screen.pixelDepth; 
	if(navigator.javaEnabled()) var p1="1";	
	else  var p1="0";
	if (canDetectPlugins())
	{
		var p2=detectDirector();
		var p3=detectFlash();
		var p4=detectReal();
		var p5=detectQuickTime();
		var p6=detectWindowsMedia();
		var p7=detectPDF();
		var Plugs=p1+p2+p3+p4+p5+p6+p7;
		var Plugs='&P='+parseInt(Plugs,2).toString(16);
	}else{
		var Plugs='&P2='+p1;
	}
	if (CHAP!='') CHAP='&H='+mon_encodeURIComponent(CHAP);
	if (USER!='') USER='&Z='+mon_encodeURIComponent(USER);
	if (my_code!='') my_code='&O='+my_code;
	tmp_web_stats='&S='+screen.width.toString(16)+"x"+screen.height.toString(16)+'x'+c.toString(16)+Plugs+CHAP+USER+my_code;				
}
//
// redirect(URL)
// redirect(URL,CHAP)
// redirect(URL,CHAP,my_code)
// redirect(URL,CHAP,my_code,USER)
//
function redirect()
{
	document.write("<style>body{display:none;}</style>");
	redirURL=arguments[0]; 
	// recupere les arguments de la fonction
	if (arguments.length >= 2) CHAP=arguments[1]; 
	else CHAP="";
	if (arguments.length >= 3) my_code=arguments[1];
	else my_code="";
	if (arguments.length >= 4) USER=arguments[2];
	else USER="";
	commun(CHAP,my_code,USER);
	n = new Date();
	mybug = new Image();
	mybug.src =d+'K='+mon_encodeURIComponent(document.URL.substring(7))+'&R='+mon_encodeURIComponent(document.referrer.substring(7))+'&T='+n.getHours() + ':' + n.getMinutes() + ':' + n.getSeconds()+ ':' + n.getMilliseconds()+tmp_web_stats;
	// patiente juste le temps de  recup l info
	nmy=0;
	window.setTimeout('v2()',10);
}

function mon_encodeURIComponent(v)
{
	if (ie4||ns4) return escape(v);
	else return encodeURIComponent(v);
}
//
// count()
// count("CHAP")
// count("CHAP",404);
// count("CHAP",404,USER); 
//
function count()
{
	if (arguments.length >= 1) CHAP=arguments[0];
	else CHAP="";
	if (arguments.length >= 2) my_code=arguments[1];
	else my_code="";
	if (arguments.length >= 3) USER=arguments[2];
	else USER="";
	y = new Date();
	commun(CHAP,my_code,USER);
	src=d+'U='+mon_encodeURIComponent(document.URL.substring(7))+'&R='+mon_encodeURIComponent(document.referrer.substring(7))+'&T='+y.getHours() + ':' + y.getMinutes() + ':' + y.getSeconds()+ ':' + y.getMilliseconds()+tmp_web_stats;
	document.write('<div id="imgidd" style="position:absolute;left:0;top:0;visibility:hidden;"><a href="http://www.'+dm+'" target="_blank"><img id="imgid" src="'+ src +'" border="0" alt="web stats" /></a></div>');
	n=0;
	window.setTimeout('v()',10);
	var e = document.getElementsByTagName("iframe"); 
	for (var i = 0; i < e.length; i++) 
	{ 
		if(
			(e[i].src.indexOf('googleadservices.com') > -1)
			||
			(e[i].src.indexOf('googlesyndication.com') > -1)
			)
		{
			if (i==0) e[i].onfocus = T0;
			if (i==1) e[i].onfocus = T1;
			if (i==2) e[i].onfocus = T2;
			if (i==3) e[i].onfocus = T3; 
		}
	}
	return;
}
//
// permet de comptabiliser les pages en flash appel
// Dans le film flash, il faut associer à tout événement OnMouseEvent une action 
// get url qui appelle la fonction count_flash .
//
function count_flash()
{
	if (arguments.length >= 1) MPAGE=arguments[0];
	else MPAGE="Page par defaut flash";
	if (arguments.length >= 2) CHAP=arguments[1];
	else CHAP="";
	if (arguments.length >= 3) my_code=arguments[2];
	else my_code="";
	if (arguments.length >= 4) USER=arguments[3];
	else USER="";
	y = new Date();
	commun(CHAP,my_code,USER);
	mimg = new Image();
	mimg.src=d+'U='+escape(MPAGE)+'&R=FLASH&T='+y.getHours() + ':' + y.getMinutes() + ':' + y.getSeconds()+ ':' + y.getMilliseconds()+tmp_web_stats;
	return;
}
CHAP="";my_code="";
if ('undefined' !=typeof (web_stats_org_zone) ){
	CHAP=web_stats_org_zone;
}
if ('undefined' != typeof (web_stats_code)){
	my_code=web_stats_code;
}
if ('undefined' !=typeof (web_stats_redirect)){
	redirect(web_stats_redirect,CHAP,my_code)
}else{
	count(CHAP,my_code);
}
