/******************************************************************************
*
* tabsHelper.js
* Version: 1.0
* Date: 26.08.2009
* Copyright: Copyright 2009, Infotrepid Tomaz Klemse s.p.
* http: http://www.infotrepid.com
*
******************************************************************************
*
* Helper for tabs buttons
*
******************************************************************************
*
* How to use:
* 1. add script tag into the head tag:
* 	<script language="javascript" type="text/javascript" src="tabsHelper.js"></script>
*
* 2. create button and specifiy the link:
*   example->
*   <ul class="tabButtons">
*       <li><a href="javascript:itemTabs.showTab(0);">Main</a></li>
*       <li><a href="javascript:itemTabs.showTab(1);">Details</a></li>
*       ...
*   </ul>
*
* 3. under the tabs content place the following script (example->):
* 	<script language="javascript" type="text/javascript">
*           itemTabs = new tabsHelper('item',5);
*           itemTabs.showTab(0);
* 	</script>
*
* Note:
* parameter "tabObjectName" will be completed in the following way:
* for tab content -> parameter + Tab_
* for tab button -> parameter + TabButton_
* >>> for tab content use id: parameterTab_0, parameterTab_1, ...
* >>> for tab buttons use id: parameterTabButton_0, parameterTabButton_1, ...
* the class of active tab button will be changed to "activeTabButton"
* other tab buttons will be changed to "tabButton"
*
******************************************************************************/

/**
 * Tabs helper object
 */
function tabsHelper(tabObjectName,nrOfTabs)
{
    this.tabContentName = tabObjectName + 'Tab_';
    this.tabButtonName = tabObjectName + 'TabButton_';
    this.nrOfTabs = nrOfTabs;
}


/**
 * show the required tab
 */
tabsHelper.prototype.showTab = function(showTabNr)
{
    for(var i=0;i<this.nrOfTabs;i++)
    {
        document.getElementById(this.tabContentName+i).style.display = 'None';
        document.getElementById(this.tabButtonName+i).className = 'tabButton';
    }
    document.getElementById(this.tabContentName+showTabNr).style.display = '';
    document.getElementById(this.tabButtonName+showTabNr).className = 'activeTabButton';
}
