// Wrapper function to optionally display the sub-tabs
function displaySubTabs(iSelectedTabIndex, bSessionExists) {
    if (miLoggedInUserType > 0 || miMicroSiteId > 1) {
        displayTabs(iSelectedTabIndex, bSessionExists);
    }
}

// Displays the sub-tabs
function displayTabs(iSelectedTabIndex, bSessionExists) {
    if (miLoggedInUserType > 0 || miMicroSiteId > 1) {
	var objTabBar = document.getElementById("navcontainer");
	var sTabSource = "";
		
	sTabSource += 
		'<ul id="sub-menu">';
		
	// Only display Welcome tab for Fantastar parent site
	/*if (miMicroSiteId == 1) {
		sTabSource += 
		'<li id="' + getActiveTab(iSelectedTabIndex, 1) + '"><a href="../General/fantastar-fantasy-leagues.aspx" id="' + getCurrentTab(iSelectedTabIndex, 1) + '">Welcome</a></li>';
	}*/
	
	// Show 'Welcome' or relevant micro-site tabs
	// MICROSITE-BLOCK - extend this code when adding a new microsite
	switch (miMicroSiteId) {
		case 1:
			// Fantastar parent site
				break;
		case 2:
			// Olympics micro-site
			// Don't display these tabs if admin or super
			if (miLoggedInUserType != 2 && miLoggedInUserType != 3) {
				sTabSource += 
					'<li id="' + getActiveTab(iSelectedTabIndex, 12) + '"><a href="../Olympics/OlympicsHome.aspx?CompId=1" id="' + getCurrentTab(iSelectedTabIndex, 12) + '">Welcome</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 13) + '"><a href="../Olympics/OlympicsTeam.aspx?CompId=1" id="' + getCurrentTab(iSelectedTabIndex, 13) + '">Team GB</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 14) + '"><a href="../Olympics/OlympicsRules.aspx?CompId=1" id="' + getCurrentTab(iSelectedTabIndex, 14) + '">Rules</a></li>';	
					break;
			}
		case 3:
			// Hockey Olympics micro-site
			if (miLoggedInUserType != 2 && miLoggedInUserType != 3) {
			sTabSource += 
				'<li id="' + getActiveTab(iSelectedTabIndex, 12) + '"><a href="../HockeyOlympics/HockeyOlympicsHome.aspx?CompId=1" id="' + getCurrentTab(iSelectedTabIndex, 12) + '">Fantasy Hockey</a></li>'+
				'<li id="' + getActiveTab(iSelectedTabIndex, 14) + '"><a href="../HockeyOlympics/HockeyOlympicsRules.aspx?CompId=1" id="' + getCurrentTab(iSelectedTabIndex, 14) + '">Rules</a></li>';	
				break;
			}
		case 4:
			// EIHL micro-site
				/*sTabSource += 
				'<li id="' + getActiveTab(iSelectedTabIndex, 1) + '"><a href="../General/fantastar-fantasy-leagues.aspx" id="' + getCurrentTab(iSelectedTabIndex, 1) + '">Welcome</a></li>';*/
				break;
			/*if (miLoggedInUserType != 2 && miLoggedInUserType != 3) {
				sTabSource += 
					'<li id="' + getActiveTab(iSelectedTabIndex, 12) + '"><a href="../EIHL/EIHLHome.aspx?CompId=1" id="' + getCurrentTab(iSelectedTabIndex, 12) + '">Fantasy EIHL</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 13) + '"><a href="../EIHL/EIHLTeam.aspx?CompId=1" id="' + getCurrentTab(iSelectedTabIndex, 13) + '">Teams</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 14) + '"><a href="../EIHL/EIHLRules.aspx?CompId=1" id="' + getCurrentTab(iSelectedTabIndex, 14) + '">Rules</a></li>';	
					break;
			}*/
		case 5:
			// BBL micro-site
			if (miLoggedInUserType != 2 && miLoggedInUserType != 3) {
				sTabSource += 
					'<li id="' + getActiveTab(iSelectedTabIndex, 12) + '"><a href="../BBL/BBLHome.aspx?CompId=1" id="' + getCurrentTab(iSelectedTabIndex, 12) + '">Fantasy Basketball</a></li>'+
					//'<li id="' + getActiveTab(iSelectedTabIndex, 13) + '"><a href="../BBL/BBLTeam.aspx?CompId=1" id="' + getCurrentTab(iSelectedTabIndex, 13) + '">Teams</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 14) + '"><a href="../BBL/BBLRules.aspx?CompId=1" id="' + getCurrentTab(iSelectedTabIndex, 14) + '">Rules</a></li>';	
					break;
			}
		case 6:
			// Template micro-site
			if (miLoggedInUserType != 2 && miLoggedInUserType != 3) {
				sTabSource += 
					'<li id="' + getActiveTab(iSelectedTabIndex, 12) + '"><a href="../Microsite/MicrositeHome.aspx?MyLeagueID=' + sActiveMicrositeLeagueID + '" id="' + getCurrentTab(iSelectedTabIndex, 12) + '">Welcome</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 13) + '"><a href="../Microsite/MicrositeRules.aspx" id="' + getCurrentTab(iSelectedTabIndex, 13) + '">Rules</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 14) + '"><a href="../Microsite/MicrositeFixturesResults.aspx" id="' + getCurrentTab(iSelectedTabIndex, 14) + '">Fixtures</a></li>';
				if (miLoggedInUserType == 0) {
				sTabSource += 
				    //'<li id="' + getActiveTab(iSelectedTabIndex, 8) + '"><a href="../General/uageJoinLeague.aspx?strLeaguePassword=samplesite1" id="' + getCurrentTab(iSelectedTabIndex, 8) + '">Join League</a></li>'+
				    '<li id="' + getActiveTab(iSelectedTabIndex, 8) + '"><a href="../General/uageLogin.aspx" id="' + getCurrentTab(iSelectedTabIndex, 8) + '">Sign In</a></li>';
				}
				break;
			}
		case 7:
			// HNZ micro-site
			if (miLoggedInUserType != 2 && miLoggedInUserType != 3) {
				sTabSource += 
				'<li id="' + getActiveTab(iSelectedTabIndex, 12) + '"><a href="../HockeyNewZealand/HNZHome.aspx" id="' + getCurrentTab(iSelectedTabIndex, 12) + '">Fantasy Hockey</a></li>'+
				'<li id="' + getActiveTab(iSelectedTabIndex, 14) + '"><a href="../HockeyNewZealand/HNZRules.aspx" id="' + getCurrentTab(iSelectedTabIndex, 14) + '">Rules</a></li>'+
				'<li id="' + getActiveTab(iSelectedTabIndex, 15) + '"><a href="../HockeyNewZealand/HNZFixtures.aspx" id="' + getCurrentTab(iSelectedTabIndex, 15) + '">Fixtures</a></li>';
					break;
			}
		case 8:
			// Eng Basketball micro-site
			if (miLoggedInUserType != 2 && miLoggedInUserType != 3) {
				sTabSource += 
					'<li id="' + getActiveTab(iSelectedTabIndex, 12) + '"><a href="../EnglandBasketball/EnglandBasketballHome.aspx" id="' + getCurrentTab(iSelectedTabIndex, 12) + '">Fantasy Basketball</a></li>'+
					//'<li id="' + getActiveTab(iSelectedTabIndex, 13) + '"><a href="../EnglandBasketball/EnglandBasketballTeam.aspx" id="' + getCurrentTab(iSelectedTabIndex, 13) + '">Teams</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 14) + '"><a href="../EnglandBasketball/EnglandBasketballRules.aspx" id="' + getCurrentTab(iSelectedTabIndex, 14) + '">Rules</a></li>';	
					break;
			}
		case 9:
			// Eng Hockey micro-site
			if (miLoggedInUserType != 2 && miLoggedInUserType != 3) {
				sTabSource += 
					'<li id="' + getActiveTab(iSelectedTabIndex, 12) + '"><a href="../EnglandHockeyLeague/EHLHome.aspx" id="' + getCurrentTab(iSelectedTabIndex, 12) + '">EHL Home</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 13) + '"><a href="../EnglandHockeyLeague/EHLRules.aspx" id="' + getCurrentTab(iSelectedTabIndex, 13) + '">Rules</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 14) + '"><a href="../EnglandHockeyLeague/EHLFixturesResults.aspx" id="' + getCurrentTab(iSelectedTabIndex, 14) + '">Fixtures/Results</a></li>';
					break;
			}
		case 10:
			// 4 Nations handball micro-site
			if (miLoggedInUserType != 2 && miLoggedInUserType != 3) {
				sTabSource += 
					'<li id="' + getActiveTab(iSelectedTabIndex, 12) + '"><a href="../BritishHandball/BritishHandballHome.aspx" id="' + getCurrentTab(iSelectedTabIndex, 12) + '">Fantasy Handball</a></li>'+
					//'<li id="' + getActiveTab(iSelectedTabIndex, 13) + '"><a href="../BritishHandball/BritishHandballTeam.aspx" id="' + getCurrentTab(iSelectedTabIndex, 13) + '">Teams</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 14) + '"><a href="../BritishHandball/BritishHandballRules.aspx" id="' + getCurrentTab(iSelectedTabIndex, 14) + '">Rules</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 15) + '"><a href="../BritishHandball/BritishHandballFixtures.aspx" id="' + getCurrentTab(iSelectedTabIndex, 15) + '">Fixtures</a></li>';	
					break;
			}
		case 11:
			// 6 Nations micro-site
			if (miLoggedInUserType != 2 && miLoggedInUserType != 3) {
				sTabSource += 
					'<li id="' + getActiveTab(iSelectedTabIndex, 12) + '"><a href="../6Nations/6_Nations_Home.aspx" id="' + getCurrentTab(iSelectedTabIndex, 12) + '">6 Nations Home</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 13) + '"><a href="../6Nations/6_Nations_Rules.aspx" id="' + getCurrentTab(iSelectedTabIndex, 13) + '">Rules</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 14) + '"><a href="../6Nations/6_Nations_Fixtures_Results.aspx" id="' + getCurrentTab(iSelectedTabIndex, 14) + '">Fixtures</a></li>';	
					break;
			}
		case 12:
			// Fantasy Rugby League micro-site
			if (miLoggedInUserType != 2 && miLoggedInUserType != 3) {
				sTabSource += 
					'<li id="' + getActiveTab(iSelectedTabIndex, 12) + '"><a href="../FantasyRugbyLeague/Rugby_League_Home.aspx" id="' + getCurrentTab(iSelectedTabIndex, 12) + '">Welcome</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 13) + '"><a href="../FantasyRugbyLeague/Rugby_League_Rules.aspx" id="' + getCurrentTab(iSelectedTabIndex, 13) + '">Rules</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 14) + '"><a href="../FantasyRugbyLeague/Rugby_League_Fixtures_Results.aspx" id="' + getCurrentTab(iSelectedTabIndex, 14) + '">Fixtures/Results</a></li>';	
				if (miLoggedInUserType == 0) {
				sTabSource += 
				    '<li id="' + getActiveTab(iSelectedTabIndex, 8) + '"><a href="../General/uageJoinLeague.aspx?strLeaguePassword=fantasyrugbyleague" id="' + getCurrentTab(iSelectedTabIndex, 8) + '">Join League</a></li>'+
				    '<li id="' + getActiveTab(iSelectedTabIndex, 8) + '"><a href="../General/uageLogin.aspx" id="' + getCurrentTab(iSelectedTabIndex, 8) + '">Sign In</a></li>';
				}
					break;
			}
		case 13:
			// Lions micro-site
			if (miLoggedInUserType != 2 && miLoggedInUserType != 3) {
				sTabSource += 
					'<li id="' + getActiveTab(iSelectedTabIndex, 12) + '"><a href="../FantasyLions/Fantasy-Lions-Home.aspx" id="' + getCurrentTab(iSelectedTabIndex, 12) + '">Lions Home</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 13) + '"><a href="../FantasyLions/Fantasy-Lions-Rules.aspx" id="' + getCurrentTab(iSelectedTabIndex, 13) + '">Rules</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 14) + '"><a href="../FantasyLions/Fantasy-Lions-Fixtures-Results.aspx" id="' + getCurrentTab(iSelectedTabIndex, 14) + '">Fixtures</a></li>';	
					break;
			}
		case 14:
			// Ashes micro-site
			if (miLoggedInUserType != 2 && miLoggedInUserType != 3) {
				sTabSource += 
					'<li id="' + getActiveTab(iSelectedTabIndex, 12) + '"><a href="../FantasyAshesCricket/Fantasy-Ashes-Home.aspx" id="' + getCurrentTab(iSelectedTabIndex, 12) + '">Ashes Home</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 13) + '"><a href="../FantasyAshesCricket/Fantasy-Ashes-Rules.aspx" id="' + getCurrentTab(iSelectedTabIndex, 13) + '">Rules</a></li>'+
					'<li id="' + getActiveTab(iSelectedTabIndex, 14) + '"><a href="../FantasyAshesCricket/Fantasy-Ashes-Fixtures-Results.aspx" id="' + getCurrentTab(iSelectedTabIndex, 14) + '">Fixtures/Results</a></li>';	
					break;
			}
	}
			
     // Not Logged In		
	if (miLoggedInUserType == 0) {
		switch (miMicroSiteId) {
			case 1:
				// Fantastar parent site
				sTabSource += 
					'<li id="' + getActiveTab(iSelectedTabIndex, 9) + '"><a href="../General/uageLeagueMessageSectionList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 9) + '">Talk</a></li>';
					//'<li id="' + getActiveTab(iSelectedTabIndex, 10) + '"><a href="../General/uageTrumpTypeList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 10) + '">Trumps</a></li>';	
					break;
		}
	}
	
	// League type specifics
	switch (miLeagueType) {
		case 14:
			// XFM Bands
			sTeamLabel = "Bands";
			sPlayerLabel = "Artist";
			sFantasyTeamLabel = "Band";
			sProfileLabel = "Artist ";
			break;
		case 16:
			// Olympics
			sTeamLabel = "Team";
			sPlayerLabel = "Athlete";
			sFantasyTeamLabel = "Team";
			sProfileLabel = "";
			break;
		default:
			sTeamLabel = "Teams";
			sPlayerLabel = "Player";
			sFantasyTeamLabel = "Team";
			sProfileLabel = "Player ";
			break;
	}
	
	//Logged In
	if ((typeof(bSessionExists) == "undefined" || bSessionExists != false) && mbDisplayTabs == true) {
		
		switch (miLoggedInUserType) {
			// Manager
			case 1:
				if (mbDisplayLeagueTabs == true) {			
				sTabSource += 
					'<li id="' + getActiveTab(iSelectedTabIndex, 2) + '"><a href="../Manager/uamaManagerHome.aspx" id="' + getCurrentTab(iSelectedTabIndex, 2) + '">News Feed</a></li>' +
					'<li id="' + getActiveTab(iSelectedTabIndex, 3) + '"><a href="../Manager/uamaTeamPage.aspx" id="' + getCurrentTab(iSelectedTabIndex, 3) + '">My ' + sFantasyTeamLabel + '</a></li>' +
					'<li id="' + getActiveTab(iSelectedTabIndex, 4) + '"><a href="../Manager/uamaMiniLeagueSearch.aspx" id="' + getCurrentTab(iSelectedTabIndex, 17) + '">Mini League</a></li>' +
					'<li id="' + getActiveTab(iSelectedTabIndex, 4) + '"><a href="../Manager/uamaLeagueTable.aspx?i32LeaderboardType=1" id="' + getCurrentTab(iSelectedTabIndex, 4) + '">League Table</a></li>';
					// Show 'Results' tab for Olympic micro-site
					if (miMicroSiteId == 2) {
					sTabSource += 
						'<li id="' + getActiveTab(iSelectedTabIndex, 6) + '"><a href="../Manager/uamaFixturesList.aspx?i32LeagueTeamID=869&strLeagueTeamName=GBR" id="' + getCurrentTab(iSelectedTabIndex, 6) + '">Results</a></li>';
					}
					// Hide 'Teams' tab for some micro-sites (GB Olympics)
					if (miMicroSiteId != 2 && miMicroSiteId != 13 && msEmbeddedFlag != "Y") {
					sTabSource += 
						'<li id="' + getActiveTab(iSelectedTabIndex, 6) + '"><a href="../Manager/uamaLeagueTeams.aspx" id="' + getCurrentTab(iSelectedTabIndex, 6) + '">' + sTeamLabel + '</a></li>';
					}	
					sTabSource +=				
						'<li id="' + getActiveTab(iSelectedTabIndex, 7) + '"><a href="../Manager/uamaPlayerLeaderboard.aspx?i32LeaderboardType=1" id="' + getCurrentTab(iSelectedTabIndex, 7) + '">' + sPlayerLabel + 's</a></li>';
					// Hide certain tabs for the Olympics
					if (miMicroSiteId == 1 || miMicroSiteId == 4) {
					sTabSource += 
						'<li id="' + getActiveTab(iSelectedTabIndex, 5) + '"><a href="../Manager/uamaSelectYourPlayer.aspx" id="' + getCurrentTab(iSelectedTabIndex, 5) + '">' + sProfileLabel + 'Profile</a></li>';
					}
					sTabSource += 
						'<li id="' + getActiveTab(iSelectedTabIndex, 9) + '"><a href="../General/uageLeagueMessageSectionList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 9) + '">Talk</a></li>';
					// Hide certain tabs for the Olympics
					if (miMicroSiteId == 1 || miMicroSiteId == 4) {
					sTabSource += 
						'<li id="' + getActiveTab(iSelectedTabIndex, 10) + '"><a href="../General/uageTrumpTypeList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 10) + '">Trumps</a></li>';
					}
					sTabSource += 
						'<li id="' + getActiveTab(iSelectedTabIndex, 16) + '"><a href="../Manager/uamaLeagueNotifications.aspx" id="' + getCurrentTab(iSelectedTabIndex, 16) + '">Notifications</a></li>';
				} else {
				sTabSource += 
					'<li id="' + getActiveTab(iSelectedTabIndex, 9) + '"><a href="../General/uageLeagueMessageSectionList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 9) + '">Talk</a></li>' + 
					'<li id="' + getActiveTab(iSelectedTabIndex, 10) + '"><a href="../General/uageTrumpTypeList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 10) + '">Trumps</a></li>';					
				}					
					break;
			// Admin
			case 2:
				if (mbDisplayLeagueTabs == true) {
					sTabSource +=
						'<li id="' + getActiveTab(iSelectedTabIndex, 2) + '"><a href="../Admin/uaadYourClub.aspx" id="' + getCurrentTab(iSelectedTabIndex, 2) + '">Admin Home</a></li>' +
						'<li id="' + getActiveTab(iSelectedTabIndex, 3) + '"><a href="../Admin/uaadYourLeague.aspx" id="' + getCurrentTab(iSelectedTabIndex, 3) + '">League</a></li>' +
						'<li id="' + getActiveTab(iSelectedTabIndex, 4) + '"><a href="../Admin/uaadYourManagers.aspx" id="' + getCurrentTab(iSelectedTabIndex, 4) + '">Managers</a></li>' +
						'<li id="' + getActiveTab(iSelectedTabIndex, 11) + '"><a href="../Admin/uaadYourAssistants.aspx" id="' + getCurrentTab(iSelectedTabIndex, 11) + '">Assistants</a></li>' +												
						'<li id="' + getActiveTab(iSelectedTabIndex, 5) + '"><a href="../Manager/uamaLeagueTable.aspx?i32LeaderboardType=1" id="' + getCurrentTab(iSelectedTabIndex, 5) + '">Table</a></li>' +	
						'<li id="' + getActiveTab(iSelectedTabIndex, 6) + '"><a href="../Admin/uaadLeagueFixtureList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 6) + '">Fixtures/Results</a></li>' +
						'<li id="' + getActiveTab(iSelectedTabIndex, 7) + '"><a href="../Manager/uamaPlayerLeaderboard.aspx?i32LeaderboardType=1" id="' + getCurrentTab(iSelectedTabIndex, 7) + '">Players</a></li>';
					// Don't display trumps for BBL
					if (miMicroSiteId == 5) {
					sTabSource +=
						'<li id="' + getActiveTab(iSelectedTabIndex, 9) + '"><a href="../General/uageLeagueMessageSectionList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 9) + '">Talk</a></li>';
					} else {
					sTabSource +=
						'<li id="' + getActiveTab(iSelectedTabIndex, 9) + '"><a href="../General/uageLeagueMessageSectionList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 9) + '">Talk</a></li>' + 
						'<li id="' + getActiveTab(iSelectedTabIndex, 12) + '"><a href="../Manager/uamaManagerHomeSuper.aspx" id="' + getCurrentTab(iSelectedTabIndex, 12) + '">News Feed</a></li>';
						//'<li id="' + getActiveTab(iSelectedTabIndex, 10) + '"><a href="../General/uageTrumpTypeList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 10) + '">Trumps</a></li>';
					}
				} else {
				sTabSource += 
					'<li id="' + getActiveTab(iSelectedTabIndex, 2) + '"><a href="../Admin/uaadYourClub.aspx" id="' + getCurrentTab(iSelectedTabIndex, 2) + '">Admin Home</a></li>';
					//'<li id="' + getActiveTab(iSelectedTabIndex, 9) + '"><a href="../General/uageLeagueMessageSectionList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 9) + '">Talk</a></li>' + 
					//'<li id="' + getActiveTab(iSelectedTabIndex, 10) + '"><a href="../General/uageTrumpTypeList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 10) + '">Trumps</a></li>';					
				}
					break;
			// Super
			case 3:
				if (mbDisplayLeagueTabs == true) {
					sTabSource +=
						'<li id="' + getActiveTab(iSelectedTabIndex, 2) + '"><a href="../Admin/uaadSuperLeagueList.aspx?strFilter=P" id="' + getCurrentTab(iSelectedTabIndex, 2) + '">Super Home</a></li>' +
						'<li id="' + getActiveTab(iSelectedTabIndex, 3) + '"><a href="../Admin/uaadYourLeague.aspx" id="' + getCurrentTab(iSelectedTabIndex, 3) + '">League</a></li>' +
						'<li id="' + getActiveTab(iSelectedTabIndex, 4) + '"><a href="../Admin/uaadYourManagers.aspx" id="' + getCurrentTab(iSelectedTabIndex, 4) + '">Managers</a></li>' +
                        '<li id="' + getActiveTab(iSelectedTabIndex, 11) + '"><a href="../Admin/uaadYourAssistants.aspx" id="' + getCurrentTab(iSelectedTabIndex, 11) + '">Assists</a></li>' +													
						'<li id="' + getActiveTab(iSelectedTabIndex, 5) + '"><a href="../Manager/uamaLeagueTable.aspx?i32LeaderboardType=1" id="' + getCurrentTab(iSelectedTabIndex, 5) + '">Table</a></li>' +	
						'<li id="' + getActiveTab(iSelectedTabIndex, 6) + '"><a href="../Admin/uaadLeagueFixtureList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 6) + '">Fixs/Res</a></li>' +
						'<li id="' + getActiveTab(iSelectedTabIndex, 7) + '"><a href="../Manager/uamaPlayerLeaderboard.aspx?i32LeaderboardType=1" id="' + getCurrentTab(iSelectedTabIndex, 7) + '">Players</a></li>' +
						'<li id="' + getActiveTab(iSelectedTabIndex, 8) + '"><a href="../Admin/uaadProcessFixtureList.aspx?i32LeaderboardType=1" id="' + getCurrentTab(iSelectedTabIndex, 8) + '">Process</a></li>' +
				    	'<li id="' + getActiveTab(iSelectedTabIndex, 9) + '"><a href="../General/uageLeagueMessageSectionList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 9) + '">Talk</a></li>' + 
				    	'<li id="' + getActiveTab(iSelectedTabIndex, 10) + '"><a href="../General/uageTrumpTypeList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 10) + '">Trumps</a></li>';
						
				} else {
				sTabSource += 
					'<li id="' + getActiveTab(iSelectedTabIndex, 2) + '"><a href="../Admin/uaadSuperLeagueList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 2) + '">Super Home</a></li>' +
					'<li id="' + getActiveTab(iSelectedTabIndex, 9) + '"><a href="../General/uageLeagueMessageSectionList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 9) + '">Talk</a></li>' + 
					'<li id="' + getActiveTab(iSelectedTabIndex, 10) + '"><a href="../General/uageTrumpTypeList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 10) + '">Trumps</a></li>';					
				}
					break;
			// Assistant
			case 4:
				if (mbDisplayLeagueTabs == true) {
					sTabSource +=					
						'<li id="' + getActiveTab(iSelectedTabIndex, 6) + '"><a href="../Admin/uaadLeagueFixtureList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 6) + '">Fixtures/Results</a></li>' +
						//'<li id="' + getActiveTab(iSelectedTabIndex, 9) + '"><a href="../General/uageLeagueMessageSectionList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 9) + '">Talk</a></li>' + 
						'<li id="' + getActiveTab(iSelectedTabIndex, 10) + '"><a href="../General/uageTrumpTypeList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 10) + '">Trumps</a></li>';
				} else {
				sTabSource += 
					'<li id="' + getActiveTab(iSelectedTabIndex, 9) + '"><a href="../General/uageLeagueMessageSectionList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 9) + '">Talk</a></li>' + 
					'<li id="' + getActiveTab(iSelectedTabIndex, 10) + '"><a href="../General/uageTrumpTypeList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 10) + '">Trumps</a></li>';					
				}
					break;		
			// General
			case 5:
			    if (miMicroSiteId != 6) {
                    sTabSource += 
                        '<li id="' + getActiveTab(iSelectedTabIndex, 11) + '"><a href="../General/uageGeneralHome.aspx" id="' + getCurrentTab(iSelectedTabIndex, 11) + '">Welcome</a></li>';
					    //'<li id="' + getActiveTab(iSelectedTabIndex, 9) + '"><a href="../General/uageLeagueMessageSectionList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 9) + '">Talk</a></li>' +
					    //'<li id="' + getActiveTab(iSelectedTabIndex, 10) + '"><a href="../General/uageTrumpTypeList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 10) + '">Trumps</a></li>';	
					    break;									
			    }
		}
		// Show Logout option for embedded sites
		if (msEmbeddedFlag == "Y") {
		    if (miLoggedInUserType == 1 || miLoggedInUserType == 2) {
			sTabSource += 
			    '<li id="' + getActiveTab(iSelectedTabIndex, 998) + '"><a href="../User/uausUpdateUser.aspx" id="' + getCurrentTab(iSelectedTabIndex, 998) + '">Account</a></li>' +
			    '<li id="' + getActiveTab(iSelectedTabIndex, 999) + '"><a href="../General/uageLogout.aspx" id="' + getCurrentTab(iSelectedTabIndex, 999) + '">Sign Out</a></li>';
			}
		}
	}
		
	sTabSource += '</ul>';
		
	objTabBar.innerHTML = sTabSource;
	}
	
	// Only display top tabs for Fantastar parent site, EIHL site and 6 Nations microsites
	if (miMicroSiteId == 1 || miMicroSiteId == 4 || miMicroSiteId == 11){
		displayTopTabs(0);
	}
	
}

function getActiveTab(iSelectedTabIndex, iTabIndex) {
	
	if (iSelectedTabIndex == iTabIndex) {
		return "active";
	} else {
		return "inactive";
	}
	
}

function getCurrentTab(iSelectedTabIndex, iTabIndex) {
	
	if (iSelectedTabIndex == iTabIndex) {
		return "current";
	} else {
		return "notcurrent";
	}
	
}

function displayTopTabs(iSelectedTabIndex, bSessionExists) {

    // Do not display top tabs for embedded microsites
	if (msEmbeddedFlag != "Y" && bHideTopTabs != true){
	
	    var objTabBar = document.getElementById("navcontainertop");
	    var sTabSource = "";
    		
	    sTabSource += '<ul id="header">';

	    sTabSource += 
	    '<li id="' + getActiveTab(iSelectedTabIndex, 1) + '"><a href="../General/fantastar-fantasy-leagues.aspx" id="' + getCurrentTab(iSelectedTabIndex, 1) + '">Home</a></li>';

        sTabSource +=
	    '<li id="' + getActiveTab(iSelectedTabIndex, 2) + '"><a href="../General/branded-fantasy-leagues.aspx" id="' + getCurrentTab(iSelectedTabIndex, 2) + '">Fantasy Sports</a></li>' +
	    '<li id="' + getActiveTab(iSelectedTabIndex, 9) + '"><a href="../General/our-services.aspx" id="' + getCurrentTab(iSelectedTabIndex, 9) + '">Our Services</a></li>' +
	    '<li id="' + getActiveTab(iSelectedTabIndex, 5) + '"><a href="../General/portfolio.aspx" id="' + getCurrentTab(iSelectedTabIndex, 11) + '">Portfolio</a></li>' +
	    '<li id="' + getActiveTab(iSelectedTabIndex, 4) + '"><a href="../General/testimonials.aspx" id="' + getCurrentTab(iSelectedTabIndex, 4) + '">Testimonials</a></li>' +
	    //'<li id="' + getActiveTab(iSelectedTabIndex, 5) + '"><a href="../General/uageNews.aspx" id="' + getCurrentTab(iSelectedTabIndex, 5) + '">News</a></li>' +
	    '<li id="' + getActiveTab(iSelectedTabIndex, 3) + '"><a href="../General/about-us.aspx" id="' + getCurrentTab(iSelectedTabIndex, 3) + '">About Us</a></li>' +
	    '<li id="' + getActiveTab(iSelectedTabIndex, 7) + '"><a href="../General/grassroots-fantasy-league.aspx" id="' + getCurrentTab(iSelectedTabIndex, 10) + '">Grassroots</a></li>' +
	    '<li id="' + getActiveTab(iSelectedTabIndex, 6) + '"><a href="../General/contact-us.aspx" id="' + getCurrentTab(iSelectedTabIndex, 6) + '">Contact Us</a></li>';

	    switch (miLoggedInUserType) {
		    case 0:
		    // Not logged in
		        /*sTabSource +=
                '<li id="' + getActiveTab(iSelectedTabIndex, 8) + '"><a href="../auth.htm" id="' + getCurrentTab(iSelectedTabIndex, 8) + '">Sign In</a></li>';
			    break;	*/
		    /*// Manager
		    case 1:
		        sTabSource +=
                '<li id="' + getActiveTab(iSelectedTabIndex, 8) + '"><a href="../Manager/uamaManagerHome.aspx" id="' + getCurrentTab(iSelectedTabIndex, 8) + '">My Fantastar</a></li>';
			    break;
		    // Admin
		    case 2:
		        sTabSource +=
                '<li id="' + getActiveTab(iSelectedTabIndex, 8) + '"><a href="../Admin/uaadYourLeague.aspx" id="' + getCurrentTab(iSelectedTabIndex, 8) + '">My Fantastar</a></li>';
			    break;
		    // Super
		    case 3:
		        sTabSource +=
                '<li id="' + getActiveTab(iSelectedTabIndex, 8) + '"><a href="../Admin/uaadSuperLeagueList.aspx?strFilter=P" id="' + getCurrentTab(iSelectedTabIndex, 8) + '">My Fantastar</a></li>';
			    break;
		    // Assistant
		    case 4:
		        sTabSource +=
                '<li id="' + getActiveTab(iSelectedTabIndex, 8) + '"><a href="../Admin/uaadLeagueFixtureList.aspx" id="' + getCurrentTab(iSelectedTabIndex, 8) + '">My Fantastar</a></li>';
			    break;*/										
	    }
    	
    	if (miLoggedInUserType > 0) {
	    sTabSource += 
	    '<li id="' + getActiveTab(iSelectedTabIndex, 9) + '"><a href="../NoExpiry/Pages/Help/uagbHelpHome.htm" id="' + getCurrentTab(iSelectedTabIndex, 9) + '"target=_blank>FAQ</a></li>';
	    }
    		
	    sTabSource += '</ul>';
    		
	    objTabBar.innerHTML = sTabSource;
	}
}
