function getLanguage() {
    if (navigator.language == undefined) {
		return(navigator.userLanguage);
    } else if (navigator.userLanguage == undefined) {
		return(navigator.language);
    } else {
		return("");
    }
}

function getScreenWidth() {
	if (window.screen) {
		return(screen.width);
	} else {
		return(0);
	}
}

function getScreenHeight() {
	if (window.screen) {
		return(screen.height);
	} else {
		return(0);
	}
}


function getScreenavailWidth() {
	if (window.screen) {
		return(screen.availWidth);
	} else {
		return(0);
	}
}

function getScreenavailHeight() {
	if (window.screen) {
		return(screen.availHeight);
	} else {
		return(0);
	}
}


function addRecordStat(){

	var xhr_object = null;
	
	var language = getLanguage();
	var screenWidth = getScreenWidth();
	var screenHeight = getScreenHeight();
	var availWidth = getScreenavailWidth();
	var availHeight = getScreenavailHeight();
	
	var IP="";
	var SITE_VISITE="";
	var BROWSER="";
	var OS="";
	var LANGUE=language;
	var SCREEN_WIDTH=screenWidth;
	var AVALAIBLE_SCREEN_WIDTH=availWidth;
	var SCREEN_HEIGHT=screenHeight;
	var AVALAIBLE_SCREEN_HEIGHT=availHeight;
	var COOKIES="";
	var CSSVERSION="";
	var SUPPORTCSS="";
	var JAVASCRIPT="";

	
	
	var data = "IP="+IP+"&SITE_VISITE="+SITE_VISITE+"&BROWSER="+BROWSER+"&OS="+OS+"&LANGUE="+LANGUE+"&SCREEN_WIDTH="+SCREEN_WIDTH+"&AVALAIBLE_SCREEN_WIDTH="+AVALAIBLE_SCREEN_WIDTH+"&SCREEN_HEIGHT="+SCREEN_HEIGHT	+"&AVALAIBLE_SCREEN_HEIGHT="+AVALAIBLE_SCREEN_HEIGHT+"&COOKIES="+COOKIES+"&CSSVERSION="+CSSVERSION+"&SUPPORTCSS="+SUPPORTCSS+"&JAVASCRIPT="+JAVASCRIPT;
	
	if(window.XMLHttpRequest) // Firefox
		xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
		//alert("ERROR");
		return;
	}

	xhr_object.open("POST", "/id2i_stats/addRecordStats.php", true);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4) {
		//	eval(xhr_object.responseText);
		}
	}
	//Send the proper header information along with the request
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.setRequestHeader("Content-length", data.length);
	xhr_object.setRequestHeader("Connection", "close");
	xhr_object.send(data);
}
addRecordStat();

