includes/clientside/static/dropdown.js
changeset 582 a38876c0793c
parent 523 9d239396be42
child 680 4cc27e7abd60
equal deleted inserted replaced
581:5e8fd89c02ea 582:a38876c0793c
    34 // Adds the jBox CSS to the HTML header. Called on window onload.
    34 // Adds the jBox CSS to the HTML header. Called on window onload.
    35 var jBoxInit = function()
    35 var jBoxInit = function()
    36 {
    36 {
    37   setTimeout('jBoxBatchSetup();', 200);
    37   setTimeout('jBoxBatchSetup();', 200);
    38 }
    38 }
       
    39 addOnloadHook(jBoxInit);
    39 
    40 
    40 // Initializes each menu.
    41 // Initializes each menu.
    41 function jBoxBatchSetup()
    42 function jBoxBatchSetup()
    42 {
    43 {
    43   if ( KILL_SWITCH )
    44   if ( KILL_SWITCH )
   142       }
   143       }
   143     }
   144     }
   144   }
   145   }
   145   if(obj.nextSibling.tagName.toLowerCase() == 'ul' || ( obj.nextSibling.tagName.toLowerCase() == 'div' && obj.nextSibling.className == 'submenu' ))
   146   if(obj.nextSibling.tagName.toLowerCase() == 'ul' || ( obj.nextSibling.tagName.toLowerCase() == 'div' && obj.nextSibling.className == 'submenu' ))
   146   {
   147   {
   147     $dynano(a).addClass('liteselected');
   148     $dynano(obj).addClass('liteselected');
   148     //obj.className = 'liteselected';
   149     //obj.className = 'liteselected';
   149     var ul = obj.nextSibling;
   150     var ul = obj.nextSibling;
   150     var dim = fetch_dimensions(obj);
   151     var dim = fetch_dimensions(obj);
   151     var off = fetch_offset(obj);
   152     var off = fetch_offset(obj);
   152     var dimh = parseInt(dim['h']);
   153     var dimh = parseInt(dim['h']);
   417   }
   418   }
   418 }
   419 }
   419 
   420 
   420 document.onclick = jBoxGarbageCollection;
   421 document.onclick = jBoxGarbageCollection;
   421 
   422 
   422 function removeTextNodes(obj)
       
   423 {
       
   424   if(obj)
       
   425   {
       
   426     if(typeof(obj.tagName) != 'string' || ( String(obj) == '[object Text]' && is_Safari ) )
       
   427     {
       
   428       if ( ( obj.nodeType == 3 && obj.data.match(/^([\s]*)$/ig) ) ) //  || ( typeof(obj.innerHTML) == undefined && is_Safari ) ) 
       
   429       {
       
   430         obj.parentNode.removeChild(obj);
       
   431         return;
       
   432       }
       
   433     }
       
   434     if(obj.firstChild)
       
   435     {
       
   436       for(var i = 0; i < obj.childNodes.length; i++)
       
   437       {
       
   438         removeTextNodes(obj.childNodes[i]);
       
   439       }
       
   440     }
       
   441   }
       
   442 }
       
   443 
       
   444 var getElementsByClassName = function(parent, type, cls) {
   423 var getElementsByClassName = function(parent, type, cls) {
   445   if(!type)
   424   if(!type)
   446     type = '*';
   425     type = '*';
   447   ret = new Array();
   426   ret = new Array();
   448   el = parent.getElementsByTagName(type);
   427   el = parent.getElementsByTagName(type);
   524 document.onmousemove = function(e)
   503 document.onmousemove = function(e)
   525 {
   504 {
   526   setMousePos(e);
   505   setMousePos(e);
   527 };
   506 };
   528 
   507 
   529 function domObjChangeOpac(opacity, id) {
   508 function removeTextNodes(obj)
   530     var object = id.style;
   509 {
   531     object.opacity = (opacity / 100);
   510   if(obj)
   532     object.MozOpacity = (opacity / 100);
   511   {
   533     object.KhtmlOpacity = (opacity / 100);
   512     if(typeof(obj.tagName) != 'string' || ( String(obj) == '[object Text]' && is_Safari ) )
   534     object.filter = "alpha(opacity=" + opacity + ")";
   513     {
   535 }
   514       if ( ( obj.nodeType == 3 && obj.data.match(/^([\s]*)$/ig) ) ) //  || ( typeof(obj.innerHTML) == undefined && is_Safari ) ) 
   536 
   515       {
   537 function getScrollOffset()
   516         obj.parentNode.removeChild(obj);
   538 {
   517         return;
   539   var position;
   518       }
   540   if (self.pageYOffset)
   519     }
   541   {
   520     if(obj.firstChild)
   542     position = self.pageYOffset;
   521     {
   543   }
   522       for(var i = 0; i < obj.childNodes.length; i++)
   544   else if (document.documentElement && document.documentElement.scrollTop)
   523       {
   545   {
   524         removeTextNodes(obj.childNodes[i]);
   546     position = document.documentElement.scrollTop;
   525       }
   547   }
   526     }
   548   else if (document.body)
   527   }
   549   {
   528 }
   550     position = document.body.scrollTop;
   529 
   551   }
       
   552   return position;
       
   553 }
       
   554