home *** CD-ROM | disk | FTP | other *** search
/ Mundo do CD-ROM 118 / cdrom118.iso / internet / webaroo / WebarooSetup.exe / Webaroo.msi / _4BEF19A896E84C9E9F3E6BC07E6C66DC < prev    next >
Encoding:
Text File  |  2006-01-06  |  3.6 KB  |  108 lines

  1. /***********************************************
  2. * Pop-it menu- ⌐ Dynamic Drive (www.dynamicdrive.com)
  3. * This notice MUST stay intact for legal use
  4. * Visit http://www.dynamicdrive.com/ for full source code
  5. ***********************************************/
  6.  
  7. var defaultMenuWidth="150px"; //set default menu width.
  8.  
  9. var linkset=new Array();
  10. //SPECIFY MENU SETS AND THEIR LINKS. FOLLOW SYNTAX LAID OUT
  11.  
  12. linkset[0]='<a href="#">Subscribe</a>';
  13. linkset[0]+='---------------';
  14. linkset[0]+='<a href="#">Unsubscribe</a>';
  15.  
  16. linkset[1]='<a href="#">Update</a>';
  17. linkset[1]+='<a href="#">Copy to LifeDrive</a>';
  18. linkset[1]+='<a href="#">Copy to SD Card 1</a>';
  19. linkset[1]+='<a href="#">Copy to SD Card 2</a>';
  20. linkset[1]+='---------------';
  21. linkset[1]+='<a href="#">Edit</a>';
  22. linkset[1]+='<a href="#">Remove</a>';
  23.  
  24. linkset[2]='<a href="#">Sync</a>';
  25. linkset[2]+='---------------';
  26. linkset[2]+='<a href="#">Remove</a>';
  27.  
  28. ////No need to edit beyond here
  29.  
  30. var ie5=document.all && !window.opera;
  31. var ns6=document.getElementById;
  32.  
  33. if (ie5||ns6)
  34.     document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>');
  35.  
  36. function iecompattest()
  37. {
  38.     return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body;
  39. }
  40.  
  41. function showmenu(e, which, optWidth)
  42. {
  43.     if (!document.all&&!document.getElementById)
  44.         return;
  45.     clearhidemenu();
  46.     menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu");
  47.     menuobj.innerHTML=which;
  48.     menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth;
  49.     menuobj.contentwidth=menuobj.offsetWidth;
  50.     menuobj.contentheight=menuobj.offsetHeight;
  51.     eventX=ie5? event.clientX : e.clientX;
  52.     eventY=ie5? event.clientY : e.clientY;
  53.     //Find out how close the mouse is to the corner of the window
  54.     var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX;
  55.     var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY;
  56.  
  57.     //if the horizontal distance isn't enough to accomodate the width of the context menu
  58.     if (rightedge<menuobj.contentwidth)
  59.         //move the horizontal position of the menu to the left by it's width
  60.         menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px";
  61.     else
  62.         //position the horizontal position of the menu where the mouse was clicked
  63.         menuobj.style.left=ie5? iecompattest().scrollLeft+eventX+"px" : window.pageXOffset+eventX+"px";
  64.     //same concept with the vertical position
  65.     if (bottomedge<menuobj.contentheight)
  66.         menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px";
  67.     else
  68.         menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY+"px" : window.pageYOffset+eventY+"px";
  69.     menuobj.style.visibility="visible";
  70.     return false;
  71. }
  72.  
  73. function contains_ns6(a, b) 
  74. {
  75.     //Determines if 1 element in contained in another- by Brainjar.com
  76.     while (b.parentNode)
  77.         if ((b = b.parentNode) == a)
  78.             return true;
  79.         return false;
  80. }
  81.  
  82. function hidemenu()
  83. {
  84.     if (window.menuobj)
  85.         menuobj.style.visibility="hidden";
  86. }
  87.  
  88. function dynamichide(e)
  89. {
  90.     if (ie5&&!menuobj.contains(e.toElement))
  91.         hidemenu();
  92.     else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
  93.         hidemenu();
  94. }
  95.  
  96. function delayhidemenu()
  97. {
  98.     delayhide=setTimeout("hidemenu()",500);
  99. }
  100.  
  101. function clearhidemenu()
  102. {
  103.     if (window.delayhide)
  104.         clearTimeout(delayhide);
  105. }
  106.  
  107. if (ie5||ns6)
  108. document.onclick=hidemenu;