function file(fichier)
{
	if (window.XMLHttpRequest) // si sur firefox
		xhr_object = new XMLHttpRequest();
	else if (window.ActiveXObject) // si sur Internet Explorer
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else return (false);
	xhr_object.open("GET", fichier, false);
	xhr_object.send(null);
	if (xhr_object.readyState == 4) return (xhr_object.responseText);
	else return(false);
}
AIM = {

    frame : function(c) {

        var n = 'f' + Math.floor(Math.random() * 99999);
        var d = document.createElement('DIV');
        d.innerHTML = '<iframe style="display:none" src="about:blank" id="'+n+'" name="'+n+'" onload="AIM.loaded(\''+n+'\')"></iframe>';
        document.body.appendChild(d);

        var i = document.getElementById(n);
        if (c && typeof(c.onComplete) == 'function') {
            i.onComplete = c.onComplete;
        }

        return n;
    },

    form : function(f, name) {
        f.setAttribute('target', name);
    },

    submit : function(f, c) {
        AIM.form(f, AIM.frame(c));
        if (c && typeof(c.onStart) == 'function') {
            return c.onStart();
        } else {
            return true;
        }
    },

    loaded : function(id) {
        var i = document.getElementById(id);
        if (i.contentDocument) {
            var d = i.contentDocument;
        } else if (i.contentWindow) {
            var d = i.contentWindow.document;
        } else {
            var d = window.frames[id].document;
        }
        if (d.location.href == "about:blank") {
            return;
        }

        if (typeof(i.onComplete) == 'function') {
            i.onComplete(d.body.innerHTML);
        }
    }

}
p = document.getElementById("imgshow").style;
if(navigator.appName.substring(0,3) == "Net"){
	document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = pointer;

setTimeout("newssearch('')", 100);   

function startCallback() {
	// make something useful before submit (onStart)
	return true;
}

function completeCallback(response) 
{
	document.getElementById('div_retour').innerHTML = response;
}
function afficheDate(id_site)
{
	if(id_site != '')
	{
		req = file('ajax/ajax.php?option=date&id_site='+escape(id_site));
		if(req != '')
		{
			document.getElementById('div_stats').innerHTML = '';
			document.getElementById('div_date').innerHTML = req;
		}else document.getElementById('div_date').innerHTML = '';
	}else
	{
		document.getElementById('div_date').innerHTML = '';
		document.getElementById('div_stats').innerHTML = '';
	}
}
function afficheStats(id_site,date)
{
	if(id_site != '' && date!= '')
	{
		req = file('ajax/ajax.php?option=stats&date='+escape(date)+'&id_site='+escape(id_site));
		if(req != '')
		{
			document.getElementById('div_stats').innerHTML = req;
		}else document.getElementById('div_stats').innerHTML = 'Aucune statistique pour la date '+escape(date);
	}else document.getElementById('div_stats').innerHTML = '';
}
