var tabArray = ["aboutResveratrol","organicSourcing","research","inTheMedia"];

function ShowTab(tab)
{
    CloseAllTabs();
    if( $(tab) )
    {
        $(tab).show();
        $(tab + "_tab").className = "on";
    }
}

function CloseAllTabs()
{
    for(i = 0; i < tabArray.length; i++)
    {
        if( $(tabArray[i]) )
        {
            $(tabArray[i]).hide();
            $(tabArray[i] + "_tab").className = "off";
        }
    }
}

function WirePage()
{
    for(var i = 0; i < tabArray.length; i++)
    {
        $(tabArray[i] + "_tab").onclick = function() { ShowTab(this.id.replace('_tab', '')); }
    }
}
window.onload = WirePage;
