window.onload = function () {
   attachPopups();
}

/*
  This function will launch a new browser window or pop-up window for any links 
  contained within the XHTML that have titles that match the title variable.
*/
function launchWindow(title, name, width, height, scrollbars, resizable, left, top) {
 if (!document.getElementsByTagName) 
	 return false;
 var links = document.getElementsByTagName("a");
 if (links.length < 1) 
	 return false;
 for (var i = 0; i < links.length; i++) {
	 var linkTitle = links[i].getAttribute("title");
	 if (linkTitle == title && width != null) {			// Launches "pop-up" style windows.
		 links[i].onclick = function() {
			 var newPopUp = window.open(this.getAttribute("href"), name, "width=" + width + ",height=" + height + ",scrollbars=" + scrollbars + ",resizable=" + resizable + ",left=" + left + ",top=" + top);
			 return false;
		 }
	 }
	 else if (linkTitle == title && width == null) {	// Launches normal browser windows.
		 links[i].onclick = function() {
			 var newWindow = window.open(this.getAttribute("href"), name);
			 return false;
		 }
	 }
 }
}
			
function attachPopups(){
//launchWindow function included by the parent template
launchWindow("Open a new personal checking Account. Opens in a new window.","newwindow");
launchWindow("Compare Consumer Accounts. Opens in a new window.","newwindow");
launchWindow("Open a new business checking Account. Opens in a new window.","newwindow");
launchWindow("Compare Small Business Accounts. Opens in a new window.","newwindow");
launchWindow("¿Preguntas? Contáctenos", "newwindow");
launchWindow("Contact Us. Opens in a new window.", "newwindow");
launchWindow("Find out more button. Opens in new window.", "newwindow");
	launchWindow("Bank of America.com Opens new window.", "newwindow");
	launchWindow("Privacy and Security. Link opens a new browser window.", "newwindow");
	launchWindow("Google Maps Terms and Conditions. Link opens a new browser window.","newwindow");
	launchWindow("Equal Housing Lender. Link opens a new pop-up window.", "newwindow", 640, 371, "yes", "yes", 35, 161);
}
