(function () {
              var ibmHomePageTabs = {
                     init: function () { 
                                 var con = document.getElementById('ibm-home-tasks'), dl = [], i = 0;                       
                                 var nl = [
                                           document.getElementById('ibm-tab-content-0'),
                                           document.getElementById('ibm-tab-content-1') 
                                          ];                       
                                 var ul = document.getElementById('ibm-home-task-nav');                        
                                 ibmHomePageTabs.tabs = ul.getElementsByTagName('li');                        
                                  for (i = 0; i < ibmHomePageTabs.tabs.length; i++)
                                  {
                                    if (i === 0) 
                                    {
                                      ibmHomePageTabs.tabs.item(i).isFirst = true;
                                    } 
                                    else if (i === (ibmHomePageTabs.tabs.length - 1)) 
                                    {
                                       ibmHomePageTabs.tabs.item(i).isLast = true;
                                    }
                                  }
                                   for (i = 0; i < nl.length; i++) 
                                   {
                                      if (nl[i].nodeName.toLowerCase() === 'div') 
                                      {
                                         dl[dl.length] = nl[i];
                                      }                        
                                   }
                                   for (i = 1; i < dl.length; i++) 
                                   {
                                      dl[i].style.display = 'none';
                                   }  
                                                         
                                   nl = jQuery('div.ibm-tab-content-submenu', con).get();
                                   for (i = 0; i < nl.length; i++) 
                                   {
                                       ibmHomePageTabs.setMenuStyles(nl[i]); 
                                   }   
                                },
                      setMenuStyles: function () { 
                                                   if (arguments.length < 1) {return;} 
                                                   var el = arguments[0];                        
                                                   el.style.backgroundColor = '#FFFFFF';                        
                                                   el.style.border = '#CCC solid 1px';                       
                                                   el.style.display = 'none';                        
                                                   el.style.position = 'absolute';                       
                                                   el.style.width = '208px';                       
                                                   el.style.zIndex = '9';
                                                 }, 
                     deactivateAll: function () {
                                                  var con = document.getElementById('ibm-home-tasks'), i, nd;                        
                                                  if (con === null) {return;}
                                                  var nl = jQuery('div.ibm-active', con).get();
                                                  var len = nl.length; 
                                                  for (i = 0; i < len; i++) 
                                                  {
                                                     nd = nl[i];                                                    
                                                     ibmCommon.deleteClassName(nd, 'ibm-active');
                                                      
                                                     if (nd.nodeName.toLowerCase() === 'div') 
                                                     {
                                                         nd.style.display = 'none';
                                                     }
                                                  }                       
                                                  len = ibmHomePageTabs.tabs.length;                       
                                                  for (i = 0; i < len; i++) 
                                                  {
                                                     nd = ibmHomePageTabs.tabs[i];                                
                                                     if (nd.isFirst) 
                                                     { 
                                                        nd.className = 'ibm-first-tab';
                                                     } 
                                                     else if (nd.isLast) 
                                                     { 
                                                       nd.className = 'ibm-last-tab';      
                                                     } 
                                                     else 
                                                     {                                       
                                                       nd.className = '';                               
                                                     }                        
                                                   }                
                                                  }, 
                     focusContent: function (id) {                        
                                                     var el = document.getElementById(id);                       
                                                     var nl = jQuery('a.ibm-access', el).get();                       
                                                     var len = nl.length;                        
                                                     for (var i = 0; i < len; i++) 
                                                     {                               
                                                        var nd = nl[i];                                
                                                        if (nd.nodeName.toLowerCase() === 'a') 
                                                        {                                        
                                                            nd.focus();                                        
                                                            return;                               
                                                         }                       
                                                      }               
                                                  },
                     setActive: function (ref, id) { 
                                                     var el = null, nn = '', pn = ref.parentNode; 
                                                     ibmHomePageTabs.deactivateAll();                     
                                                     nn = pn.nodeName.toLowerCase();                      
                                                     while (nn !== 'li' && nn !== 'body' && nn !== 'html')
                                                     {                               
                                                          pn = pn.parentNode;                       
                                                     }                        
                                                     if (pn.isFirst)
                                                     {                             
                                                         pn.className = 'ibm-active-first-tab';                  
                                                     } 
                                                     else if (pn.isLast) 
                                                     {                               
                                                        pn.className = 'ibm-active-last-tab';                       
                                                     } 
                                                     else 
                                                     {      
                                                        pn.className = 'ibm-active';   
                                                     }                       
                                                     ibmHomePageTabs.setActivePrevious(pn);               
                                                     ibmHomePageTabs.setActiveNext(pn);                     
                                                     el = document.getElementById(id);                      
                                                     el.className += ' ibm-active';                    
                                                     el.style.display = 'block';                     
                                                     ibmHomePageTabs.focusContent(id);            
                                                   },
                      setActiveNext: function (el) {                    
                                                       var tab = ibmHomePageTabs.getNextTab(el); 
                                                       if (tab === null) {return;}                  
                                                       if (tab.isLast)
                                                       {                         
                                                          tab.className = 'ibm-active-next-last-tab';  
                                                       }
                                                       else
                                                       {            
                                                            tab.className = 'ibm-active-next-tab';   
                                                       }             
                                                    }, 
                     setActivePrevious: function (el) {  
                                                          var tab = ibmHomePageTabs.getPreviousTab(el);
                                                          if (tab === null) {return;}       
                                                          if (tab.isFirst) 
                                                          {            
                                                              tab.className = 'ibm-active-first-previous-tab';
                                                          } 
                                                          else 
                                                          {       
                                                              tab.className = 'ibm-active-previous-tab';   
                                                          }              
                                                          
                                                        },  
                    delay: 400,                
                    delayedSetActive: function (ref, id) {              
                                                            ref._timerId = window.setTimeout(function () 
                                                            {                                       
                                                                ibmHomePageTabs.setActive(ref, id);    
                                                            },
                                                            ibmHomePageTabs.delay); 
                                                         }, 
                    cancelSetActive: function (ref) {                      
                                                        if (ref._timerId) {window.clearTimeout(ref._timerId);}   
                                                        ref._timerId = null;   
                                                     },        
                   delayedHideHPT: function (menuId) {          
                                                        if (!ibmCommon.isDOM) {return;}                       
                                                        var menu = document.getElementById(menuId);   
                                                        if (menu === null) {return;}             
                                                        menu._timerId = window.setTimeout(function () {ibmHomePageTabs.hideHPT(menuId); },
                                                         ibmHomePageTabs.delay);    
                                                      }, 
                   getNextTab: function (el) {       
                                                       if (typeof el.nextSibling === 'undefined') {return null;}  
                                                       var sib = el.nextSibling;                
                                                       while (sib !== null)
                                                       {       
                                                             if (sib.nodeName.toLowerCase() === 'li') {return sib;}  
                                                              sib = sib.nextSibling; 
                                                        }                   
                                                        return null;  
                                              },  
                   getPreviousTab: function (el)  {       
                                                     if (typeof el.previousSibling === 'undefined') {return null;} 
                                                     var sib = el.previousSibling;    
                                                     while (sib !== null) 
                                                     {                            
                                                         if (sib.nodeName.toLowerCase() === 'li') 
                                                         { 
                                                            return sib;
                                                         }     
                                                         sib = sib.previousSibling;
                                                          
                                                         }          
                                                         return null;   
                                                   },            
                   getX: function (el) {              
                                             var x = 0;            
                                             if (el.offsetParent)
                                             {                       
                                                  while (el.offsetParent)
                                                  {   
                                                      x += el.offsetLeft; 
                                                      el = el.offsetParent;
                                                  } 
                                              }
                                              else if (el.x)
                                              {  
                                                    x += el.x;  
                                              }   
                                                    return x;  
                                          },          
                   getY: function (el) {          
                                                    var y = 0;  
                                                    if (el.offsetParent) 
                                                    {                     
                                                               while (el.offsetParent)
                                                               {      
                                                                     y += el.offsetTop; 
                                                                     el = el.offsetParent; 
                                                               }    
                                                     } 
                                                     else if (el.y) 
                                                     {                
                                                         y += el.y;
                                                     }                    
                                                     return y;      
                                          }, 
                   hideAllHPT: function () { 
                                                if (ibmHomePageTabs.hptCache === null) 
                                                {               
                                                    ibmHomePageTabs.hptCache = jQuery('div.ibm-tab-content-submenu', 
                                                    document.documentElement).get();
                                                }             
                                                for (var i = 0; i < ibmHomePageTabs.hptCache.length; i++)
                                                {                               
                                                    ibmHomePageTabs.delayedHideHPT(ibmHomePageTabs.hptCache[i].id); 
                                                }              
                                             },              
                  hideHPT: function (menuId) {                 
                                                   if (!ibmCommon.isDOM) {return;}    
                                                   var menu = document.getElementById(menuId); 
                                                   if (menu === null) {return;}        
                                                   menu.style.display = 'none'; 
                                                   if (menu._timerId) {menu._timerId = null;} 
                                             }, 
                 setPosition: function (menu) {     
                                                  if (!menu._triggerId) {return;}  
                                                  var trig = document.getElementById(menu._triggerId);  
                                                  var x = ibmHomePageTabs.getX(trig);      
                                                  var y = ibmHomePageTabs.getY(trig);  
                                                  menu.style.top = (y - menu.offsetHeight + 18) + 'px';
                                                  menu.style.left = (x + trig.offsetWidth) + 'px'; 
                                              },              
                 showHPT: function (ref, menuId) {      
                                                     if (!ibmCommon.isDOM) {return;} 
                                                     var menu = document.getElementById(menuId); 
                                                     if (menu === null) {return;}   
                                                     var al = menu.getElementsByTagName('a');
                                                     if (al.length < 1)
                                                     {           
                                                           window.location = ref.getAttribute('href'); 
                                                           return;                
                                                     }            
                                                     if (menu._timerId)
                                                    {               
                                                          window.clearTimeout(menu._timerId);  
                                                          menu._timerId = null; 
                                                    }  
                                                    if (ref !== null)
                                                    {        
                                                          if (!ref.id || ref.id === '' || ref.id === null)
                                                          {                      
                                                              ref.id = ibmCommon.generateId();   
                                                          }    
                                                          menu._triggerId = ref.id;  
                                                    }        
                                                    menu.style.display = 'block'; 
                                                    ibmHomePageTabs.setPosition(menu);  
                                                    }, 
                   hptCache: null,         
                   hideSubmenuMarker: function () {
                                                        var sm = document.getElementById('ibm-interest-dd1');  
                                                        if (sm === null) {return;}     
                                                        var al = sm.getElementsByTagName('a');  
                                                        if (al.length > 0) {return;}        
                                                        var a = document.getElementById('ibm-interest-dd1-trigger');  
                                                        a.className = a.className.replace(/ibm-tab-content-submenu-trigger/, ''); 
                                                   },          
                  cancelDelayedHideHPT: function (menuId) {  
                                                                       if (!ibmCommon.isDOM) {return;}   
                                                                       var menu = document.getElementById(menuId);   
                                                                       if (menu && menu._timerId) {window.clearTimeout(menu._timerId);}              
                                                           }, 
                  showAccountsTab: function () {     
                                                        var aud, links, tab, trig; 
                                                        if (typeof window.SA_Message !== 'string') {return;}  
                                                        aud = window.SA_Message.replace(/audience=/, '');    
                                                        if (aud.indexOf('all') !== 0 && aud.indexOf('ibm') !== 0) 
                                                        {                             
                                                             tab = document.getElementById('ibm-home-tab-my-ibm'); 
                                                             if (tab ===  null) {return;}   
                                                             links = tab.getElementsByTagName('a');    
                                                             if (links.length < 1) {return; }     
                                                             trig = links.item(0); 
                                                             ibmHomePageTabs.setActive(trig, 'ibm-tab-content-3');  
                                                         }    
                                                 } 
   };
           window.ibmHomePageTabs = ibmHomePageTabs; 
          window.IBMHomePageTabs = ibmHomePageTabs; 
  })();