// Preload images
if (document.images) {
    var eventtabs = new Array;
    var eventtabscount = 2;
    for (var i = 0; i < eventtabscount; i++) {
        eventtabs[i + '0'] = new Image();
        eventtabs[i + '0'].src = '/BA/Images/homepage/events/tabs/event_tab_' + i + '_inactive.gif';
        eventtabs[i + '1'] = new Image();
        eventtabs[i + '1'].src = '/BA/Images/homepage/events/tabs/event_tab_' + i + '_active.gif';
    }
    var topictabs = new Array;
    var topictabscount = 3;
    for (var j = 0; j < topictabscount; j++) {
        topictabs[j + '0'] = new Image();
        topictabs[j + '0'].src = '/BA/Images/homepage/topics/tabs/topic_tab_' + j + '_inactive.gif';
        topictabs[j + '1'] = new Image();
        topictabs[j + '1'].src = '/BA/Images/homepage/topics/tabs/topic_tab_' + j + '_active.gif';
    }
}

/// <summary>
/// Toggles the presentation of the tabs
/// </summary>
/// <param name="tabs">The container tab</param>
/// <param name="activetabid">The tab index</param>
/// <param name="isimage">is image tab</param>
/// <param name="imagearray">image array</param>
function SetTabs(tabs,activetabid,isimage,imagearray)
{
	// shortcut way of getting the number of tabs
	var tabs = document.getElementById(tabs).childNodes;
	for(i=0; i<tabs.length;i++)
	{
		var curtab = (tabs[i].id);
		if (isimage) {
		    if (typeof(imagearray)=='object') {
		        // set the tabs presentation
		        if (curtab == activetabid) {
		            //active tab - set the tab presentation
		            document.getElementById(curtab + '_widget').className = 'tab tab_active tab_active_bg ';
		            document.getElementById(curtab + '_image').src = imagearray[i + '1'].src;
		            //active tab - set the tab panel 
		            document.getElementById(curtab + '_panel').className = 'show';
		        }
		        else {
		            //inactive tab - set the tab presentation
		            document.getElementById(curtab + '_widget').className = 'tab tab_inactive tab_inactive_bg';
		            document.getElementById(curtab + '_image').src = imagearray[i + '0'].src;
		            //inactive tab - set the tab panel 
		            document.getElementById(curtab + '_panel').className = 'hide';
		        }
		    }
		}
		else
		{
			// set the tabs presentation
			if (curtab == activetabid) {
				//active tab - set the tab presentation
				document.getElementById(curtab+'_widget').className='tab tab_active tab_active_bg ';
				//active tab - set the tab panel 
				document.getElementById(curtab+'_panel').className='show';
			}
			else {
				//inactive tab - set the tab presentation
				document.getElementById(curtab+'_widget').className='tab tab_inactive tab_inactive_bg';
				//inactive tab - set the tab panel 
				document.getElementById(curtab+'_panel').className='hide';
			}
		}
	}
}



