function maxbox(box,nb,max) {
	var groupe = 'box_';
	nbr = 0;
	var bt = new Array();
	for (i = 0; i < nb; i++) {
		bt[i+1] = document.forms['divconf'].elements[groupe+(i+1)].checked;
		nbr += (bt[i+1] ? 1 : 0);
	}
	if (nbr > max) {
		box.checked = false;
		alert('Veuillez ne pas cocher plus de ' + max + ' cases.');
		nbr--
	}
}

function setPreference(div,rub,position,open){
	var xhrSelect = getXhr();
	xhrSelect.onreadystatechange = function(){
		if(xhrSelect.readyState == 4 && xhrSelect.status == 200){
			//console.log("set :      " + xhrSelect.responseText + "div : " + div + " rub : " + rub + " position :" + position) ;
			//alert(xhrSelect.responseText) ;
		}
	}
	xhrSelect.open("POST","index.php?action=divs",true);
	xhrSelect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhrSelect.send("position="+position+"&div="+div+"&rub="+rub+"&open="+open+"&todo_div=set");
}

function divSaveEveMonitor(userid,apikey,characterid) {
	var xhrSelect = getXhr();
	xhrSelect.onreadystatechange = function(){
		document.getElementById('eve_html').innerHTML = '<img src="img/template/default/loading.gif" alt="en attente..."/>';
		if(xhrSelect.readyState == 4 && xhrSelect.status == 200){
			//console.log("set :      " + xhrSelect.responseText + "div : " + div + " rub : " + rub + " position :" + position) ;
			document.getElementById('eve_html').innerHTML = xhrSelect.responseText ;
		}
	}
	xhrSelect.open("POST","index.php?action=divs",true);
	xhrSelect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhrSelect.send("userid="+userid+"&apikey="+apikey+"&characterid="+characterid);
}

function getConfigEveMonitor() {
	var xhrSelect = getXhr();
	xhrSelect.onreadystatechange = function(){
		document.getElementById('eve_html').innerHTML = '<img src="img/template/default/loading.gif" alt="en attente..."/>';
		if(xhrSelect.readyState == 4 && xhrSelect.status == 200){
			//console.log("set :      " + xhrSelect.responseText + "div : " + div + " rub : " + rub + " position :" + position) ;
			document.getElementById('eve_html').innerHTML = xhrSelect.responseText ;
			//createColonneDiv(0) ;
		}
	}
	xhrSelect.open("POST","index.php?action=divs",true);
	xhrSelect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhrSelect.send("eve_config=1");
}
