5 * please keep this disclaimer and send me a message if you intend to use the script
9 cMoTabs.getTabGroup = function( hElement )
11 return getParentByTagName( hElement, 'UL' )
14 cMoTabs.getTabElement = function( hElement )
16 if( hElement == null )
22 if( typeof hElement.tagName == 'undefined' ) return null
28 return getParentByProperty( hElement, 'className', 'tab' )
32 cMoTabs.setActiveTabElement = function( hTabElement )
34 if( hTabElement == null )
38 hTabElement.className = 'tabactive'
39 var hView = document.getElementById( hTabElement.getAttribute( 'tabview' ) )
42 hView.style.display = 'block'
46 cMoTabs.setInactiveTabElement = function( hTabElement )
48 if( hTabElement == null )
52 hTabElement.className = 'tab'
53 var hView = document.getElementById( hTabElement.getAttribute( 'tabview' ) )
56 hView.style.display = 'none'
60 cMoTabs.doTab = function( e )
63 var hTabElement = null
65 if( e.type.indexOf( 'keypress' ) > -1 )
73 hTabElement = cMoTabs.getTabElement( cDomEvent.target )
75 if ( hTabElement != null )
77 //var hLink = getSubNodeByName( hTabElement, 'a' )
79 var hGroup = cMoTabs.getTabGroup( hTabElement )
80 if( hGroup.hAcvtiveElm == null )
82 var hActiveTab = getSubNodeByProperty( hTabElement.parentNode, 'className', 'tabactive' )
86 var hActiveTab = hGroup.hAcvtiveElm
88 if( hActiveTab == hTabElement )
93 cMoTabs.setInactiveTabElement( hActiveTab )
94 cMoTabs.setActiveTabElement( hTabElement )
95 hGroup.hAcvtiveElm = hTabElement
101 cMoTabs.doTabClick = function( e )
104 if( e.preventDefault )
108 e.cancelBubble = false
109 e.returnValue = false
113 cMoTabs.init = function( hListItem )
115 var hLink = getSubNodeByName( hListItem, 'a' )
116 cDomEvent.addEvent( hLink, 'activate', cMoTabs.doTab, false )
117 cDomEvent.addEvent( hLink, 'focus', cMoTabs.doTab, false )
118 cDomEvent.addEvent( hLink, 'mousedown', cMoTabs.doTab, false )
119 cDomEvent.addEvent( hLink, 'keypress', cMoTabs.doTab, false )
120 cDomEvent.addEvent( hLink, 'click', cMoTabs.doTabClick, false )
124 cDomExtensionManager.register( new cDomExtension( document, [ "li[tabview]" ], cMoTabs.init ) )