/****************** GENERAL ******************/
var strSiteType;

function fncEndOfPage(){
	var strSiteType = getSiteType();	//found in /public/javascript/common.js
	fncChangeTab("DIV_INTRODUCTION");
	fncLoadThisDiv();
	getCurrentPage();
}

function fncEndFundOfFunds(){
	var strSiteType = getSiteType();	//found in /public/javascript/common.js
	fncChangeTab("DIV_INTRODUCTION");
	getCurrentPage();
}
/********************************************/

/***************** LAYERS ********************/

var strHighColor = "669999";
var strOtherColor = "336666";
var imgTabLeft;
var imgTabRight;
var strTabName;
var strInnerHtml;
var aryInvestmentOptions = new Array();
//array for manager layers
var arySubLayers = new Array("DIV_THIS_MANAGER_DEFAULT","DIV_THIS_MANAGER_BIOS");
//array for right nav layer links
var arySpnLink = new Array("SPN_THIS_MANAGER_DEFAULT","SPN_THIS_MANAGER_BIOS");
//need to add another item to the array for each of the current manager's funds, change in the manager's html
//ie: arySubLayers[2] = "DIV_THIS_MANAGER_FUND1";

//array for tab names
var aryTabTitles = new Array();
var strSiteType = getSiteType();
if(strSiteType == "MF" || strSiteType == "CS"){
	aryTabTitles[0] = "Funds";
	aryTabTitles[1] = "Managers";
}else{
	aryTabTitles[0] = "Managers";
	aryTabTitles[1] = "Portfolios";
}
//need to add the add current manager to be third tab in the managers html
//such as: aryTabTitles[2] = "LAZARD";

var aryTabLayerNames = new Array("DIV_TAB1","DIV_TAB2","DIV_TAB3");		//third tab is manager name
var aryTabLayerNumber = new Array("1","2","3");
var aryTabFunctions = new Array();
if(strSiteType == "MF" || strSiteType == "CS"){
	aryTabFunctions[0] = "/public/mutual_funds/funds_and_managers/mf_fmgr_index.html?divid=DIV_FUNDS";
	aryTabFunctions[1] = "/public/mutual_funds/funds_and_managers/mf_fmgr_index.html?divid=DIV_INTRODUCTION"
}else{
	aryTabFunctions[0] = "/public/portfolios_and_managers/pmgr_index.html?divid=DIV_INTRODUCTION";
	aryTabFunctions[1] = "/public/portfolios_and_managers/pmgr_index.html?divid=DIV_FUNDS"
}
aryTabFunctions[2] = "#"

var intChosen = "SPNTABTEXT3";

function fncLinkPage(strNewPage){
	window.document.location.href = strNewPage;
}

function fncHideSubLayers(strExemptSubLayer){
	for(var h = 0; h < arySubLayers.length; h++){
		if(strExemptSubLayer == arySubLayers[h]){
			if(h == 0){
				document.getElementById("DIV_THIS_MANAGER_DISCLAIMER").style.display = "block";
			}
			document.getElementById(arySubLayers[h]).style.display = "block";
			document.getElementById(arySpnLink[h]).style.textDecoration = "none";
			document.getElementById(arySpnLink[h]).style.color = "#666666";
		}else{
			if(h == 0){
				document.getElementById("DIV_THIS_MANAGER_DISCLAIMER").style.display = "none";
			}
			document.getElementById(arySubLayers[h]).style.display = "none";
			document.getElementById(arySpnLink[h]).style.textDecoration = "";
			document.getElementById(arySpnLink[h]).style.color = "";
		}
	}
}

function fncChangeTab(strTabLayerName){
	var i, cnt, x = 1;
	var strTabFunction, strTabTitle, strTabName;
	for(i = 0; i < aryTabLayerNames.length; i++){
		cnt = i + 1;
		strTabFunction = "fncLinkPage('" + aryTabFunctions[i] + "');";
		strTabTitle = aryTabTitles[i];
		strTabName = aryTabLayerNames[i]
		if(strTabName == "DIV_TAB3"){
			fncChangeTabStyle("chosen",strTabFunction,strTabTitle,strTabName);
		}else{
			fncChangeTabStyle("notchosen",strTabFunction,strTabTitle,strTabName);
		}
	}
}

function fncChangeTabStyle(strChosen,strFunction,strTitle,strTabName){
	var strInnerHtml = "";
	var strWidthCenter = "120";
	if(strTitle.indexOf("Model") != -1){
		strWidthCenter = "200";
	}
	
	if(strChosen == "chosen"){
		strInnerHtml = '<table border="0" cellpadding="0" cellspacing="0">' + 
			'<tr><TD STYLE="border-left: 1px solid #FFFFFF;" ALIGN="LEFT" WIDTH="5" HEIGHT="5" VALIGN="TOP"><IMG ID="IMGLTCORNER1" BORDER="0" WIDTH="5" HEIGHT="5" SRC="/images/general/tabs/tab_left_' + strHighColor + '.gif"><\/TD>' + 
			'	<td BGCOLOR="#' + strHighColor + '" width="150" height="5" valign="top"><img src="/images/general/spacer.gif" width="' + strWidthCenter + '" height="5"><\/td>' + 
			'	<TD STYLE="border-right: 1px solid #FFFFFF;" ALIGN="RIGHT" WIDTH="5" HEIGHT="5" VALIGN="TOP"><IMG ID="IMGRTCORNER1" BORDER="0" WIDTH="5" HEIGHT="5" SRC="/images/general/tabs/tab_right_' + strHighColor + '.gif"><\/TD>' + 
			'<\/tr>' + 
			'<tr><td STYLE="border-left: 1px solid #99CCCC;" BGCOLOR="#' + strHighColor + '" width="5" height="20" valign="top"><img src="/images/general/spacer.gif" width="5" height="5"><\/td>' + 
			'	<TD BGCOLOR="#' + strHighColor + '" height="20" ALIGN="CENTER" valign="top"><SPAN CLASS="clsTabTextChosen" ID="SPNTABTEXT1">' + strTitle + '<\/SPAN><\/TD>' + 
			'	<td STYLE="border-right: 1px solid #336666;" BGCOLOR="#' + strHighColor + '" width="5" height="20" valign="top"><img src="/images/general/spacer.gif" width="5" height="5"><\/td><\/tr>' + 
			'<\/table>';
	}else{
		strInnerHtml = '<table border="0" cellpadding="0" cellspacing="0">' + 
			'<tr><TD WIDTH="5" HEIGHT="5" VALIGN="TOP"><IMG ID="IMGLTCORNER2" BORDER="0" WIDTH="5" HEIGHT="5" SRC="/images/general/tabs/tab_left_' + strOtherColor + '.gif"><\/TD>' + 
			'	<td BGCOLOR="#' + strOtherColor + '" width="150" height="5" valign="top"><img src="/images/general/spacer.gif" width="' + strWidthCenter + '" height="5"><\/td>' + 
			'	<TD STYLE="border-right: 1px solid #FFFFFF;" ALIGN="RIGHT" WIDTH="5" HEIGHT="5" VALIGN="TOP"><IMG ID="IMGRTCORNER2" BORDER="0" WIDTH="5" HEIGHT="5" SRC="/images/general/tabs/tab_right_' + strOtherColor + '.gif"><\/TD>' + 
			'<\/tr>' + 
			'<tr><td BGCOLOR="' + strOtherColor + '" width="5" height="20" valign="top"><img src="/images/general/spacer.gif" width="5" height="5"><\/td>' + 
			'	<TD BGCOLOR="#' + strOtherColor + '" ALIGN="CENTER" valign="top"><SPAN CL' + 'ASS="clsTabText" ID="SPNTABTEXT2" ONMOUSEOUT="tabMouseOut(this);" ONMOUSEOVER="tabMouseOver(this);" ONCLICK="' + strFunction + '">' + strTitle + '<\/SPAN><\/TD>' + 
			'	<td STYLE="border-right: 1px solid #003333;" BGCOLOR="#' + strOtherColor + '" width="5" height="20" valign="top"><img src="/images/general/spacer.gif" width="5" height="5"><\/td><\/tr>' + 
			'<\/table>';
	}
	document.getElementById(strTabName).innerHTML = strInnerHtml;
}

function fncLoadThisDiv(){
	var nmbrID = 0;
	var locationHref = window.location.href;	
	locationHref = locationHref.toUpperCase();
	
	if (locationHref.indexOf("DIVID") > 0) {
		var param = locationHref.indexOf("=");
		param = param + 1;
		var paramDivID = locationHref.slice(param);
		paramDivID = paramDivID.toUpperCase();
		if (paramDivID > "") {
			for (var n = 0; n < aryInvestmentOptions.length; n++) {
				if (paramDivID == aryInvestmentOptions[n]) {
					fncHideSubLayers(arySubLayers[n]);
					nmbrID = 1;
					break;
				}
			}
		}
	}

	if(nmbrID == 0){
		fncHideSubLayers("DIV_THIS_MANAGER_DEFAULT");
	}
}

// hover colors
function tabMouseOver(obj) {
	intChosen = intChosen.toUpperCase();
	obj.style.color = "#FFCC66";
	if (ns) obj.style.cursor = "pointer"; 					
	else obj.style.cursor = "hand";						
}

function tabMouseOut(obj) {
	obj.style.color = "#FFFFFF";
	obj.style.cursor = "default";		
}

/********************************************************/

/******************* Select Manager drop down controls ***********************/
function fncGetManager() {
	var strPdfUrl = document.frmGetManager.selGetManager.options[document.frmGetManager.selGetManager.selectedIndex].value;
	if (strPdfUrl != "--") {
		window.document.location.href = strPdfUrl;
	}
}

function getCurrentPage() {
	var strCurrentPage = document.location.pathname;
	var strCurrentValue;
	for (var i = 0; i < document.frmGetManager.selGetManager.length; i++) {
		strCurrentValue = document.frmGetManager.selGetManager.options[i].value;
 	   	if (strCurrentValue == strCurrentPage) {
         	document.frmGetManager.selGetManager.options[i].selected = true;
			break;
     	}
	}
}

/********************************************************/
