// JavaScript Document - PopUp Functions

function popup(url, w, h) {
	// javascript:popup('overdraft_protection.htm', '390', '235');
	
	var wid = w;
	var hi = h;
	
	var scroll = true;
	
	var winl = (screen.width-w) / 2;
	var wint = (screen.height-h) / 2;
	
	new_spec = wid + "_" + hi + scroll;
	
	scrolling = scroll? "yes": "no";
	if(scroll && document.all && (navigator.userAgent.indexOf("Mac") > -1)) wid = wid + 17;
	
	newwin = window.open(url, new_spec, "WIDTH=" + wid + ",HEIGHT=" + hi + ",scrollBars=" + scrolling + ",resizable=no,screenX=" + winl + ",screenY=" + wint + ",left=" + winl + ",top=" + wint);
	newwin.focus();
};

function openLoc() {
	// javascript:popup('/leaving_fox_chase_bank.htm?extLink=http://www.haleypro.com', '390', '235');
	
	var loc = location.search;
	var locURL = loc.substring(9);
	
	newwin = window.open(locURL);
	newwin.focus();
	
	closePopup(true);
};

function buildEmail() {
	// javascript:popup('/email_protection.htm?extLink=mailto:ThePresident@foxchasebank.com', '390', '200');
	
	var loc = location.search;
	var locURL = loc.substring(9);
	
	document.getElementById("emailLink").href = locURL;
};

function closePopup(fromFunction) {
	self.close();
	
	if(fromFunction !== true) {
		window.opener.focus();
	};
};