1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
function openPop(theindex,theid,thepop,thedirection,thewidth)
{
// appel aux fonctions AJAX qui affichent les coordonnées de la compagnie ou les données de la facture dans le popup
if(thepop == "invoice") showInvoice(theid);
if(thepop == "company") showCompany(theid);
popupobject = document.getElementById("thepopup");
theobject = document.getElementById(thepop + theindex);
cellwidth = theobject.offsetWidth;
// trouve les coordonnées du coin supérieur gauche de la cellule
x = 0;
y = 0;
while (theobject != null)
{
x = x + theobject.offsetLeft - theobject.scrollLeft;
y = y + theobject.offsetTop - theobject.scrollTop;
theobject = theobject.offsetParent;
}
// si le navigateur est IE, il faut tenir compte du scroll de la page
if (document.all)
{
thescroll = document.documentElement.scrollTop;
}
else
{
thescroll = 0;
}
y = y + thescroll;
if (thedirection == "right") x = x + cellwidth;
if (thedirection == "left") x = x - thewidth;
popupobject.style.display = "block";
popupobject.style.top = y + "px";
popupobject.style.left = x + "px";
popupobject.style.width = thewidth + "px";
} |