
// changeImage function
function ChangeImage(ImageName, NewImage, Title, Directory){
if (document.images) {
// alert (ImageName + " - " + NewImage + " - " + Title + " - " + Directory);
	if (String (Directory) != "undefined") {
//MSB change - passing the ending / already
//		document[ImageName].src = Directory + "/" + NewImage;
//MSB Test Hack
Directory = ".." + Directory;
if (String (Directory).lastIndexOf("/") != String (Directory).length-1)	{
	Directory = Directory + "/";
}
		document[ImageName].src = Directory + NewImage;
	} else {
		document[ImageName].src = "images/" + NewImage;
	}
}
if (String (Title) != "undefined") {
	window.status=Title;
} else {
	window.status=' ';
}
}
function chgbk(id, newcolor)
{
	if(document.layers){ 	// browser="NN4"; 
		document.layers[id].bgColor = newcolor; 
	} 
	
	if(document.all){ 	// browser="IE"; 
		document.all[id].style.backgroundColor = newcolor; 
	} 
	
	if(!document.all && document.getElementById){ // browser="NN6+ or IE5+ if you're willing to dump the !document.all stuff"; 
		document.getElementById(id).style.backgroundColor = newcolor; 
	} 
}


// This function is a modified version of the above function that uses CSS classes rather than
// passing colors in directly.  The old version is left in for backward compatibility.
// Author: kdye@vignette.com, July 12, 2005
function chgBkgd(id, className)
{
	if(document.layers){ 	// browser="NN4"; 
		document.layers[id].className = className; 
	} 
	
	if(document.all){ 	// browser="IE";
		document.all[id].className = className;
	} 
	
	if(!document.all && document.getElementById){ // browser="NN6+ or IE5+ if you're willing to dump the !document.all stuff"; 
		document.getElementById(id).className = className; 
	} 
}

//RXA774 Added separate exit Page function KT-1313
function redirectToExitPageType(filename,exitPageUrl,newWindow,displayExitMsg,windowname,type)
//filename - destination Url
//exitPageUrl - Url for the global Exit Page(Path = Global/Global Exit Page)
//newwindow - boolean (if set to 'true' - opens up in a new window)
//displayExitMsg - if set to 0: redirects to the destination Url without displaing the exit message
//				- if set to 1: displays the exit Message
//windowname - name of the window
{
	//Support for bc in exit page
		var bc="";
		if (DCSext["mct_a"]!="") {
			bc=DCSext["mct_a"];			
			}
	//End Support for bc in exit page
//MSB 02-23-06
//We're just escaping the external sites url query string
filename = escape(filename);


	var redirectUrl = exitPageUrl + "&url=" + filename + "&Exit=" + displayExitMsg+ "&mct_a="+bc+"/affiliated_pages&type=" + type ;
	if (String (newWindow) == "false" ) {
		document.location.href = redirectUrl;
	} else {
		popupWindowWithLocation(redirectUrl,windowname,"682","352"); 
	}
}
 


function redirectToExitPage(filename,exitPageUrl,newWindow,displayExitMsg,windowname)
//filename - destination Url
//exitPageUrl - Url for the global Exit Page(Path = Global/Global Exit Page)
//newwindow - boolean (if set to 'true' - opens up in a new window)
//displayExitMsg - if set to 0: redirects to the destination Url without displaing the exit message
//				- if set to 1: displays the exit Message
//windowname - name of the window
{
	//Support for bc in exit page
		var bc="";
		if (DCSext["mct_a"]!="") {
			bc=DCSext["mct_a"];			
			}
	//End Support for bc in exit page
//MSB 02-23-06
//We're just escaping the external sites url query string
filename = escape(filename);


	var redirectUrl = exitPageUrl + "&url=" + filename + "&Exit=" + displayExitMsg+ "&mct_a="+bc+"/affiliated_pages" ;
	if (String (newWindow) == "false" ) {
		document.location.href = redirectUrl;
	} else {
		popupWindowWithLocation(redirectUrl,windowname,"682","352"); 
	}
}
 
function popupWindow(filename,windowname,width,height)  
{
popup=window.open(filename,windowname,"width="+width+",height="+height+",resizable=yes,status=no,toolbar=yes,directories=no,menubar=yes,scrollbars=yes,location=no");
}

function popupWindowWithLocation(filename,windowname,width,height) 
{

popup=window.open(filename,windowname,"width="+width+",height="+height+",resizable=yes,status=yes,toolbar=yes,directories=no,menubar=yes,scrollbars=yes,location=yes");
}

function popupWindowNoToolbars(filename,windowname,width,height) 
{
popup=window.open(filename,windowname,"width="+width+",height="+height+",resizable=no,status=no,toolbar=no,directories=no,menubar=no,scrollbars=yes,location=no");
}

function popupWhyComerica(filename)
{
	// popupWindowWithLocation(filename, "why_com", "640", "480");
	popup=window.open(filename, "why_com", "width=630,height=470,resizable=yes,status=yes,toolbar=yes,directories=no,menubar=yes,scrollbars=no,location=yes,left=75,top=60");
}

function popupGlossary(filename)
{
	popupWindowNoToolbars(filename, 'glossary', '690', '470');
}

function popupFAQ(filename)
{
	popupWindowNoToolbars(filename, "faq", "690", "470");
}

function popupNewsletter(filename)
{
	popupWindowWithLocation(filename, "newsletter", "800", "575");
}

function popupCalculator(filename)
{
	popupWindowWithLocation(filename, "calculator", "540", "575");
}

function popupDemo(filename)
{
	if (filename.indexOf("eFX") > 0) {
		popupDemoNC(filename);
	} else {
		popupWindowWithLocation(filename, "demo", "800", "575");
	}
}

function popupTutorial(filename)
{
	popupWindowWithLocation(filename, "tutorial", "540", "575");
}

function popupBranchATM(filename)
{
	var windowHeight = 0.75 * screen.height;
	// alert("screen height = " + screen.height);
	// alert("window height = " + windowHeight);
	popupWindowWithLocation(filename, "branchATM", "575", windowHeight);
}
 
function popupForm(filename)
{
	//popupWindowWithLocation(filename, "form", "575", "575");
	popupWindowWithLocation(filename, "form", "710", "575");
}

function popupLogin(filename)
{
	popupWindowWithLocation(filename, "login", "800", "575");
}

function popupApply(filename)
{
	popupWindowWithLocation(filename, "apply", "800", "575");
}

function popupPrintable(filename)
{
	popupWindow(filename, "printable", "670", "575");
}

function popupPDF(filename)
{
	popupWindowWithLocation(filename, "pdf", "800", "575");
}

function popupDemoNC(filename) {
		
	var NewX = Math.max(0, Math.floor((screen.availWidth - (800)) / 2));
	var NewY = Math.max(0, Math.floor((screen.availHeight - (565)) / 2));
	
	var params = new Array();
	params.push('width=792');
	params.push('height=538');
	params.push('screenx=' + NewX);
	params.push('screeny=' + NewY);
	params.push('left=' + NewX);
	params.push('top=' + NewY);
	params.push('resizable="no"');
	params.push('scrollbars="no"');
	params.push('toolbar="no"');
	params.push('menubar="no"');
	params.push('status="no"');
	params.push('location="no"');
	params.push('directories="no"');	
		
	window.open(filename, '', params.join(','));

}


