/**
 * Tooltip.js: simple CSS tool tips with drop shadows.
 *
 * This module defines a Tooltip class. Create a Tooltip object with the
 * Tooltip() constructor. Then makei it visible with the show() method.
 * When done, hide it with the hide() method.
 *
 * Note that this module must be used with appropriate CSS class definitions
 * to display correctly. The following are examples:
 *
*/ 
function Tooltip() {	
	this.tooltip = document.createElement("div");
	this.tooltip.style.position = "absolute";	
	this.tooltip.style.visibility = "hidden"; 	
	this.tooltip.className = "tooltipShadow";	
	
	this.content = document.createElement("div");	
	this.content.style.position = "relative";	
	this.content.className = "tooltipContent";	
	
	this.tooltip.appendChild(this.content);		
}

Tooltip.prototype.show = function(text, x, y) {
	this.content.innerHTML = text;		
	this.tooltip.style.left = x + "px";	
	this.tooltip.style.top = y + "px";
	this.tooltip.style.visibility = "visible";	
	
	if (this.tooltip.parentNode != document.body)
		document.body.appendChild(this.tooltip);
};

Tooltip.prototype.hide = function() {
	this.tooltip.style.visibility = "hidden";	
};


Tooltip.prototype.schedule = function(target, e) {
	// get the text to display
	var text = target.getAttribute("tooltip");
	if (!text) return;
	
	
 	var x = window.event.clientX;
	var y = window.event.clientY;
	
	var self = this;
//	document.write(Geometry.getHorizontalScroll()+"<br>");
//	document.write(Geometry.getVerticalScroll());
//	document.write('geometrytest<br>');
//	document.write(text); 
	self.show(text, x, y);


	var timer = window.setTimeout(function() {self.show(text, x, y); }, Tooltip.DELAY);
	
	if (target.addEventListener) target.addEventListener("mouseout", mouseout, false);
	else if (target.attachEvent) target.attachEvent("onmouseout", mouseout);
	else target.onmouseout = mouseout;
	
	function mouseout() {
		self.hide();
		window.clearTimeout(timer);
		if (target.removeEventListener)
			target.removeEventListener("mouseout", mouseout, false);
		else if (target.detachEvent) target.detachEvent("onmouseout", mouseout);
		else target.onmouseout = null;
	}

}

Tooltip.tooltip = new Tooltip();
Tooltip.schedule = function(target,e) { Tooltip.tooltip.schedule(target, e); }

function GetTool(toolthis, toolevent, tip) {
switch (tip) {
	case "OnlBanking":
		var text = "Online Banking offers the convenience of accessing your accounts <br>and statements through your 						            personal computer. This service <br>offers a secure method to access your accounts without the <br>constraints of            traditional banking	hours."	;	
		break;
	case "OnlBillPay":
		var text = "Online Bill Payment is a user-friendly system that allows you to <br>pay your bills from your personal computer. Paying your bills <br>online is safe, convenient, and easy for even the novice <br>computer user.	";
		break;
	case "PhoneBanking":
		var text = "Access your account balances and transfer funds from the <br>convenience of your phone wherever you travel. This free and <br>secure service offers you the added convenience of managing <br>your accounts outside banking hours even when you are away <br>from your computer.";
		break;
	case "BankByMail":
		var text = "We will provide Business Reply postage-paid envelopes for your use. <br>These envelopes can be used to send deposits, correspondence, or <br>payments to us.";
		break;
	case "CheckCard":
		var text = "A Waterford Bank, N.A. Check Card can be used anywhere Visa&reg;<br> is accepted. Your account will be automatically debited for the <br>amount of your purchases. What&#39;s more-Access to your accounts <br>with a Waterford Bank, N.A. Check Card is as close as the <br>nearest ATM machine-no more time wasted trying to find a <br>particular bank&#39;s ATM location.";
		break;
	case "ConsumerLoan":
		var text = "We offer both secured and unsecured loans at competitive rates.";
		break;
	case "HELOC":
		var text = "We offer a competitively priced personal line of credit, <br>secured by the equity in your home-with potential tax <br>benefits for you. This requires no up-front <br>costs or annual fees to you";
		break;
	case "Mortgage":
		var text = "We offer an array of mortgage products to allow you to purchase <br>a home, build a new home, or refinance an existing loan. Fixed <br>rates, adjustable rates, and interest-only products are available.";
		break;
	case "Overdraft":
		var text = "We offer the protection of linking your savings account, a <br>personal line of credit, or your home equity line of credit to <br>your checking account to protect you from overdrafts.";
		break;
	case "CreditCard":
		var text = "We offer the convenience and security of a Waterford Bank, N.A. <br>Visa&reg; available exclusively to our banking customers and with <br>no annual fee.";
		break;
	case "ClassicChk":
		var text = "Classic Checking offers unlimited check writing, free online <br>banking and bill-pay, low minimum balance requirements, and <br>much more.";
		break;
	case "EliteChk":
		var text = "In addition to all of the benefits associated with Classic <br>Checking, Elite Checking pays you interest.";
		break;
	case "PremierMM":
		var text = "Maximize your return with a Premier Money Market account.  <br>You&#39;ll always have immediate access to your funds, while <br>earning a premium return.";
		break;
	case "PremierPlusMM":
		var text = "As a reward for our clients who choose to use Waterford <br>Bank, N.A. for their overall personal checking needs, we <br>offer our exclusive Premier <b>Plus</b> Money Market Account. <br>The Premier <b>Plus</b> Money Market Account pays as much <br>as 1% over our regular Premier Money Market rates. Contact <br>us for more information on how to qualify for this account.";
		break;
	case "ClassicSav":
		var text = "Start saving today with Waterford Bank, N.A.&#39;s Classic Savings <br>account.  This account offers security, competitive interest rates, <br>and easy access to your money.";
		break;
	case "COD":
		var text = "Maximize your return with a Waterford Bank, N.A. Certificate <br>of Deposit.    We offer competitive rates and the personal attention <br>you deserve.";
		break;
	case "CDARS":
		var text = "FDIC Insurance is available on your deposits greater than $250,000<br> (through December 31, 2013) through our CDARS&reg; program. <br> We offer various term CDs and can insure up to $50 million.";
		break;
	case "BusCheck":
		var text = "Our experienced professionals will take the time to learn <br>about you and your business in order to customize your <br>Waterford business banking experience.  We will work with <br>your team to select accounts that effectively manage your <br>cash needs and maximize your return.";
		break;
	case "BusCOD":
		var text = "Maximize your return with a Waterford Bank Certificate of Deposit. <br>We offer competitive rates and the personal attention your <br>business deserves. ";
		break;
	case "BusOnline":
		var text = "Online Banking offers the convenience of accessing your accounts <br>and statements through the convience of your personal computer.  <br>This service offers a secure method to access your accounts without <br>the constraints of traditional banking hours.  Enhanced features <br>include access to initiating wire transfers, ACH payments, stop <br>payments, and funds transfers between accounts and much more.";
		break;
	case "BusBillPay":
		var text = "Online Bill Payment is a user-friendly system that allows you to <br>pay your bills via your personal computer.  Paying your bills <br>online is safe, convenient, and easy for even the novice computer <br>user.  Business enhancements include the ability to require <br>management authorization for payment release and extensive <br>reporting capabilities.";
		break;
	case "RemoteDep":
		var text = "Enjoy the convenience of depositing checks electronically from <br>your office by using a desktop scanner connected to your <br>personal computer.  This simple, easy-to-use service scans the <br>images of checks from your customers and makes deposits <br>electronically to your Waterford Bank, N.A. accounts.";
		break;
	case "Courier":
		var text = "We can schedule a courier to pick up your deposits daily, <br>weekly, or on demand. ";
		break;
	case "BusBankByMail":
		var text = "We will provide Business Reply postage-paid envelopes for your use.  <br>These envelopes can be used to send deposits, correspondence, or <br>payments to us.";
		break;
	case "ACH":
		var text = "By using your personal computer and our Online Business <br>Banking solution, you can initiate your ACH transactions from <br>the convenience of your office.  Many payment and collection <br>options are available including direct deposit of payroll, <br>automatic bill collection, cash concentration, and vendor <br>payments. ";
		break;
	case "Sweep":
		var text = "Utilize a Sweep account from Waterford Bank, N.A. and maximize the <br>return you earn on your excess balances.  Available funds in your checking <br>account will sweep automatically into a Money Market Savings account <br>or pay down on your Commercial Line of Credit.";
		break;
	case "PosPay":
		var text = "Help reduce exposure to fraud with Waterford Bank, N.A.&#39;s Positive Pay <br>service. Through our Online Business Banking solution, you can view <br>images of potentially fraudulent items online prior to making a pay or <br>return decision.";
		break;
	case "Wire":
		var text = "We understand how important it is that wire transfer requests are <br>handled accurately and timely.  Your request will be handled by our <br>in-house wire transfer department with Waterford Bank, N.A.&#39;s <br>promise of quality personal attention. As an added benefit of our <br>Online Business Banking solution, you can initiate a wire transfer <br>from the convenience of your office.";
		break;
	case "Lockbox":
		var text = "Maximize the potential of your cash flow with our locally <br>processed lockbox service.   Our wholesale lockbox solutions can <br>help you increase the speed of your collections and posting while <br>minimizing the time and expense required to collect and reconcile <br>your receivables. Used with our Online Business Banking solution, <br>you can elect to receive deposit notification reports customized <br>for your business information needs.";
		break;
	case "ZBA":
		var text = "A Zero Balance Account (ZBA) links your various business account to a <br>master account to maximize the user of your available cashflow.  <br>Funds flow automatically between your ZBA account and the <br>master account which eliminates the need for you to transfer <br>funds between your Waterford Bank, N.A. accounts. ";
		break;
	case "Merchant":
		var text = "This service gives your business the ability to accept customer <br>payments through all major credit cards. We will work with you to <br>develop a payment processing solution that meet your needs, while <br>providing convenient payment options for your customers.  Let <br>Waterford Bank, N.A. give you a quote today.";
		break;
	case "Recon":
		var text = "Account reconciliation is a cost-effective way to quickly track <br>and reconcile daily deposits from multiple locations.  <br>Maintaining a single account structure allows you to have a <br>detailed record of deposit activity from every location.  With this <br>service, Waterford Bank, N.A. can also act as an extension of your<br> accounting department by providing a partial (paid) reconciliation <br>or a full reconciliation via transmission or other electronic method.";
		break;
	case "LOC":
		var text = "Flexible and revolving lines of credit that can be structured to meet <br>the specific needs of your business are available.  We offer a <br>convenient way to finance seasonal cash needs, receivable financing, <br>inventory financing and short term cash flow needs - all with <br>the Waterford Bank, N.A. commitment to quality, personal service.";
		break;
	case "TermLoan":
		var text = "When you are looking to purchase equipment you need to run or <br>expand your business, the Waterford Bank, N.A. team offers <br>competitive financing with flexible terms and options. ";
		break;
	case "RealEstate":
		var text = "Our experienced team offers the expertise to make <br>financing simple when you are looking to acquire, <br>develop, rehabilitate, or build on commercial real <br>estate. ";
		break;
	case "BusOverdraft":
		var text = "We offer the protection of linking your business savings account or commercial <br>line of credit to a business checking account to protect you from overdrafts.";
		break;
	case "BusCreditCard":
		var text = "We offer the convenience and security of a Waterford Bank, N.A. Visa&reg; <br> card exclusively to our banking customers with no annual fee.   ";
		break;
	}

if (window.screenX) {	// Firefox and others

	var x = toolevent.clientX;
	var y = toolevent.clientY;

	var timer = window.setTimeout(function() {Tooltip.tooltip.show(text, x, y); }, Tooltip.DELAY);
	
	if (Tooltip.tooltip.addEventListener) {
//		document.write("addEventListener");
		Tooltip.tooltip.addEventListener("mouseout", mouseout, false);
	}
	else if (Tooltip.tooltip.attachEvent) {
//		document.write("attachEvent");
		Tooltip.tooltip.attachEvent("onmouseout", mouseout);
	}
	else {
//		document.write("onmouseout");
		Tooltip.tooltip.onmouseout = mouseout;
		window.clearTimeout(timer);
		var timer = window.setTimeout(function() {Tooltip.tooltip.hide(); }, 5);
	}

	function mouseout() {
		Tooltip.tooltip.hide();
		window.clearTimeout(timer);
		if (Tooltip.tooltip.removeEventListener)
			Tooltip.tooltip.removeEventListener("mouseout", mouseout, false);
		else if (Tooltip.tooltip.detachEvent) Tooltip.tooltip.detachEvent("onmouseout", mouseout);
		else Tooltip.tooltip.onmouseout = null;
		}
	}
else
	{
		toolthis.tooltip = text;
		Tooltip.tooltip.schedule(toolthis, toolevent);	
	}
}
