test commit marc
[aidenligne_francais_universite.git] / ajax / requetes / requetes.js
CommitLineData
c495c100
P
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
8var defaultMenuWidth="270px" //set default menu width.
9var defaultMenuHeight="191px"
10var ie5=document.all && !window.opera
11var ns6=document.getElementById
12
13if (ie5||ns6)
14document.write('<div id="popUp" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')
15
16function iecompattest(){
17 return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
18}
19
20function 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
57function contains_ns6(a, b) {
58//Determines if 1 element in contained in another- by Brainjar.com
59while (b.parentNode)
60if ((b = b.parentNode) == a)
61return true;
62return false;
63}
64
65function hidemenu(){
66if (window.menuobj)
67menuobj.style.visibility="hidden"
68}
69
70function dynamichide(e){
71if (ie5&&!menuobj.contains(e.toElement))
72hidemenu()
73else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
74hidemenu()
75}
76
77function delayhidemenu(){
78delayhide=setTimeout("hidemenu()",500)
79}
80
81function clearhidemenu(){
82if (window.delayhide)
83clearTimeout(delayhide)
84}
85
86if (ie5||ns6)
87document.onclick=hidemenu