var divName = 'dictionary';
var Timer = null;
var dataStore = new Object();
var dictionaryArray = ["All-in", "Bad beat", "Bankroll", "Bet limit", "Big blind", "Blind", "Bluff", "WSOP", "Bonus", "Bonus seeker (cacciatore di bonus)", "Buy-in", "Doppia coppia", "Call", "Torneo", "Cash-game", "Checking", "Common cards", "Dealer", "Dealer Button", "Deposito", "ECOOP", "Flop", "Flush", "Four of a kind", "Freeroll", "Full House", "Hand", "Lobby", "Multi-table tournaments", "No limit pot", "Odds", "Outs", "Il River", "Pair", "Play money ", "Pocket cards", "WOPC", "Fold", "Pool", "Pot", "Pot limit", "Tre di un tipo", "Il Turn", "Prize Pool", "Raise", "Rake", "WPT", "Table", "Re-buy", "Royal Flush", "Satellite", "Straight Flush", "Showdown", "Sit\'n\'go", "Small blind", "Test", "Tassa", "Solo biglietto"]; //here we load all the terms from the lexique from the database
var intellitext_path = '/jscripts/intellitext/'
if(document.implementation && document.implementation.createDocument) var isMozilla=true;
else var isMozilla=false;
document.write('
');
function URLEncode (clearString) {
var output = '';
var x = 0;
clearString = clearString.toString();
var regex = /(^[a-zA-Z0-9_.]*)/;
while (x < clearString.length) {
var match = regex.exec(clearString.substr(x));
if (match != null && match.length > 1 && match[1] != '') {
output += match[1];
x += match[1].length;
} else {
if (clearString[x] == ' ')
output += '+';
else {
var charCode = clearString.charCodeAt(x);
var hexVal = charCode.toString(16);
output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
}
x++;
}
}
return output;
}
function hideMessage(){
var MessageObj=$(divName);
MessageObj.style.visibility="hidden";
}
function clearTimer() {
if (Timer) {
clearTimeout(Timer);
Timer = null;
}
}
function setTimer() {
Timer = window.setTimeout('hideMessage()', 250);
}
window.size = function()
{
var w = 0;
var h = 0;
//IE
if(!window.innerWidth)
{
//strict mode
if(!(document.documentElement.clientWidth == 0)) {
w = document.documentElement.clientWidth;
h = document.documentElement.clientHeight;
}
//quirks mode
else {
if(document.body.clientWidth) {
w = document.body.clientWidth;
h = document.body.clientHeight;
} else {
w = window.document.body.offsetWidth;
h = window.document.body.offsetHeight;
}
}
}
//w3c
else {
w = window.innerWidth;
h = window.innerHeight;
}
return {width:w,height:h};
}
function adjustMessage(evt) {
var left;
var top;
clearTimer();
MessageObj = $(divName);
if (isMozilla) event=evt;
wsize = window.size();
var rightedge = wsize.width-event.clientX;
var bottomedge = wsize.height-event.clientY;
// Compliance with HTML 4/XHTML
if(document.documentElement && document.documentElement.scrollTop)
scrollTop = document.documentElement.scrollTop;
else
scrollTop = document.body.scrollTop;
// Compliance with HTML 4/XHTML
if(document.documentElement && document.documentElement.scrollLeft)
scrollLeft = document.documentElement.scrollLeft;
else
scrollLeft = document.body.scrollLeft;
if (rightedge < MessageObj.offsetWidth)
left = scrollLeft + event.clientX - MessageObj.offsetWidth;
else
left = scrollLeft + event.clientX;
if (bottomedge < MessageObj.offsetHeight)
top = scrollTop + event.clientY - MessageObj.offsetHeight;
else
top = scrollTop + event.clientY;
MessageObj.style.top = (top)+"px";
MessageObj.style.left = (left)+"px";
MessageObj.innerHTML = '
Voir la définition ...
';
MessageObj.style.visibility = "visible";
}
/*
GET THE DEFINITION USING AJAX - STORE THE RESULT SO WE DONT NEEED TO RETRIEVE IT ALL THE TIME
*/
function getDefinition(term,evt){
adjustMessage(evt);
//check if it exists in the dataStore
if(dataStore[encodeURIComponent(term)]) {
MessageObj.innerHTML = '
';
} else {
var url = intellitext_path + 'lexique.php?word=' + URLEncode(term);
//var url = intellitext_path + 'lexique.php;
new Ajax.Request(url, {method: 'post',
onComplete:function(text){
//store the term and its definition in an array
dataStore[encodeURIComponent(term)] = text.responseText;
MessageObj.innerHTML = '