window.onresize = get_width;

function getCookie(Nom) {
	var Paires = document.cookie.split('; ');
	for (var i = 0; i < Paires.length; i++){
		Paires[i] = Paires[i].split('=');
		if (Paires[i][0] == Nom)
			return unescape(Paires[i][1]);
	}
	return null;
}

function get_width() {
	l2 = screen.width;
	h2 = screen.height;
	l = document.body.offsetWidth;
	h = document.body.offsetHeight;
	if (getCookie('Width') != l) {
		oldl = getCookie('Width');
	//	document.Cadran.info.value = 'envoi cookie';
		Jours = 360 * 24 * 60 * 60 * 1000;
		var DateFin = new Date();
		DateFin.setTime( DateFin.getTime() + Jours );
		var Cookie = 'Width=' + l + '; ';
		Cookie += 'expires=' + DateFin.toGMTString() + ';';
		document.cookie = Cookie;
	/*	// if (l < 600)
		// 		window.location.replace('./mobile/');
		if (numAffichage(l) != numAffichage(oldl) && getCookie('Width') == l) {
			window.location.replace('./');
		}*/
	}
}

function numAffichage(l) {
	a = 4;
	if (l < 1600) {
		a = 3;
	}
	if (l < 1350) {
		a = 2;
	}
	if (l < 1250) {
		a = 1;
	}
	return a;
}


