Mise en route du suivi.
[aidenligne_francais_universite.git] / ajax / requetes / requetes.js
1
2 /***********************************************
3 * Pop-it menu- © Dynamic Drive (www.dynamicdrive.com)
4 * This notice MUST stay intact for legal use
5 * Visit http://www.dynamicdrive.com/ for full source code
6 ***********************************************/
7
8 var defaultMenuWidth="270px" //set default menu width.
9 var defaultMenuHeight="191px"
10 var ie5=document.all && !window.opera
11 var ns6=document.getElementById
12
13 if (ie5||ns6)
14 document.write('<div id="popUp" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')
15
16 function iecompattest(){
17 return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
18 }
19
20 function infoBulle(e,id){
21
22 if (!document.all&&!document.getElementById)
23 return
24 clearhidemenu()
25
26 menuobj=ie5? document.all.popUp : document.getElementById("popUp")
27 menuobj.innerHTML=unescape("Un momment svp...")
28 //AJAX -> Fonction Ajax pour aller chercher le contenu (texte) dans chaque groupe de mots
29 xajax_infoMot(id)
30 //FIN AJAX
31 menuobj.style.width=defaultMenuWidth
32 menuobj.style.height=defaultMenuHeight
33 menuobj.contentwidth=menuobj.offsetWidth
34 menuobj.contentheight=menuobj.offsetHeight
35 eventX=ie5? event.clientX : e.clientX
36 eventY=ie5? event.clientY : e.clientY
37 //Find out how close the mouse is to the corner of the window
38 var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX
39 var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY
40 //if the horizontal distance isn't enough to accomodate the width of the context menu
41 if (rightedge<menuobj.contentwidth)
42 //move the horizontal position of the menu to the left by it's width
43 menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px"
44 else
45 //position the horizontal position of the menu where the mouse was clicked
46 menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-270+"px" : window.pageXOffset+eventX-270+"px"
47 //same concept with the vertical position
48 if (bottomedge<menuobj.contentheight)
49 menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px"
50 else
51 menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY-190+"px" : window.pageYOffset+eventY-190+"px"
52 menuobj.style.visibility="visible"
53
54 return false
55 }
56
57 function contains_ns6(a, b) {
58 //Determines if 1 element in contained in another- by Brainjar.com
59 while (b.parentNode)
60 if ((b = b.parentNode) == a)
61 return true;
62 return false;
63 }
64
65 function hidemenu(){
66 if (window.menuobj)
67 menuobj.style.visibility="hidden"
68 }
69
70 function dynamichide(e){
71 if (ie5&&!menuobj.contains(e.toElement))
72 hidemenu()
73 else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
74 hidemenu()
75 }
76
77 function delayhidemenu(){
78 delayhide=setTimeout("hidemenu()",500)
79 }
80
81 function clearhidemenu(){
82 if (window.delayhide)
83 clearTimeout(delayhide)
84 }
85
86 if (ie5||ns6)
87 document.onclick=hidemenu