// /js/new/login.js
// ---------------------------------------------------------------------------
// Java Script for Login functionality
// ---------------------------------------------------------------------------
var userIsLogin = false;
var cbolWin;
// ----------------------------------------------------------------
// Print appropriate HTML on the ACCESS top nav bar
// 'Login' or 'Log Off'
// ----------------------------------------------------------------
function checklogin() {
	
	var LoginStatusnon = "ssoSESSIONNONS" + "=";
	var LoginStatus = "ssoSESSION" + "=";
	var CookieValuenon = getcookie(LoginStatusnon);
	var CookieValue = getcookie(LoginStatus);

	var isNav = (navigator.appName == 'Netscape')
	var is_getElementById   = (document.getElementById) ? true : false;
	var isNav6 = isNav && is_getElementById;
	var bV=parseInt(navigator.appVersion);
	var NS4=(document.layers) ? true : false;
	var IE4=((document.all)&&(bV>=4))?true:false;

		//7/25/2007: wrote if statement for fa.locator redirect
		if ( location.hostname == "fa.smithbarney.com" )
		{
			var Login_on = '<a href="https://www.smithbarney.com/cgi-bin/login/checklogout.cgi" target="_top"><span class="amtplus">Log On</span></a>';
		}
		else
		{
			//6/21/2007  added "cursor:pointer" to the css/new/standard.css as this is reading the .amtplus from there and not base.css
			var Login_on = '<a href="/cgi-bin/login/login.cgi" target="_top"><span class="amtplus">Log On</span></a>';
		}
//		var Login_off = '<a href="/cgi-bin/login/logout.cgi" target="_top"><span class="amtminus">Log Off</span></a>';
//      5/15/2007 target from _top to _self
		var Login_off = '<a href="javascript:SBlogoff();" target="_self"><span class="amtminus">Log Off</span></a>';


	// ----------------------------------------------------------------------
	// 8/15/00, we are going to put 'logon' button on TeleScan,
	// and nothing on CBOE, anything else is as usual
	// ----------------------------------------------------------------------
	var specialDomain1 = "www.cboe.com";
	var specialDomain2 = "prosearch.mycititrade.telescan.com";
	var specialDomain3 = "www.mastercard.com";

	var currentLocation = window.location.toString().toLowerCase();
	if (currentLocation.indexOf(specialDomain1.toLowerCase())!= -1) {
		// ------------------------------------------------
		// CBOE
		// ------------------------------------------------
		//alert("cboe");
	} else if (currentLocation.indexOf(specialDomain3.toLowerCase())!= -1) {
		// ------------------------------------------------
		// Mastercard
		// ------------------------------------------------
	   	// mastercard
	} else if (currentLocation.indexOf(specialDomain2.toLowerCase())!=-1) {
		// ------------------------------------------------
		// telescan
		// ------------------------------------------------
		//alert("telescan");
		if (NS4) {
			document.layers["headlinksDiv"].document.write(Login_off);
		} else {
			document.write(Login_off);
		}
		userIsLogin = true;

	} else {

		if ((CookieValue.toLowerCase() == "logout") || (CookieValuenon.toLowerCase() == "logout")) {

			if (NS4) {
				document.layers["headlinksDiv"].document.write(Login_on);
			} else {
				document.write( Login_on );
			}
			userIsLogin = false;

		} else if ((CookieValue == "empty") && (CookieValuenon == "empty")) {

			if (NS4) {
				document.layers["headlinksDiv"].document.write(Login_on);
			} else {
				document.write( Login_on );
			}
			userIsLogin = false;

		} else {

			if (NS4) {
				document.layers["headlinksDiv"].document.write(Login_off);
			} else {
				document.write(Login_off);
			}
			userIsLogin = true;

		}
	}
}


// ----------------------------------------------------------------
// Get a cookie
// ----------------------------------------------------------------
function getcookie(in_cookiename) {
	//alert(document.cookie);
	var objCookies = document.cookie;
	var pos = objCookies.indexOf(in_cookiename);
	var begin = pos + in_cookiename.length;
	var end = objCookies.indexOf(";", begin);
	if (end  == -1) end= objCookies.length;
	var tempvalue = unescape(objCookies.substring(begin,end));
	if (pos == -1)  tempvalue = 'empty';
	return tempvalue;
}

// ----------------------------------------------------------------
// Begin user type (CBOL, FLS, CIS, etc.) detection code block.
//
// This block of code should be duplicated in the following files
// since various includes pull in the .js files out of order:
//	/js/01_login.js
//	/js/new/login.js
//	/js/new/CoreCookies.js
// ----------------------------------------------------------------
if ( typeof core_user == "undefined" )
{
	var core_user = false;
	
	if( getcookie('CORE_CTX'))
	{
		var core_ctx = getcookie("CORE_CTX");

		if ( core_ctx != null && core_ctx != "" && core_ctx != "empty" )
		{ core_user = true; }
		else
		{
			if (getcookie('BRAND_CTX')) 
			{ 
				if(getcookie('BRAND_CTX').indexOf('MSSB')!= -1) 
				{ core_user = true; } 
			}
		}
	}
	else
	{
		if (getcookie('BRAND_CTX')) 
		{ 
			if(getcookie('BRAND_CTX').indexOf('MSSB')!= -1) 
			{ core_user = true; } 
		}
	}
}



if ( typeof cbol_user == "undefined" )
{
	var cbol_user = false;
	var cis_ctx = getcookie("CIS_CTX");
	var cbol_bc = getcookie("CBOLBreadcrumbs");
	var cis_exists = false;
	var cbolbc_exists = false;

	if ( cis_ctx != null && cis_ctx != "" && cis_ctx != "empty" )
	{
		if ( cbol_bc != null && cbol_bc != "" && cbol_bc != "empty" )
		{
			cis_exists = true;
			cbolbc_exists = true;
			cbol_user = true;
		}
		else
		{
			cis_exists = true;
			cbolbc_exists = false;
		}
	}
}

if ( typeof fls_user == "undefined" )
{
	var fls_user = false;
	
	if( getcookie('FLS_CTX'))
	{
		var fls_ctx = getcookie('FLS_CTX');

		if ( fls_ctx != null && fls_ctx != "" && fls_ctx != "empty" )
		{ 
			if (getcookie('BRAND_CTX')) 
			{ 
				if(getcookie('BRAND_CTX').indexOf('CPWM')!= -1 || getcookie('BRAND_CTX').indexOf('Citi')!= -1 ) 
				{ fls_user = true; } 
			}
		}
		else
		{
			if (getcookie('BRAND_CTX')) 
			{ 
				if(getcookie('BRAND_CTX').indexOf('CPWM')!= -1) 
				{ fls_user = true; } 
			}
		}
	}
	else
	{
		if (getcookie('BRAND_CTX')) 
		{ 
			if(getcookie('BRAND_CTX').indexOf('CPWM')!= -1) 
			{ fls_user = true; } 
		}
	}
}


if ( typeof non_jv_user == "undefined" )
{
	var non_jv_user = false;
			if (getcookie('BRAND_CTX')) 
			{ 
				if(getcookie('BRAND_CTX').indexOf('Citi')!= -1) 
				{ non_jv_user = true; } 
			}
		}


if ( typeof cpb_user == "undefined" )
	{
	var cpb_user = false;
		if (getcookie('BRAND_CTX')) 
		{ 
		if(getcookie('BRAND_CTX').indexOf('CPB')!= -1) 
		{ cpb_user = true; } 
	}
}

if ( typeof pcr_user == "undefined" )
{
	var pcr_user = false;
	var pcr_ctx = getcookie("PCR_CTX");
	
	if ( pcr_ctx != null && pcr_ctx != "" && pcr_ctx != "empty" )
	{ pcr_user = true; }
}
// ----------------------------------------------------------------
// End user type code block.
// ----------------------------------------------------------------

if ( typeof cbb_user == "undefined" )
{
	var cbb_user = false;
}

if ( cbol_user )
{
	var cbb_ctx = getcookie("CBB_CTX");

	if ( cbb_ctx != null )
	{
		cbb_user = true;
	}
}

//set the EW8 user
if ( typeof ew8_user == "undefined" )
{
	var ew8_user = false;
	var ew8_ctx = getcookie("EW8Session");

	if ( ew8_ctx != null && ew8_ctx != "" && ew8_ctx != "empty" )
	{ ew8_user = true; }
}

// ----------------------------------------------------------------
// Set Login Image Src
// ----------------------------------------------------------------
function checkLoginImage() {
	if (document.images["login"]){
		document.images["login"].src =
			(userIsLogin) ? "images/0_btn_logoff.gif" : "images/0_btn_logon.gif";
	}
}

var ns4 = (document.layers)? true:false
var ie4 = (document.all)? true:false
var isNav = (navigator.appName.indexOf("Netscape") != -1 );
var isIE = (navigator.appName.indexOf("Microsoft") != -1 );

function handleEnterSubmission(field, evt)
{
	var keyCode = evt.which ? evt.which : evt.keyCode;

	if ( keyCode == 13 )
	{
		if(document.getElementById("btnLogin")) { document.getElementById("btnLogin").click(); return false;}
		else { document.getElementById("submitbtn").click(); return false; }
	}
	else
	{
		return true;
	}
}

function handleEnterSubmission2(evt)
{
	var keyCode = 0;
	if ( isIE )
	{
		keyCode = event.keyCode;
		var nKey = 0;
	}
	if ( isNav )
	{
		keyCode = evt.which;
		var ieKey = 0;
	}
	if ( keyCode == 13 )
	{
		if ( isNav || isIE )
		{
			document.forms["logon"].submit();
		}
		return false;
	}
	else
	{
		return true;
	}
}

if ( isNav && ns4 )
{
	document.onkeydown = handleEnterSubmission
	document.captureEvents(Event.KEYDOWN)
}

function form_funcs()
{
	if ( document.forms["logon"].username.value == "" )
	{
		document.forms["logon"].username.focus();
		document.forms["logon"].username.select();
	}
}
var FORM_NAME='logon';

//added this to see if the fields are empty, return them to their original state.
function checkCopy(f)
{ 
	if (f.value=="") 
	{   

		if (f.id == 'marketSearchTxt') { document.getElementById(f.id).value = "Enter Symbol"; }

		if (f.id == 'searchTxt') { document.getElementById(f.id).value = "Enter search term"; }
		
		if (f.id == 'username')
		{ f.value="Enter User Name" }
		else if (f.id == 'password')
		{
			//check if the password as an id. then the below happens
			var browser=navigator.appName;
  
  			if (browser=="Microsoft Internet Explorer")
  			{
			//alert("I'm in IE6");
    			var input = document.getElementById(f.id);
    			//I'm using escapes below
    			var input2 = document.createElement('<input name=\'password\' type=\'text\' id=\'password\' value=\'Enter Password\' onblur=\'checkCopy(this)\' onfocus=\'swapfield(this,\"password\")\' onkeyup=\'return handleEnterSubmission(this.form,event)\'  maxlength=\'16\' autocomplete=\'off\' />');
    			input.parentNode.appendChild(input2);
    			input.parentNode.removeChild(input);
			}
    		else
 			{	//For everything except IE6
				document.getElementById(f.id).type = "text";
	  			document.getElementById(f.id).value = "Enter Password";
 			}  
		}	
	}
}

//added this for the OneCiti password field. It can be used to swap out any input field type.
function swapfield(f, lcType)
{
  var browser=navigator.appName;
  
  if (browser=="Microsoft Internet Explorer")
  {
	document.getElementById(f.id).value = "";
    var input = document.getElementById(f.id);
    //I'm using escapes below
    var input2 = document.createElement('<input name=\'password\' type=\'password\' id=\'password\' onblur=\'checkCopy(this)\' onkeyup=\'return handleEnterSubmission(this.form,event)\'  maxlength=\'16\' autocomplete=\'off\' />');
    input.parentNode.appendChild(input2);
    input.parentNode.removeChild(input);
    input2.focus();
    //input.parentNode.replaceChild(input,input2);

  }
  else
  {	//alert("I'm in the function");
  	//I have to grab all the text in the field.
  	document.getElementById(f.id).value = "";
  	document.getElementById(f.id).type = lcType;
  }
}

//rewrote this for OneCiti
function getCookieNames_new() { 
	if (typeof(window.nameList)=="undefined" || window.nameList.length==0)
	{
		// I have to do a onfocus function to clear out this field
		document.write('<input type="text" id="username" name="username" value="Enter User Name" onblur="checkCopy(this)" onfocus=this.value="" maxlength="35" autocomplete="off">');
		//added this 10/16/2007 to give username focus when no user. Disabled it for OneCiti Rebrand
		//document.forms["logon"].username.focus();
		return;
	}

        var l=[];
        if (typeof(window.nameList)!="undefined")
        {
			l = window.nameList.split("\&");
			//alert(l); //This brings up the username
        }
        l=l.join('|').split('|');
		//alert(l); This brings up the user name into an array and then writes it out.
        var elSelect='';
        elSelect+='<select name="username" id="username" onChange="onSelectUser(this);">';
        //elSelect+='<select name="username" id="username" class="unpw" onChange="onSelectUser(this);">';
        elSelect+='<option>------ Sign on as: -------</option>';
        for( var i = 0; i < l.length; i++ )
        {
					elSelect+='<option value="'+l[i]+'"'+(i==l.length-1?' selected':'')+'>'+l[i]+'</option>';
					//elSelect+='<option value="'+l[i]+'"'+(i==0?' selected':'')+'>'+l[i];
        }
        elSelect+='<option>----- Other Options -----';
        elSelect+='<option value="inputUserName">A different user</option>';
        elSelect+='<option value="removeUserName">Remove a User ID (cookie)</option>';
        elSelect+='</select>';

	 //this gives another input box, but I don't know why it's there. Is it a hidden variable?
        //elSelect+='<input style="display:none; padding-left:3px; margin-top:-1px; margin-bottom:-1px;" type="text" name="username2" id="username2" value="" />';
        //elSelect+='<input style="display:none; padding-left:3px; margin-top:-1px; margin-bottom:-1px;" class="unpw" type="text" name="username2" id="username2" value="" />';

        document.write(elSelect);
}


function getCookieNames() {
	if (typeof(window.nameList)=="undefined" || window.nameList.length==0)
	{
		document.write('<input type="text" id="username" name="username" class="tbox3 unpw"  maxlength="35" autocomplete="off">');
		//document.write('<input type="text" id="username" name="username" class="unpw"  maxlength="16" autocomplete="off">');
		
		//  added this 10/16/2007 to give username focus when no user
		document.forms["logon"].username.focus();
		return;
	}

        var l=[];
        if (typeof(window.nameList)!="undefined")
        {
			l = window.nameList.split("\&");
			//alert(l); //This brings up the username
        }
        l=l.join('|').split('|');
		//alert(l); This brings up the user name into an array and then writes it out.
        var elSelect='';
        elSelect+='<select name="username" id="username" class="tbox3 unpw" onChange="onSelectUser(this);">';
        //elSelect+='<select name="username" id="username" class="unpw" onChange="onSelectUser(this);">';
        elSelect+='<option>------ Sign on as: -------';
        for( var i = 0; i < l.length; i++ )
        {
					elSelect+='<option value="'+l[i]+'"'+(i==l.length-1?' selected':'')+'>'+l[i];
					//elSelect+='<option value="'+l[i]+'"'+(i==0?' selected':'')+'>'+l[i];
        }
        elSelect+='<option>----- Other Options -----';
        elSelect+='<option value="inputUserName">A different user';
        elSelect+='<option value="removeUserName">Remove a User ID (cookie)';
        elSelect+='</select>';

        elSelect+='<input style="display:none; padding-left:3px; margin-top:-1px; margin-bottom:-1px;" class="tbox3 unpw" type="text" name="username2" id="username2" value="" />';
        //elSelect+='<input style="display:none; padding-left:3px; margin-top:-1px; margin-bottom:-1px;" class="unpw" type="text" name="username2" id="username2" value="" />';

        document.write(elSelect);
}

// This is for OneCiti rebrand
function getCheckBox4RememberID_new() {
	if (typeof(window.nameList)=="undefined" || window.nameList.length==0) {
		document.write('<input type="checkbox" id="rememberId"  name="rememberId" />');
		document.write('<label for="rememberId">Remember User Name</label>&nbsp;');
                return;
	}
	//10/15/2007 - if there's a username present, the password field will get focus. Took out for one citi
	/*else	{ document.forms["logon"].password.focus(); }*/
}

function getCheckBox4RememberID() {
        //if (window.inputUserName) {
	if (typeof(window.nameList)=="undefined" || window.nameList.length==0) {
                //document.write(' <tr>' );
                //document.write(' <td class="rgt" ><input type="checkbox" name="rememberId" ></td> ');
                //document.write(' <td >Remember user name</td> ');
                //document.write(' </tr>' );
		document.write('<input type="checkbox" id="rememberId"  name="rememberId" />');
		document.write('<label for="rememberId" style="font-weight:normal; color:black;">Remember User Name</label>&nbsp;');
                return;
	}
	//10/15/2007 - if there's a username present, the password field will get focus.
	else
	{
		document.forms["logon"].password.focus();
	}
}

function onSelectUser(e)
{
        var n=e[e.selectedIndex].value;
        if(n=="") {
				//alert("If n==''");
                e.selectedIndex=1;
                return;
        }
        if(n=='inputUserName')  {
				
				//added this 9/11/2007
				var passwordValue = document.forms[FORM_NAME].password.value;
				if(passwordValue !="")
				{
					document.forms[FORM_NAME].password.value = ""
				}
				//End addition
                document.forms[FORM_NAME].submit();
                return;
        }
        if(n=='removeUserName') {
                document.forms[FORM_NAME].submit();
                return;
        }
}

//this may change because of the cookie switch.
function SBlogoff()
{
	if ( typeof core_user != "undefined" )
	{

		if ( ( core_user ) && ( getcookie("CORE_CTX").indexOf("ON") != -1 ) )
		{
			if ( confirm("Would you like to log off of Citibank Online as well?") )
			{
				CBOLLogOffWin = window.open("", "CBOLLogOff");

				CBOLLogOffWin.location.href = "https://web.da-us.citibank.com/cgi-bin/citifi/portal/sb/checkSessionStatus.do?SignOff=SIGNOFF&BV_UseBVCookie=Yes&pageType=SIGNOFF&eACE-TOKEN=null";
			}
		}
		
		//added this to the code 7/26/2007
		if ( location.hostname == "fa.smithbarney.com" )
		{
			document.location.href = "https://www.smithbarney.com/cgi-bin/login/logout.cgi";
		}
		else
		{
			document.location.href = "/cgi-bin/login/logout.cgi"; //Original here
		}
	}
	//added this 7/27/2007 to redirect from the "fa.locator.com"
	if ( location.hostname == "fa.smithbarney.com" )
	{
		document.location.href = "https://www.smithbarney.com/cgi-bin/login/logout.cgi";

		//13JUN2007 - This code is used to close any open child window with the name of 'PCR' on user logout.
		var MSG = "https://www.smithbarney.com/kill_window.html"
		window.open( MSG , 'PCR' , 'top=10000,left=-1000,height=1,width=1,alwaysLowered=yes' );
	}
	else
	{
		//13JUN2007 - This code is used to close any open child window with the name of 'PCR' on user logout.
		var MSG = window.location.protocol + "//" + window.location.hostname + "/kill_window.html"
		window.open( MSG , 'PCR' , 'top=10000,left=-1000,height=1,width=1,alwaysLowered=yes' );
	}
}

function relaunch_pcr_window( URL )
{
	//Kill the old PCR window	
	var MSG = window.location.protocol + "//" + window.location.hostname + "/kill_window.html"
	window.open( MSG , 'PCR' , 'top=10000,left=-1000,height=1,width=1,alwaysLowered=yes' );
	
	//Launch new PCR widnow with new URL
	MSG = window.location.protocol + "//" + window.location.hostname + URL
	window.open( URL , 'PCR' , 'top=100,left=100,height=600,width=800,status=1,menubar=1,location=1,toolbar=1,scrollbars=1,resizable=1' ); 
}

function displayFLSHeader()
{
	if(document.getElementById("sblogo"))
	{ var logoLink = document.getElementById("sblogo").parentNode; }else { return; }
		
	if(cbol_user)
	{ logoLink.removeAttribute("href"); }


/*	if(logoLink.getAttribute("title")) 
	{ if(fls_user) { logoLink.setAttribute("title", "Citi Personal Wealth Management Logo"); } 
	  else if(non_jv_user) { logoLink.setAttribute("title", "Citi Logo"); }
	  else if(cpb_user) { logoLink.setAttribute("title", "Citi Private Bank Logo"); }
	}	*/

	if (document.getElementById('headerDiv') || document.getElementById('sitelogoDiv'))
	{
		if(fls_user)
		{
			logoLink.innerHTML='<img src="/images/new/citi_pwm_logo.gif" id="sblogo" alt="Citi Personal Wealth Management Logo" style="width:236px;height:56px;" title="Citi Personal Wealth Management Logo"/><script type="text/javascript">displayFLSHeader();</script>';
			if(document.getElementById("headerDiv")) {document.getElementById("headerDiv").style.height="70px"; } 
		}
		else if(non_jv_user)
		{
			logoLink.innerHTML='<img src="/images/new/citi_logo.gif" id="sblogo" alt="Citi Logo" style="width:65px;height:56px;" title="Citi Logo"/><script type="text/javascript">displayFLSHeader();</script>';
		}
		else if(cpb_user)
		{
			logoLink.innerHTML='<img src="/images/new/citi_cpb_logo.gif" id="sblogo" alt="Citi Private Bank Logo" class="cpb" style="width:184px;height:56px;" title="Citi Private Bank Logo"/><script type="text/javascript">displayFLSHeader();</script>';
			if(document.getElementById("headerDiv")) {document.getElementById("headerDiv").style.height="70px"; } 
		}
	}
	else if(document.getElementById('masthead'))
	{
		if(fls_user)
		{
			logoLink.innerHTML='<img src="/images/logos/CitiPWM.gif" id="sblogo" class="citisb" alt="Citi Personal Wealth Management Logo" style="width:200px;height:42px;" title="Citi Personal Wealth Management Logo"/><script type="text/javascript">displayFLSHeader();</script>';
			if(document.getElementById("lineOfBusiness")){ document.getElementById("lineOfBusiness").style.display="block";document.getElementById("lineOfBusiness").innerHTML="Personal Wealth Management"; }
		}
		else if(non_jv_user)
		{
			logoLink.innerHTML='<img src="/images/logos/Citi.gif" id="sblogo" class="citisb" alt="Citi Logo" style="width:200px;height:42px;" title="Citi Logo"/><script type="text/javascript">displayFLSHeader();</script>'
		}
		else if(cpb_user)
		{
			logoLink.innerHTML='<img src="/images/logos/CitiCPB.gif" id="sblogo" class="citisb" alt="Citi Private Bank Logo" style="width:200px;height:42px;" title="Citi Private Bank Logo"/><script type="text/javascript">displayFLSHeader();</script>';
			if(document.getElementById("lineOfBusiness")){ document.getElementById("lineOfBusiness").style.display="block";document.getElementById("lineOfBusiness").innerHTML="Private Bank"; }
		}
	}
}

// Code added to display logos on the Popup screens
function displayFLSHeader_popup()
{
	if(document.getElementById("sblogopopup"))
	{ var logoLink = document.getElementById("sblogopopup").parentNode; }else { return; }
		
	if(cbol_user)
	{ logoLink.removeAttribute("href"); }
/*
	if(logoLink.getAttribute("title")) 
	{ if(fls_user) { logoLink.setAttribute("title", "Citi Personal Wealth Management Logo"); } 
	  else if(non_jv_user) { logoLink.setAttribute("title", "Citi Logo"); }
	  else if(cpb_user) { logoLink.setAttribute("title", "Citi Private Bank Logo"); }
	}	
*/
	if(document.getElementById('sitelogoDivPopup'))
	{
		if(fls_user)
		{
			logoLink.innerHTML='<img src="/images/logos/CitiPWMSml.gif" id="sblogopopup" alt="Citi Personal Wealth Management Logo" style="width:128px;height:33px;" class="cpwm" title="Citi Personal Wealth Management Logo"/><script type="text/javascript">displayFLSHeader_popup();</script>'
		}
		else if(non_jv_user)
		{
			logoLink.innerHTML='<img src="/images/logos/CitiSml.gif" id="sblogopopup" alt="Citi Logo" style="width:128px;height:33px;" class="citisb" title="Citi Logo"/><script type="text/javascript">displayFLSHeader_popup();</script>'
		}
		else if(cpb_user)
		{
			logoLink.innerHTML='<img src="/images/logos/CitiCPBSml.gif" id="sblogopopup" alt="Citi Private Bank Logo" style="width:128px;height:33px;" title="Citi Private Bank Logo"/><script type="text/javascript">displayFLSHeader_popup();</script>';
		}
	}
}


function displayMirandaFooter()
{
	if ( core_user )
	{
		document.write('<img src="/images/new/miranda_banner.gif" height="59" width="142" alt="Citgroup" id="miranda" />');
	}
}

function hideFCInfo()
{
	if (document.getElementById("fcinfo"))
	{
		if ( cbol_user )
		{ document.getElementById("fcinfo").style.display = 'none'; } 
		else
		{ document.getElementById("fcinfo").style.display = 'block'; }
	}
}

function displayFooterText()
{	
	if (non_jv_user || fls_user || cpb_user)
	{

		/*document.write('Investments are offered through Citigroup Global Markets Inc. (\"CGMI\"), <a title="Member SIPC" onclick="startLeaveAccess(\'/myaccess/account_management/sipc_pop.html\');" href="Javascript:void(0);">member SIPC</a>.  CGMI and Citibank, N.A. are affiliated companies wholly owned by Citigroup Inc. Morgan Stanley Smith Barney LLC is a separate investment advisor and broker/dealer registered with the Securities and Exchange Commission, and is affiliated with but distinct from Citibank and CGMI. References to \"Citi Smith Barney\" or \"Smith Barney\" should be read as referring to CGMI. Please contact us if you have any questions about this notice.');*/

		document.write('<p>Securities and Insurance Products:  *Not FDIC Insured  *Not a deposit or obligation of any bank  * Not insured by any federal government agency  * No bank guarantee  * Subject to investment risks, including possible loss of principal</p><p>Securities offered through Citigroup Global Markets Inc. (\"CGMI\"), <a title="Member SIPC" onclick="startLeaveAccess(\'/thirdparty.html?http://www.sipc.org\');" href="Javascript:void(0);">member SIPC</a>.  CGMI acts as broker/dealer and investment advisor for Citigroup businesses including the Citi Private Bank and Citi Personal Wealth Management. In the United States, insurance is offered through Citigroup Life Agency LLC (\"CLA\").  In California, CLA does business as Citigroup Life Insurance Agency, LLC (license number 0G56746).  CGMI, CLA and Citibank, N.A. are affiliated companies under the common control of Citigroup Inc.  Citi and Citi with Arc design are registered service marks of Citigroup Inc. and its affiliates and are used and registered throughout the world.</p>');
	}
	else
		//New footer copy
	{
		document.write('<p>Investment products and services are offered through Morgan Stanley Smith Barney LLC, <a title="Member SIPC" onclick="startLeaveAccess(\'/thirdparty.html?http://www.sipc.org\');" href="Javascript:void(0);">member SIPC</a>. Morgan Stanley Smith Barney LLC is a registered broker/dealer and investment advisor, formed by the combination of the Global Wealth Management Group of Morgan Stanley & Co. Incorporated and the Smith Barney division of Citigroup Global Markets Inc. </p><p>In general, references to Smith Barney or the Smith Barney division of Citigroup Global Markets Inc. should be read on this site as the Smith Barney channel of Morgan Stanley Smith Barney LLC. Some products or services may continue to be available though Citi or Citigroup Global Markets Inc. Read more on the <a href= "/pdf/statement_of_responsibilities.pdf" onClick="window.open(\'/pdf/statement_of_responsibilities.pdf\',\'pdfDoc\',\'toolbar=no,status=no,menubar=no,resizable=1, width=700,height=600\'); return false">Statement of Morgan Stanley Smith Barney LLC and Citigroup Global Markets Inc. Responsibilities</a> that describes their respective roles and functions.  Clients may contact their Financial Advisor with questions about these changes. </p><p>The information and services provided on the website are intended for persons in the U.S. only. </p><p>&copy; <script type=\"text/javascript\" language=\"JavaScript\">update_footer_year();</script> Morgan Stanley Smith Barney LLC. Member SIPC.  Accounts carried by Citigroup Global Markets Inc. <a title="Member SIPC" onclick="startLeaveAccess(\'/thirdparty.html?http://www.sipc.org\');" href="Javascript:void(0);">Member SIPC</a>. All rights reserved.</p>');
	}

	if (ew8_user) { document.write("<span id='ew8'><img src='/images/new/ew8_ping.png' width='1px' height='1px'></img></span>") }

}

//This is for oneciti
function displayFooterText_new()
{	

	if (non_jv_user || fls_user || cpb_user)
	{

		/*document.write('Investments are offered through Citigroup Global Markets Inc. (\"CGMI\"), <a title="Member SIPC" onclick="startLeaveAccess(\'/myaccess/account_management/sipc_pop.html\');" href="Javascript:void(0);">member SIPC</a>.  CGMI and Citibank, N.A. are affiliated companies wholly owned by Citigroup Inc. Morgan Stanley Smith Barney LLC is a separate investment advisor and broker/dealer registered with the Securities and Exchange Commission, and is affiliated with but distinct from Citibank and CGMI. References to \"Citi Smith Barney\" or \"Smith Barney\" should be read as referring to CGMI. Please contact us if you have any questions about this notice.');*/

		document.write('<p>Securities and Insurance Products:  *Not FDIC Insured  *Not a deposit or obligation of any bank  * Not insured by any federal government agency  * No bank guarantee  * Subject to investment risks, including possible loss of principal</p><p>Securities offered through Citigroup Global Markets Inc. (\"CGMI\"), <a title="Member SIPC" onclick="startLeaveAccess(\'/thirdparty.html?http://www.sipc.org\');" href="Javascript:void(0);">member SIPC</a>.  CGMI acts as broker/dealer and investment advisor for Citigroup businesses including the Citi Private Bank and Citi Personal Wealth Management. In the United States, insurance is offered through Citigroup Life Agency LLC (\"CLA\").  In California, CLA does business as Citigroup Life Insurance Agency, LLC (license number 0G56746).  CGMI, CLA and Citibank, N.A. are affiliated companies under the common control of Citigroup Inc.  Citi and Citi with Arc design are registered service marks of Citigroup Inc. and its affiliates and are used and registered throughout the world.</p>');
	}
	else
		//New footer copy
	{
		document.write('<p>Investment products and services are offered through Morgan Stanley Smith Barney LLC, <a title="Member SIPC" onclick="startLeaveAccess(\'/thirdparty.html?http://www.sipc.org\');" href="Javascript:void(0);">member SIPC</a>. Morgan Stanley Smith Barney LLC is a registered broker/dealer and investment advisor, formed by the combination of the Global Wealth Management Group of Morgan Stanley & Co. Incorporated and the Smith Barney division of Citigroup Global Markets Inc. </p><p>In general, references to Smith Barney or the Smith Barney division of Citigroup Global Markets Inc. should be read on this site as the Smith Barney channel of Morgan Stanley Smith Barney LLC. Some products or services may continue to be available though Citi or Citigroup Global Markets Inc. Read more on the <a href= "/pdf/statement_of_responsibilities.pdf" onClick="window.open(\'/pdf/statement_of_responsibilities.pdf\',\'pdfDoc\',\'toolbar=no,status=no,menubar=no,resizable=1, width=700,height=600\'); return false">Statement of Morgan Stanley Smith Barney LLC and Citigroup Global Markets Inc. Responsibilities</a> that describes their respective roles and functions.  Clients may contact their Financial Advisor with questions about these changes. </p><p>The information and services provided on the website are intended for persons in the U.S. only. </p><p>&copy; <script type=\"text/javascript\" language=\"JavaScript\">update_footer_year();</script> Morgan Stanley Smith Barney LLC. Member SIPC.  Accounts carried by Citigroup Global Markets Inc. <a title="Member SIPC" onclick="startLeaveAccess(\'/thirdparty.html?http://www.sipc.org\');" href="Javascript:void(0);">Member SIPC</a>. All rights reserved.</p>');
	}
	
	if (ew8_user) { document.write("<span id='ew8'><img src='/images/new/ew8_ping.png' width='1px' height='1px'></img></span>") }

}

document.write('<script type="text/javascript" src="/js/new/CoreCookies.js"></scr' + 'ipt>');

function write_conditional_text()
{
	
	// this block added on 14Jun2007
	//pcr_user = true;
	if(pcr_user){
		if(document.getElementById("highlights_ul")){
			var pcrLi = document.createElement("li");
			document.getElementById("highlights_ul").appendChild(pcrLi);
			pcrLi.innerHTML = '<a href="/app-bin/twr/TwrSSO">Total Wealth Report</a>';
		}
	
	}
	// end block //

	//Enter generic text strings to be displayed
	var string_array = new Array();
	string_array[0] = "your Financial Advisor";
	//string_array[1] = "the myFi Team Manager"; //New FLS copy
	string_array[1] = "your advisor"; //New FLS copy
	//added by   for Bondsearch.html
	string_array[2] = 'your Financial Advisor';
	string_array[3]= " <a href=\"javascript:void(0);\" onclick=\"window.open('/cgi-bin/emp/contactfc.cgi','FC','width=800,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,resizable=yes');\">your advisor</a>"; //New FLS copy

	//Loop through all SPAN tags and check the NAME
	var span_tags = document.getElementsByTagName("span")
	for( i = 0 ; i < span_tags.length ; i ++)
	{
		switch ( span_tags[i].id ){
			case "swapCopy[]": 
				if (fls_user || non_jv_user || cpb_user)
				{ 
			  		span_tags[i].innerHTML = string_array[1]
				}
				else
				{
			  		span_tags[i].innerHTML = string_array[0]				
				}
				break;
			//Added for Bondsearch.html
			case "changeEmailContact[]": 
				if (fls_user || non_jv_user || cpb_user)
				{
			  		span_tags[i].innerHTML = string_array[3]
				}
				else if (cbol_user)
				{
			  		span_tags[i].innerHTML = string_array[2]				
				}
				break;			
			default:
			  //else do nothing
		}
	}
}

/*Updated 4/23/2007-4/25/2007 - The functions below swaps out the default Morgan Stanley Smith Barney working
  with that for the Financial Life Services uers. */
  
//New copy 3/12/2008

function flsWelcomeText() {

	if (fls_user)
	{
	var newbody = document.getElementById("headtextBasicDiv")

	var newtext = "<div class=\"dropshadow\">Welcome</div>";
	newtext+= "Stay in touch with your advisor, pay your bills, research securities, receive your monthly statements online and more. <a href=\"/help/features/\">Learn</a> how to maximize your online experience.";

	newbody.innerHTML=newtext;
	}
}

function swapFLSFooter() {

	if (fls_user || non_jv_user || cpb_user){
	var newbody = document.getElementById("fcinfo")
	var newtext = "<img src=\"/images/0_blustar.gif\" alt=\"\" /> For more information, please contact your <a href=\"javascript:void(0);\" onclick=\"window.open('/cgi-bin/emp/contactfc.cgi','FC','width=800,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,resizable=yes');\"><strong>advisor</strong>.";
	newbody.innerHTML=newtext;
	}
}

function swapFLSText(lcText) {

	if (fls_user || non_jv_user || cpb_user)
	{
	var newbody = document.getElementById(lcText)

	var newtext = "your advisor";

	newbody.innerHTML=newtext;
	}
}

function swapFLSWithURL_orig(lcText, URL) {

	if (fls_user)
	{
		var newbody = document.getElementById(lcText);
		var newtext = 'the <a href="';
		newtext+= URL;
		newtext+='">';
		newtext+='MyFi Team</a>';
		newbody.innerHTML=newtext;
	}
}

function swapFLSWithURL(lcText, URL, oAttrib) 
{
	if (fls_user)
	{
		var newbody = document.getElementById(lcText);
		var oLink   = document.createElement('a');
		var _url  = URL ? URL : 'javascript:void(0)';
		var closure = '';
		oLink.setAttribute('href', _url);
		try
		{
			for (i in oAttrib)
			{
				switch (i)
				{
					case 'onclick':
						closure = oAttrib[i];
						oLink.onclick = function(){	eval(closure); }
						break;
					default:
						oLink.setAttribute(i, oAttrib[i]);
				}
			}
		}
		catch(e){alert('oAttrib error');}
		
		var oThe   = document.createTextNode('the ');
		var oTeam  = document.createTextNode('MyFi Team');
		oLink.appendChild(oTeam);
		newbody.innerHTML = '';
		newbody.appendChild(oThe);
		newbody.appendChild(oLink);
	}
}

function removeElement(lcText) {
	if (fls_user)
	{
		var anchor = document.getElementById(lcText);
		var parent = anchor.parentNode;
		var removedChild = parent.removeChild(anchor);
	}
}

function changeContactCopy(lcTag) {
	if (fls_user)
   {
	var newbody = document.getElementById(lcTag);
	var newtext = "Technical Support: 1-800-221-3636";

	newbody.innerHTML=newtext;

   }
}

function addCoreUserListItem(lcTag, lcText, lcClassName) {
	
	if (core_user)
	{
		var currentNode = document.getElementById(lcTag);
		var list = currentNode.parentNode;
		var newNode = document.createElement("li");
		var spanNode = document.createElement("span");
		
		var newTextNode = document.createTextNode(lcText);
		spanNode.appendChild(newTextNode);
		
			if (lcClassName)
			{
			   spanNode.className=lcClassName;
			}
		
		newNode.appendChild(spanNode);
		list.insertBefore(newNode, currentNode);
	}
}

function changeUserCopy(lcTag, lcText) {

	if (fls_user)
	{
		var newbody = document.getElementById(lcTag);
		var newtext = lcText;
		newbody.innerHTML=newtext;
	}
}
//end additions


//5/8/2007 additions
function changeUserCopy_CBOL(lcTag, lcText) {

	if (cbol_user)
	{
		var newbody = document.getElementById(lcTag);
		var newtext = lcText;
		newbody.innerHTML=newtext;
	}
}

function removeElement_CBOL(lcText) {
	if (cbol_user)
	{
		var anchor1 = document.getElementById(lcText);
		
		if (anchor1)
		{
			var parent = anchor1.parentNode;
			var removedChild = parent.removeChild(anchor1);
		}
	}
}
// End additions

//add 5/8/2007
function killAds_CBOL() {
	if (cbol_user)
	{
		var siteAdNav = document.getElementById("localDiv");
		if (siteAdNav)
		{		
			var siteAdNav2 = siteAdNav.getElementsByTagName("div");
	
			if (siteAdNav2.length>0)
			{
				for (var i=0; i < siteAdNav2.length; i++)
				{
					//alert(siteAdNav2[i].id.toUpperCase());
					switch (siteAdNav2[i].id.toUpperCase())
					{
						case "QUOTEBOX" :
							continue; 
						case "LOCALNAV" :
							if (siteAdNav2[i].innerHTML.indexOf("<img ") && siteAdNav2[i].innerHTML.toUpperCase().indexOf("<UL ")==-1)
							{
								//alert(siteAdNav2[i].innerHTML.indexOf("<UL "));
								siteAdNav2[i].innerHTML = ""; 
							}
							else
							{
								continue;
							} 
						default: 
							siteAdNav2[i].innerHTML = "";
							break;
					}
				}
			}
		}
	}
}
//End  

//Below is for use for protected URLS or PDFS
function oToolBox_CONSTRUCTOR()
{
	this.protected_url_check = function( origional_url , protected_url )
	{
		var cookie_string = unescape(document.cookie)
		if( cookie_string.indexOf('ssoSESSION=')>-1) 
		{
			window.open( protected_url , '' , '' );
		}
		else
		{
			oToolBox.create_cookie( 'protect_url_check' , 'orignal_html=' + origional_url + '|file_loc=' + protected_url + '|protect_url_check=' , 1 )
			window.location = '/cgi-bin/redirect/toolbox/protected_file_redirect.html'
		}
	}

	this.create_cookie = function( name , value , days ) 
	{
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}

	this.read_cookie = function ( name ) 
	{
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}

	this.erase_cookie = function ( name ) 
	{
		createCookie(name,"",-1);
	}

}
var oToolBox = new oToolBox_CONSTRUCTOR()

//1/30/2008: temp fix to the homepage banner. Only used for Homepage Banners
function quickHomeBannerFix()
{
	var banner = document.getElementById("noPZNHolder");
	
	if (banner)
	{
		//banner.innerHTML = '<a href="/research/special_reports/marketvolatility.html"><img src="/images/homepage/logged_in_banner.jpg" style="border: medium none ; float: left; position: absolute; top: 18px; right: 20px;z-index:1000;"></a>';
		banner.innerHTML = '<a href="/edelivery/ "><img src="/images/homepage/edelivery_tree.gif" style="border: medium none ; float: left; position: absolute; top: 18px; right: 20px;z-index:1000;"></a>';
	}
	else
	{
		return;
	}
}

//pop-up window for feedback form
function feedbackNewWind(){
	var newWind;
	if (!newWind || newWind.closed) {
		var url = getHTTPSProtocolURL() + "/salesforce/feedback.html";
		newWind = window.open(url,"popup","status,height=580px,width=490px,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes");
		if (!newWind.opener){
			newWind.opener = window;
		}
			newWind.document.close();
			self.name="main";
	
			}else{
				newWind.focus(); 
	}
}

// To change HTTP protocol as HTTPS
function getHTTPSProtocolURL() {
	var url = new String(window.location.href); 
	var baseURL = url.substring(0, url.indexOf('/', 8));

	if (baseURL.indexOf("https://")== -1) {
		prefix = "https://"; 
		baseURL = prefix + baseURL.substring(parseInt(baseURL.indexOf('//', 0)) + 2);
	}
   return baseURL ;
}

//added this legacy code for the add the watchlist for the quotes page 11/25/2008
	var remote = null;
	  function openwin(u,n,w,h,d) {
	    remote = window.open(u, n, 'width=' + w + ',height=' + h +',resizable=no,toolbar=no,status=yes,menuBar=no,scrollBars=no');
	    if (remote != null) {
	      window.name = d;
	      if (window.name == null)
	        window.name = 'Add to Watch List';
	    }
	  }

//added targetopener & popup legacy code from the Guest Registration Page
function targetopener(mylink, windowname)
{
 if (! window.focus)return true;
 var href;
 if (typeof(mylink) == 'string')
    href=mylink;
 else
    href=mylink.href;
 var width = 600;
 var height = 270;
 x = (640 - width)/2, y = (480 - height)/2;
 if (screen)
 {
  y = (screen.availHeight - height)/2;
  x = (screen.availWidth - width)/2;
 }
 window.open(href,windowname,'scrollbars,width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x+',titlebar=no');
 return false;
}

function popup(mylink, windowname)
{
	if (! window.focus)return true;
		var href;
		 if (typeof(mylink) == 'string')
			href=mylink;
		 else
			href=mylink.href;
		 var width = 600;
		 var height = 270;
		 x = (640 - width)/2, y = (480 - height)/2;
		 if (screen)
		 {
		  y = (screen.availHeight - height)/2;
		  x = (screen.availWidth - width)/2;
		 }
		 window.open(href,windowname,'width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x+',titlebar=no');
		 return false;
}


/* Automizing the Year in the Footer*/
function update_footer_year()
{
	var myDate = new Date(); 
	document.write(myDate.getFullYear());
}

//jv links swapped based on user branding cookie
function jvLinkSwap()
{ 
	if (fls_user || non_jv_user)			
	{
		if(document.getElementById('mssbForm'))			
		{
			var msgText = '<ul><li> <a href="/myaccess/account_management/forms2.html#open">New Account Forms</a></li>';
			msgText = msgText+ '<li> <a href="/myaccess/account_management/forms2.html#online">Online Services</a></li>';
			msgText = msgText+ '<li><a href="/products_services/quicken_msmoney/">Quicken and Microsoft Money</a></li>';
			msgText = msgText+ '<li><a href="/myaccess/account_management/forms2.html#maintain">Account Maintenance</a></li></ul>';
			msgText = msgText+ '<div class="btmCurve"></div>';

			document.getElementById('mssbForm').innerHTML = msgText;
		}
		if(document.getElementById('mssbFormLink'))
		{
			var linkText = '<span id="mssbFormLink"><a href="forms2.html">Forms</a></span>';

			document.getElementById('mssbFormLink').innerHTML = linkText;
		}
	}
}

//Show / Hide content based on user branding cookie
function conditionalWrite(condition, doctext)
{
	if (condition == "FLS_NONJV"){
		if (fls_user || non_jv_user)			
		{
			document.write(doctext);
		}
	}
	else if (condition == "NOT_FLS_NONJV"){
		if (!(fls_user || non_jv_user))
		{
			document.write(doctext);
		}
	}
}

// To display left side links of footer for the International user.
function displayIntlFooterLink(){
	var IntlUser=false;
	if( getcookie('BRAND_CTX')){
		if(getcookie('BRAND_CTX').indexOf('|7110')!= -1){
			IntlUser = true;
		}
	}

	if (IntlUser){
		document.write('<a href="/privacy.html" title="Privacy Policy">Privacy Policy</a>,  <a href="/intl_terms.html" title="International Terms and Conditions">International Terms and Conditions</a>');
	}else{
		document.write('<a href="/privacy.html" title="Privacy">Privacy</a>, <a href="/security.html" title="Security">Security</a>, <a href="/terms_conditions/" title="Terms and conditions">Terms and conditions</a>');
	}
}

function displayIntlFooterLink_New(){
	var IntlUser=false;
	if( getcookie('BRAND_CTX')){
		if(getcookie('BRAND_CTX').indexOf('|7110')!= -1){
			IntlUser = true;
		}
	}

	if (IntlUser){
		document.write('<li><a href="/about_us/" title="About Us">About Us</a></li>'+
		'<li><a href="/products_services/institutional/" title="Institutional Services">Institutional Services</a></li>'+
		'<li><a href="/privacy.html" title="Privacy Policy">Privacy Policy</a></li>'+
		'<li><a href="/about_us/intl_terms.html" title="International Terms and Conditions">International Terms and Conditions</a></li>');
	}else{
		document.write('<li><a href="/about_us/" title="About Us">About Us</a></li>'+
		'<li><a href="/products_services/institutional/" title="Institutional Services">Institutional Services</a></li>'+
		'<li><a href="/privacy.html" title="Privacy">Privacy</a></li>'+
		'<li><a href="/security.html" title="Security">Security</a></li>'+
		'<li><a href="/terms_conditions/" title="Terms and conditions">Terms and conditions</a></li>');
	}
}

//added function to swap out advisor text
function swapAdvisorText() {
 
 var span_tags = document.getElementsByTagName("span")
	for( i = 0 ; i < span_tags.length ; i ++)
	{ 
		if(span_tags[i].id == "advisorText") 
		{ 
			if (fls_user || non_jv_user || cpb_user){
				span_tags[i].innerHTML = "advisor ";
			}
			else{
				span_tags[i].innerHTML = "Financial Advisor ";
			}
		} 	
	}
}

//added function to swap out advisor text
function swapBigAdvisorText() {
 
 var span_tags = document.getElementsByTagName("span")
	for( i = 0 ; i < span_tags.length ; i ++)
	{ 
		if(span_tags[i].id == "bigAdvisorText") 
		{ 
			if (fls_user || non_jv_user || cpb_user){
				span_tags[i].innerHTML = "Advisor ";
			}
			else{
				span_tags[i].innerHTML = "Financial Advisor ";
			}
		} 	
	}
}


//added function to swap out disclaimer text
function swapDisclaimerTextAFT() {
 
 var span_tags = document.getElementsByTagName("span")
	for( i = 0 ; i < span_tags.length ; i ++)
	{ 
		if(span_tags[i].id == "disclaimerText") 
		{ 
			if (fls_user || non_jv_user || cpb_user){
				span_tags[i].innerHTML = "References to \"Smith Barney\" should be read as referring as referring to Citigroup Global Markets Inc.";
			}
			else{
				span_tags[i].innerHTML = "References to \"Smith Barney\" should be read as referring to Morgan Stanley Smith Barney LLC.";
			}
		} 	
	}
}


//Added function to dynamically change the title
	function changeTitle(titleTxt){

			document.title = titleTxt;
	}

//Added to swap the login form button for JV/NonJV user
function swapHPLoginFormButton(){
	if (non_jv_user || fls_user || cpb_user){
		if(document.getElementById('FindAdvisor')){
			document.getElementById('FindAdvisor').style.display="none";
		}
		if(document.getElementById('RegisterForSB')){
			document.getElementById('RegisterForSB').style.display="none";
		}
	}else{
		if(document.getElementById('RegisterOnlineAccess')){
			document.getElementById('RegisterOnlineAccess').style.display="none";
		}
	}
}

//Global function to swap image
function swapNonJVImage(imgId,imageName) {
            if(document.getElementById(imgId))
            {
                        if (fls_user || non_jv_user || cpb_user) {
                                    document.getElementById(imgId).src = imageName;                                 
                        }
            }
}

//Added to swap out footnote for banking and investments
function swapFootNote() {
	if(document.getElementById("footNote"))
	{
		if (fls_user || non_jv_user || cpb_user) {
			document.getElementById("footNote").innerHTML = " Securities offered through Citigroup Global Markets Inc. (\"CGMI\"), <a href=\"javascript:startLeaveAccess('/thirdparty.html?http://www.sipc.org');\">Member SIPC</a>. CGMI acts as broker/dealer and investment advisor for Citigroup businesses including the Citi Private Bank and Citi Personal Wealth Management. ";
		}
		else {
			document.getElementById("footNote").innerHTML = " Investment products and services are offered through Morgan Stanley Smith Barney LLC, <a href=\"javascript:startLeaveAccess('/thirdparty.html?http://www.sipc.org');\">Member SIPC</a>. Morgan Stanley Smith Barney LLC is a registered broker/dealer and investment advisor, formed by the combination of the Global Wealth Management Group of Morgan Stanley & Co. Incorporated and the Smith Barney division of Citigroup Global Markets Inc. ";
		}
	}
}

//Added to swap out help PDF URL
function swapPDFURL() {
	if(document.getElementById("pdfurl"))
	{
		if (fls_user || non_jv_user || cpb_user) {
			document.getElementById("pdfurl").innerHTML = "<a href=\"/pdf/fm2140-C.pdf\" style=\"color:blue; text-decoration:underline;\">Need Help Understanding Your Account Statement(s)</a>";
		}
		else {
			document.getElementById("pdfurl").innerHTML = "<a href=\"/pdf/fm2140.pdf\" style=\"color:blue; text-decoration:underline;\">Need Help Understanding Your Account Statement(s)</a>";
		}
	}
}

function swapNonJVImg() {

            if(document.getElementById("previewPopupImg"))
            {
                        if (fls_user || non_jv_user || cpb_user) {
							
                                    document.getElementById("previewPopupImg").src = "/images/homepage/customizer/preview/citi_Preview-Top.gif";                                 
                        }
            }
}

function checkNonJVUser() {

	if (fls_user || non_jv_user || cpb_user) {
		return true;		
	}
	else{
		return false;
	}

}



