var onloadQueue = [];
var number_of_images=3;
var speed=6;
var step=2;
var whichimage=1;
var image1=new Image();

image1.src="/publish/ust/images/home1.jpg";
var image2=new Image();
image2.src="/publish/ust/images/home2.jpg";
var image3=new Image();
image3.src="/publish/ust/images/home3.jpg";

window.onload = function() 
{
     for (var i=0;i<onloadQueue.length;i++)
     {
            eval (onloadQueue[i]());
     }
}
onloadQueue.push(pageCheck);


function pageCheck()
{

var title1 = document.title;
title= title1.replace('Merrill Lynch Wealth Management','U.S. Trust');
if(title1.indexOf('Merrill Lynch')!=-1)
{	
     document.title='U.S. Trust'+' - '+title1.split('-')[2];
	 
}
if(window.location.href.toLowerCase().indexOf('infoattorneysinfo.aspx')!= -1)
{
document.title = "Instructions to CIO";
}
if(window.location.href.toLowerCase().indexOf('errorpage')!= -1)
{
document.title = "U.S. Trust | Please Try Again";
}
if(window.location.href.toLowerCase().indexOf('index.aspx')!= -1)
{
document.title ="U.S. Trust";
slideit();
//cmCreatePageviewTag('GWIM:Mkt:Investments:USTrust;Index',null, null,'GWIM:Mkt:Investments:USTrust',false,false,null,false,false,null,null,null,null,null,null,null,null);
}
if(window.location.href.toLowerCase().indexOf('aboutus.aspx')!= -1)
{
//cmCreatePageviewTag('GWIM:Mkt:Investments:USTrust;AboutUs',null, null,'GWIM:Mkt:Investments:USTrust',false,false,null,false,false,null,null,null,null,null,null,null,null);
}
if(window.location.href.toLowerCase().indexOf('capabilities.aspx')!= -1)
{
//cmCreatePageviewTag('GWIM:Mkt:Investments:USTrust;Capabilities',null, null,'GWIM:Mkt:Investments:USTrust',false,false,null,false,false,null,null,null,null,null,null,null,null);

}
if(window.location.href.toLowerCase().indexOf('thinking.aspx')!= -1)
{
//cmCreatePageviewTag('GWIM:Mkt:Investments:USTrust;Thinking',null, null,'GWIM:Mkt:Investments:USTrust',false,false,null,false,false,null,null,null,null,null,null,null,null);

}
if(window.location.href.toLowerCase().indexOf('accounts.aspx')!= -1)
{
//cmCreatePageviewTag('GWIM:Mkt:Investments:USTrust;Accounts',null, null,'GWIM:Mkt:Investments:USTrust',false,false,null,false,false,null,null,null,null,null,null,null,null);

}
if(window.location.href.toLowerCase().indexOf('history.aspx')!= -1)
{
//cmCreatePageviewTag('GWIM:Mkt:Investments:USTrust;History',null, null,'GWIM:Mkt:Investments:USTrust',false,false,null,false,false,null,null,null,null,null,null,null,null);

}
if(window.location.href.toLowerCase().indexOf('pressroom.aspx')!= -1)
{
//cmCreatePageviewTag('GWIM:Mkt:Investments:USTrust;PressRoom',null, null,'GWIM:Mkt:Investments:USTrust',false,false,null,false,false,null,null,null,null,null,null,null,null);

}
if(window.location.href.toLowerCase().indexOf('investmentmgmt.aspx')!= -1)
{
//cmCreatePageviewTag('GWIM:Mkt:Investments:USTrust;InvestmentMgt',null, null,'GWIM:Mkt:Investments:USTrust',false,false,null,false,false,null,null,null,null,null,null,null,null);

}
if(window.location.href.toLowerCase().indexOf('wealthstructuring.aspx')!= -1)
{
//cmCreatePageviewTag('GWIM:Mkt:Investments:USTrust;WealthStructuring2',null, null,'GWIM:Mkt:Investments:USTrust',false,false,null,false,false,null,null,null,null,null,null,null,null);

}
if(window.location.href.toLowerCase().indexOf('creditandbanking.aspx')!= -1)
{
//cmCreatePageviewTag('GWIM:Mkt:Investments:USTrust;CreditandBanking2',null, null,'GWIM:Mkt:Investments:USTrust',false,false,null,false,false,null,null,null,null,null,null,null,null);

}
if(window.location.href.toLowerCase().indexOf('familyoffice.aspx')!= -1)
{
//cmCreatePageviewTag('GWIM:Mkt:Investments:USTrust;FamilyOffice2',null, null,'GWIM:Mkt:Investments:USTrust',false,false,null,false,false,null,null,null,null,null,null,null,null);

}
if(window.location.href.toLowerCase().indexOf('legacy.aspx')!= -1)
{
//cmCreatePageviewTag('GWIM:Mkt:Investments:USTrust;Legacy',null, null,'GWIM:Mkt:Investments:USTrust',false,false,null,false,false,null,null,null,null,null,null,null,null);

}
if(window.location.href.toLowerCase().indexOf('clientprofile1.aspx')!= -1)
{
//cmCreatePageviewTag('GWIM:Mkt:Investments:USTrust;ClientProfile1',null, null,'GWIM:Mkt:Investments:USTrust',false,false,null,false,false,null,null,null,null,null,null,null,null);

}
if(window.location.href.toLowerCase().indexOf('clientprofile2.aspx')!= -1)
{
//cmCreatePageviewTag('GWIM:Mkt:Investments:USTrust;ClientProfile2',null, null,'GWIM:Mkt:Investments:USTrust',false,false,null,false,false,null,null,null,null,null,null,null,null);

}
if(window.location.href.toLowerCase().indexOf('clientprofile3.aspx')!= -1)
{
//cmCreatePageviewTag('GWIM:Mkt:Investments:USTrust;ClientProfile3',null, null,'GWIM:Mkt:Investments:USTrust',false,false,null,false,false,null,null,null,null,null,null,null,null);

}
}

//if(window.location.href.toLowerCase().indexOf('account.aspx')!= -1)
//{
//var ie4 = (document.all && !document.getElementById);
//	var ie5 = (document.all && document.getElementById);
//	var ns6 = (!document.all && document.getElementById);
//	<!--
//	 var t = "<a href=\"##\" onClick=\"javascript:window.open('https://wealthmanagement.bankofamerica.com/nsm/demo/welcome.html','Demo','width=775,height=600,scrollbars=no,resizable=yes,left=35,top=161,menubar=no,scrollbars=no,toolbar=no,directories=no');\"><img id=\"button_viewdemo_on\" align=\"center\" border=\"0\" src=\"images/button_viewdemo_on.gif\" alt=\"This link will present the Wealth Management Online demo in a new window\" onmouseover=\"over_image();\" onmouseout=\"out_image();\" onmousedown=\"down_image();\"/><\/a>";
//	document.writeln(t);
//						//-->

//	
//	
//}
//}

/* History page */
function next_link_click(panel_num){
	switch(panel_num){
			case 0: show_hide_panel('1812');
			break;
			case 1: show_hide_panel('1847');
			break;
			case 2: show_hide_panel('1853');
			break;
			case 3: show_hide_panel('1886');
			break;
			case 4: show_hide_panel('1906');
			break;
			case 5: show_hide_panel('1930');
			break;
			case 6: show_hide_panel('1954');
			break;
			case 7: show_hide_panel('1989');
			break;
			case 8: show_hide_panel('2007');
			break;
	}
}

function show_hide_panel(year){
	var show_array = new Array("1784","1812","1847","1853","1886","1906","1930","1954","1989","2007");
	for (i=0; i< show_array.length; i++)
	{
			document.getElementById("panel" + show_array[i]).className="horizontal_accordion_toggle";
	}
	document.getElementById("panel" + year).className='horizontal_accordion_hide';
	var show_array = new Array("1784","1812","1847","1853","1886","1906","1930","1954","1989","2007");

	for (i=0; i< show_array.length; i++)
	{
		if(show_array[i] != year)
		document.getElementById("panel" + show_array[i]).className="horizontal_accordion_toggle";
	}
}


/* index page */

function slideit(){

		if (!document.images)
			return;
		if (document.all)
			document.all("slide").filters.blendTrans.apply();
		/*document.all("slide").src=eval("image"+step+".src");*/
		document.images[5].src=eval("image"+step+".src");
		if (document.all)
			document.all("slide").filters.blendTrans.play();
		whichimage=step
		if (step<number_of_images)
			step++;
		else
			step=1;
		if (document.all)
			setTimeout("slideit()",speed*1000+4000);
		else
			setTimeout("slideit()",speed*1000);
	}
	
	
function reapply(){
if(window.location.href.toLowerCase().indexOf('index.aspx')!= -1)
{
	setTimeout("slideit()",5000)
	return true;
	}}
	window.onerror=reapply


/*  accounts page  */


var ie4 = (document.all && !document.getElementById);
	var ie5 = (document.all && document.getElementById);
	var ns6 = (!document.all && document.getElementById);

	function getElement(id){
		// Explorer 4
		if(ie4){
				return document.all[id];
		}
		// W3C - Explorer 5+ and Netscape 6+
		else if(ie5 || ns6){
			return document.getElementById(id);
		}
	}

	function out_image()
		 {
			getElement('button_viewdemo_on').src = "/publish/ust/images/button_viewdemo_on.gif";
		 }
	function over_image()
		 {
			getElement('button_viewdemo_on').src = "/publish/ust/images/button_viewdemo_over.gif";
		 }
	function down_image()
		 {
			getElement('button_viewdemo_on').src = "/publish/ust/images/button_viewdemo_down.gif";
		 }

function demo_window() {

		var demo_url = 'http://www.bankofamerica.com/ustrust/demo/index.html';
		var win = window.open(demo_url, 'preWin','width=770,height=585,scrollbars=no,resizable=0')

	}


//Global namespace to hold ML.Online.USTrust 
var MLOnlineUSTrust  = new Object();
MLOnlineUSTrust.Framework = new Object();
MLOnlineUSTrust.Framework.I2ATagging = function()
{
    this.version					= '1.0';
    this.type						= 'TMI2ATagging';    
}

// ....................   Global var to hold instance of MLOnlineUSTrust Utility class ..................
var g_ml_tm_jsLib_I2A; //this var must be unique...
// ....................................................................................................

//....................... prototype ......................
MLOnlineUSTrust.Framework.I2ATagging.prototype = 
{
    pixel : function()
    {
        var ic_bu = " GWIM+US+Trust ";
        var io = new Image();
        var icstring,refVar,locURL,locHttp,prefix;
        var icstring =".ic-live.com/goat.php?cID=1233&cdid=4676&campID=8";
        var refVar = (document.referrer);
        var locURL = location.href;
        var locHttp = locURL.split(":")[0];
        prefix="http://1233"+icstring+"";
        urlA = prefix+"&ic_cat=&ic_type=&ic_bu="+ ic_bu +"&ic_bc=&ic_ch=&ic_nso=&refVar="+escape(refVar);
        io.src = urlA;
    }
}
// ..................... Initialize global variable....................................................
g_ml_tm_jsLib_I2A = new MLOnlineUSTrust.Framework.I2ATagging();
// ....................................................................................................

g_ml_tm_jsLib_I2A.pixel();
// I2A tagging Ends here

