//*** Danger: toute manipulation illicite de ce programme peut être dangereuse pour votre ordinateur
// Chott-1964.js
// 2002-03-30

function BulleJava(sChi, sPin, sTra) {
var kBulleLar = 228; //220;
var kBulleHau = 88;   //96;
var iWinLar;
var iWinHau;
var iSelX;
var iSelY;
var iY;
var iX;
var sDes;
var xLar;
var xHau;
var s;
var b;
var sCopyright = '<p id=iXa style="text-align=right; color:#004400; font-family:Verdana; font-size:7pt; margin-top=-32">© Ramou.net &nbsp;</p>';
var sNumero;

  var raSel = document.selection.createRange();
  var oPopup = window.createPopup();
  var oPopupBody = oPopup.document.body;
  oPopupBody.style.backgroundColor = "#FCF9F0";
  oPopupBody.style.border = "solid #720010 1px";
  oPopupBody.style.marginTop = "1px";
  oPopupBody.style.marginLeft = "4px";

  //déplacer au dessus ou à gauche selon la position de iY, iX dans la fenêtre actuelle
  iWinLar = document.body.offsetWidth;
  iWinHau = document.body.offsetHeight;
  iSelY = raSel.offsetTop;
  iSelX = raSel.offsetLeft;
  iY = iSelY + 24;
  if(iY + kBulleHau > iWinHau) iY = iWinHau - kBulleHau;
  iX = iSelX + 24;
  if(iX + kBulleLar > iWinLar) iX = iSelX - kBulleLar - 1;

  //sDes = '<div id=DefChi><p><span id=VocChi style="font-family:MS Song; font-size:20pt;">' + sChi + "</span>&nbsp;" + '<span id=VocPin style="color:#660000; font-family:Arial; font-size:9pt;"> ' + sPin + '</span><br><span id=VocLat style="color:#001166; font-family:Verdana; font-size:8pt;">' + sTra + "</span></p>" + sCopyright + "</div>";

  if(sChi.length == 1) 
    sNumero =  '<p id=NumUnit style="color:#808080; font-family:Verdana; font-size:7pt; margin-top=-16;">' + sChi.charCodeAt(0) + ' - ' + escape(sChi) + '</p>';
  else
    sNumero = '<p id=NumUnit style="color:#808080; font-family:Verdana; font-size:7pt; margin-top=-16;"> &nbsp;</p>';

  //  sDes = '<div id=DefChi><p>' + FormaterDefChi(sChi, sPin, sTra) + '</p>' + sCopyright + '</div>';
    sDes = '<div id=DefChi><p>' + FormaterDefChi(sChi, sPin, sTra) + '</p>' + sNumero + sCopyright + '</div>';

//alert(sDes);
  oPopupBody.innerHTML = sDes;
  sDes = "";
  oPopup.show(iX, iY, kBulleLar, kBulleHau, document.body);
  xLar = oPopup.document.all.DefChi.offsetWidth + 6;
  xHau = oPopup.document.all.DefChi.offsetHeight + 6;
  //alert(xLar + "," + xHau);
  //oPopup.resizeTo = xLar, xHau ;
  oPopup.show(iX, iY, xLar, xHau, document.body);
  s = oPopup.document.all.iXa.innerText;
  b = Chazheng(s, 1154);
  if(!b) {
    oPopupBody.innerHTML = sDes;
  }
}


function FormaterDefChi(sChi, sPin, sTra)
{
  return('<span id=VocChi style="font-family:MS Song; font-size:20pt;">' + sChi + "</span>&nbsp;" + '<span id=VocPin style="color:#660000; font-family:Arial; font-size:9pt;"> ' + sPin + '</span><br><span id=VocLat style="color:#001166; font-family:Verdana; font-size:8pt;">' + sTra + '</span>');
}



//------------------ Utilitaires généraux
function VerifierNavigateur()
// Renvoie le numéro de version d'Internet Explorer ou zéro si autre navigateur
// Source: MSDN
{
var ua = window.navigator.userAgent
var msie = ua.indexOf ( "MSIE " )
  if ( msie > 0 )        // si c'est bien Explorer
      return parseFloat ( ua.substring ( msie+5, ua.indexOf ( ";", msie ) ) )
  else
      return 0    // autre navigateur
}

