KEY_DOWN	= 40;
KEY_UP		= 38;
KEY_LEFT	= 37;
KEY_RIGHT	= 39;

KEY_END		= 35;
KEY_BEGIN	= 36;



KEY_BACK_TAB 	= 8;
KEY_TAB				= 9;
KEY_SH_TAB  	= 16;
KEY_ENTER			= 13;
KEY_ESC				= 27;
KEY_SPACE			= 32;
KEY_DEL				= 46;

KEY_A		= 65;
KEY_B		= 66;
KEY_C		= 67;
KEY_D		= 68;
KEY_E		= 69;
KEY_F		= 70;
KEY_G		= 71;
KEY_H		= 72;
KEY_I		= 73;
KEY_J		= 74;
KEY_K		= 75;
KEY_L		= 76;
KEY_M		= 77;
KEY_N		= 78;
KEY_O		= 79;
KEY_P		= 80;
KEY_Q		= 81;
KEY_R		= 82;
KEY_S		= 83;
KEY_T		= 84;
KEY_U		= 85;
KEY_V		= 86;
KEY_W		= 87;
KEY_X		= 88;
KEY_Y		= 89;
KEY_Z		= 90;

KEY_PF1		= 112;
KEY_PF2		= 113;
KEY_PF3		= 114;
KEY_PF4		= 115;
KEY_PF5		= 116;
KEY_PF6		= 117;
KEY_PF7		= 118;
KEY_PF8		= 119;

REMAP_KEY_T	= 5019;
	
function checkEventObj ( _event_ ){
	// --- IE explorer
	if ( window.event )
		return window.event;
	// --- Netscape and other explorers
	else
		return _event_;
}
	

  
function applyKey (_event_){
	
	// --- Retrieve event object from current web explorer
	var winObj = checkEventObj(_event_);
	
	var intKeyCode = winObj.keyCode;
	var intAltKey = winObj.altKey;
	var intCtrlKey = winObj.ctrlKey;
		
	// --- Access with [ALT/CTRL+Key]
	if (intAltKey || intCtrlKey) {
		
		if (intKeyCode == KEY_LEFT ){
			
			return false;
		}
		
	}
	// --- Access without [ALT/CTRL+Key]
	else {
		
		if (intKeyCode == KEY_LEFT){
			window.location.replace(u_prev());
			return false;
		}
		if (intKeyCode == KEY_RIGHT){
			window.location.replace(u_suiv());
			return false;
		}
		
	}
	
}


function ajax_keyboard(ida)
{
    var xhr=null;
    
    if (window.XMLHttpRequest) { 
        xhr = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) 
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    //on définit l'appel de la fonction au retour serveur
    xhr.onreadystatechange = function() { alert_ajax(xhr); };
    
    //on affiche le message d'acceuil
    document.getElementById("message").className="tumevois";
    
    //on appelle le fichier reponse.txt
    xhr.open("GET", "http://www.stopcarotte.com/includes/php/reponse_keyboard.php?ida="+ida, true);
    xhr.send(null);
}

function alert_ajax_keyboard(xhr)
{
    if (xhr.readyState==4) 
    {
    	var docXML= xhr.responseXML;
    	var items = docXML.getElementsByTagName("donnee")
		var new_contenu = '';
    	//on fait juste une boucle sur chaque element "donnee" trouvé
    	document.getElementById("message").className="tumevoispas";
    	for (i=0;i<items.length;i++)
    	{
    		alert (items.item(i).firstChild.data);
			new_contenu += items.item(i).firstChild.data;
    	}
		modifWhiteContent(new_contenu);
    }
}
