function CTransTabs( a_szInstanceVariableName, a_oTransManager, a_oTransSoundManager, a_szTabClassName )
{ var m_szInstanceVariableName = a_szInstanceVariableName; this.m_szInstanceVariableName = m_szInstanceVariableName; var m_oTransManager = a_oTransManager; this.m_oTransManager = m_oTransManager; var m_oTransSoundManager = a_oTransSoundManager; this.m_oTransSoundManager = m_oTransSoundManager; var m_szTabClassName = a_szTabClassName; this.m_szTabClassName = m_szTabClassName; var m_arrTabImageBackgrounds = new Array(); var m_arrTabElements = new Array(); var m_oActiveTab = null; var m_iTabHeight = "30px"; var m_iInactivePaddingTop = "5px"; var m_iActivePaddingTop = "0px"; var m_oCurrentSelectedItem = null; var m_szCurrentSelectedItemId = null; preloadTabImages( { inactive_highlight_left: "images/tab_inactive_highlight_left.gif", inactive_highlight: "images/tab_inactive_highlight.gif", inactive_highlight_right: "images/tab_inactive_highlight_right.gif", inactive_left: "images/tab_inactive_left.gif", inactive: "images/tab_inactive.gif", inactive_right: "images/tab_inactive_right.gif", active_highlight_left: "images/tab_active_highlight_left.gif", active_highlight: "images/tab_active_highlight.gif", active_highlight_right: "images/tab_active_highlight_right.gif", active_left: "images/tab_active_left.gif", active: "images/tab_active.gif", active_right: "images/tab_active_right.gif", drop_shadow_active_right: "images/tab_drop_shadow_active_right.gif", drop_shadow_active_highlight_right: "images/tab_drop_shadow_active_highlight_right.gif", drop_shadow_inactive_right: "images/tab_drop_shadow_inactive_right.gif", drop_shadow_inactive_highlight_right: "images/tab_drop_shadow_inactive_highlight_right.gif"
} ); if(m_szTabClassName)
{ var oCollection = etc("td", m_szTabClassName); for(var i = 0; i < oCollection.length; i++)
{ var oe = oCollection[i]; oe.oleft = ei(oe.id + "_left"); oe.oright = ei(oe.id + "_right"); if((oCollection.length - 1) == i)
{ oe.bLast = true;}
else
{ oe.bLast = false;}
if(0 == i)
{ SetActiveBackgrounds(oe,false); m_oActiveTab = oe;}
else
{ SetInactiveBackgrounds(oe,false);}
if(m_oTransManager)
{ var szSequenceName = oe.id; m_oTransManager.addSequence(szSequenceName, { Line01: m_szInstanceVariableName+".m_oTransSoundManager.playEvent('navBarMouseClick');", Line02: m_szInstanceVariableName+".GetCurrentSelectedItem().otransmultifade.startFadeOut();", Line03: m_szInstanceVariableName+".GetCurrentSelectedItem().otranscontent.hide();", Line04: m_szInstanceVariableName+".SetCurrentSelectedItem('"+szSequenceName+"');", Line05: m_szInstanceVariableName+".GetCurrentSelectedItem().otranscontent.setTransparency(0);", Line06: m_szInstanceVariableName+".GetCurrentSelectedItem().otranscontent.show();", Line07: m_szInstanceVariableName+".GetCurrentSelectedItem().otransmultifade.startFadeIn();"
} );}
oe.otransmultifade = new CTransMultiFade ( m_oTransManager , szSequenceName+"_body" ); oe.otranscontent = new CTransContent ( m_oTransManager , szSequenceName+"_body" ); oe.onclick = itemClick; oe.onmouseover = itemMouseOver; oe.onmouseout = itemMouseOut; oe.style.height = m_iTabHeight; m_arrTabElements.push(oe); if(null == m_oCurrentSelectedItem)
{ SetCurrentSelectedItem(oe.id,true);}
}
if(m_oTransManager)
{ m_oTransManager.addDefaultSequence( { Line01: m_szInstanceVariableName+".m_oTransSoundManager.playEvent('navBarMouseClick');", Line02: m_szInstanceVariableName+".GetCurrentSelectedItem().otransmultifade.startFadeOut();", Line03: m_szInstanceVariableName+".GetCurrentSelectedItem().otransmultifade.startFadeIn();"
} ); m_oTransManager.addSequence("navBarMouseOver", { Line01: m_szInstanceVariableName+".m_oTransSoundManager.playEvent('navBarMouseOver')"
} );}
}
function GetCurrentSelectedItem()
{ if(m_oCurrentSelectedItem)
{ return m_oCurrentSelectedItem;}
else if(m_szCurrentSelectedItemId)
{ m_oCurrentSelectedItem = ei(m_szCurrentSelectedItemId); return m_oCurrentSelectedItem;}
else
{ return null;}
}
this.GetCurrentSelectedItem = GetCurrentSelectedItem; function SetCurrentSelectedItem(a_szNewSelectedItemId,a_bDontContinue)
{ if(a_szNewSelectedItemId)
{ m_szCurrentSelectedItemId = a_szNewSelectedItemId; m_oCurrentSelectedItem = ei(m_szCurrentSelectedItemId); if(a_bDontContinue)
{ }
else
{ if(m_oTransManager)
{ m_oTransManager.continueSequence();}
}
}
}
this.SetCurrentSelectedItem = SetCurrentSelectedItem; function preloadTabImages(a_arrTabImagePairs)
{ for(szTabName in a_arrTabImagePairs)
{ preloadImage(a_arrTabImagePairs[szTabName]); m_arrTabImageBackgrounds[szTabName] = "url('"+a_arrTabImagePairs[szTabName]+"')";}
}
function itemClick(a_e)
{ if(m_oTransManager.isRunning())
{ return;}
var oe = getElementFromEvent(a_e); if(!oe) return; if(oe.id != m_oActiveTab.id)
{ SetInactiveBackgrounds(m_oActiveTab,false); SetActiveBackgrounds(oe,true); m_oActiveTab = oe;}
if( m_oTransManager.getLastSequenceRan() == oe.id )
{ m_oTransManager.runDefaultSequence();}
else
{ m_oTransManager.runSequence(oe.id);}
}
function itemMouseOver(a_e)
{ var oe = getElementFromEvent(a_e); if(!oe) return; if(oe.id != m_oActiveTab.id)
{ SetInactiveBackgrounds(oe,true);}
else
{ SetActiveBackgrounds(oe,true);}
if(m_oTransManager)
{ m_oTransManager.runSequence('navBarMouseOver');}
}
function itemMouseOut(a_e)
{ var oe = getElementFromEvent(a_e); if(!oe) return; if(oe.id != m_oActiveTab.id)
{ SetInactiveBackgrounds(oe,false);}
else
{ SetActiveBackgrounds(oe,false);}
}
function SetInactiveBackgrounds(a_oe, a_bHighlight)
{ if(!a_oe) return; if(a_oe.bLast)
{ if(a_bHighlight)
{ a_oe.oleft.style.backgroundImage = m_arrTabImageBackgrounds['inactive_highlight_left']; a_oe.style.backgroundImage = m_arrTabImageBackgrounds['inactive_highlight']; a_oe.oright.style.backgroundImage = m_arrTabImageBackgrounds['drop_shadow_inactive_highlight_right'];}
else
{ a_oe.oleft.style.backgroundImage = m_arrTabImageBackgrounds['inactive_left']; a_oe.style.backgroundImage = m_arrTabImageBackgrounds['inactive']; a_oe.oright.style.backgroundImage = m_arrTabImageBackgrounds['drop_shadow_inactive_right'];}
}
else
{ if(a_bHighlight)
{ a_oe.oleft.style.backgroundImage = m_arrTabImageBackgrounds['inactive_highlight_left']; a_oe.style.backgroundImage = m_arrTabImageBackgrounds['inactive_highlight']; a_oe.oright.style.backgroundImage = m_arrTabImageBackgrounds['inactive_highlight_right'];}
else
{ a_oe.oleft.style.backgroundImage = m_arrTabImageBackgrounds['inactive_left']; a_oe.style.backgroundImage = m_arrTabImageBackgrounds['inactive']; a_oe.oright.style.backgroundImage = m_arrTabImageBackgrounds['inactive_right'];}
}
a_oe.style.paddingTop = m_iInactivePaddingTop;}
function SetActiveBackgrounds(a_oe, a_bHighlight)
{ if(!a_oe) return; if(a_oe.bLast)
{ if(a_bHighlight)
{ a_oe.oleft.style.backgroundImage = m_arrTabImageBackgrounds['active_highlight_left']; a_oe.style.backgroundImage = m_arrTabImageBackgrounds['active_highlight']; a_oe.oright.style.backgroundImage = m_arrTabImageBackgrounds['drop_shadow_active_highlight_right'];}
else
{ a_oe.oleft.style.backgroundImage = m_arrTabImageBackgrounds['active_left']; a_oe.style.backgroundImage = m_arrTabImageBackgrounds['active']; a_oe.oright.style.backgroundImage = m_arrTabImageBackgrounds['drop_shadow_active_right'];}
}
else
{ if(a_bHighlight)
{ a_oe.oleft.style.backgroundImage = m_arrTabImageBackgrounds['active_highlight_left']; a_oe.style.backgroundImage = m_arrTabImageBackgrounds['active_highlight']; a_oe.oright.style.backgroundImage = m_arrTabImageBackgrounds['active_highlight_right'];}
else
{ a_oe.oleft.style.backgroundImage = m_arrTabImageBackgrounds['active_left']; a_oe.style.backgroundImage = m_arrTabImageBackgrounds['active']; a_oe.oright.style.backgroundImage = m_arrTabImageBackgrounds['active_right'];}
}
a_oe.style.paddingTop = m_iActivePaddingTop;}
}
