﻿
/*Expands the sub navigation based on where you are within the site directory structure;
    bolds the current pages button label;
    toggles visibility of subnav
*/
function jsfNavChange()
{
var path = window.location;
var prevDoc = document.referrer;

     //if ((path.toString().toLowerCase().indexOf("/about") > -1 && path.toString().toLowerCase().indexOf("/default.aspx") == -1) || (path.toString().toLowerCase().indexOf("/about/default.aspx") > -1 && (prevDoc.toString().toLowerCase().indexOf("/about/default.aspx") > -1 || prevDoc.toString().toLowerCase().indexOf("/about") == -1)))
   //if (path.toString().toLowerCase().indexOf("/about") > -1 && (path.toString().toLowerCase().indexOf("/default.aspx") == -1 || (prevDoc.toString().toLowerCase().indexOf("/about") == -1 || (prevDoc.toString().toLowerCase().indexOf("/about/default.aspx") > -1 && parent.document.referrer.toString().toLowerCase().indexOf("/about/default.aspx") == -1))))
   if (path.toString().toLowerCase().indexOf("/about") > -1)
      {   document.getElementById("abo").style.display = "block"; 
            if (path.toString().toLowerCase().indexOf("/williamjoneil.aspx") > -1) 
                {document.getElementById("navWJO").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("/database.aspx") > -1) 
                {document.getElementById("navData").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("/dataresearch.aspx") > -1) 
                {document.getElementById("navResearch").style.fontWeight = "bold";}
    }    
    else
    {   document.getElementById("abo").style.display = "none";      }
    
    if (path.toString().toLowerCase().indexOf("/institutionalservices") > -1)
    {   document.getElementById("ins").style.display = "block"; 
            if (path.toString().toLowerCase().indexOf("database") > -1) 
                {document.getElementById("navDatabase").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("monitor") > -1) 
                {document.getElementById("navMonitor").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("leaders") > -1) 
                {document.getElementById("navLLR").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("global") > -1) 
                {document.getElementById("navGFL").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("analytical") > -1) 
                {document.getElementById("navAnalytical").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("trading") > -1) 
                {document.getElementById("navTrading").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("vantage") > -1) 
                {document.getElementById("navVantage").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("weekinreview") > -1) 
                {document.getElementById("navWIR").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("wonda") > -1) 
                {document.getElementById("navWonda").style.fontWeight = "bold";}     
			else if (path.toString().toLowerCase().indexOf("default.aspx") < 1)  
				{document.getElementById("navAps").style.fontWeight = "bold";}         
    }
    else
    {   document.getElementById("ins").style.display = "none";      }

    if (path.toString().toLowerCase().indexOf("/businessregulatory") > -1)
    {   document.getElementById("bus").style.display = "block"; 
            if (path.toString().toLowerCase().indexOf("aml") > -1) 
                {document.getElementById("navAML").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("leg") > -1) 
                {document.getElementById("navBLN").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("bcp") > -1) 
                {document.getElementById("navBCP").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("cip") > -1) 
                {document.getElementById("navCIP").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("priv") > -1) 
                {document.getElementById("navPrivacy").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("sec") > -1) 
                {document.getElementById("navSEC").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("quarterly") > -1) 
                {document.getElementById("navSEC").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("marks") > -1) 
                {document.getElementById("navMarks").style.fontWeight = "bold";}
    }
    else
    {   document.getElementById("bus").style.display = "none";      }
    
    /*  if (path.toString().toLowerCase().indexOf("/careers") > -1)
    {   document.getElementById("car").style.display = "block"; 
            if (path.toString().toLowerCase().indexOf("Dep") > -1) 
                {document.getElementById("navDep").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("Job") > -1) 
                {document.getElementById("navJob").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("Ben") > -1) 
                {document.getElementById("navBen").style.fontWeight = "bold";}
    }
    else
    {   document.getElementById("car").style.display = "none";      }
*/
    if (path.toString().toLowerCase().indexOf("/contact") > -1)
    {   document.getElementById("con").style.display = "block"; 
            if (path.toString().toLowerCase().indexOf("careers") > -1) 
                {document.getElementById("navCareers").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("faq") > -1) 
                {document.getElementById("navFAQ").style.fontWeight = "bold";}
            else if (path.toString().toLowerCase().indexOf("info") > -1) 
                {document.getElementById("navInfo").style.fontWeight = "bold";}
    }
    else
    {   document.getElementById("con").style.display = "none";      }
} 


/*Ensures that your columns are equal heights*/
// by Paul@YellowPencil.com and Scott@YellowPencil.com
function jsfSetTall() {
	if (document.getElementById) {
		// the divs array contains references to each column's div element.  
		// Replace 'center' 'right' and 'left' with your own.  
		// Or remove the last one entirely if you've got 2 columns.  Or add another if you've got 4!
		var divs = new Array(document.getElementById('content'), document.getElementById('nav'));
		
		// Let's determine the maximum height out of all columns specified
		var maxHeight = 0;
		for (var i = 0; i < divs.length; i++) {
			if (divs[i].offsetHeight > maxHeight) maxHeight = divs[i].offsetHeight;
		}
		
		// Let's set all columns to that maximum height
		for (var i = 0; i < divs.length; i++) {
			divs[i].style.height = maxHeight + 'px';

			// Now, if the browser's in standards-compliant mode, the height property
			// sets the height excluding padding, so we figure the padding out by subtracting the
			// old maxHeight from the new offsetHeight, and compensate!  So it works in Safari AND in IE 5.x
			if (divs[i].offsetHeight > maxHeight) {
				divs[i].style.height = (maxHeight - (divs[i].offsetHeight - maxHeight)) + 'px';
			}
		}
	}
}

/*hide/show layer*/
/*
function jsfToggleVisibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'none')
e.style.display = 'block';
else
e.style.display = 'none';
}
*/

/*
window.onload = function() {
	jsfSetTall();
}

window.onresize = function() {
	jsfSetTall();
}

*/

/*Opens a tour window*/


