/*----------------------------------------------------------------------------\
|                               Help Tip 1.12                                 |
|-----------------------------------------------------------------------------|
|                         Created by Erik Arvidsson                           |
|                  (http://webfx.eae.net/contact.html#erik)                   |
|                      For WebFX (http://webfx.eae.net/)                      |
|-----------------------------------------------------------------------------|
|           A tool tip like script that can be used for context help          |
|-----------------------------------------------------------------------------|
|                  Copyright (c) 1999 - 2002 Erik Arvidsson                   |
|-----------------------------------------------------------------------------|
| This software is provided "as is", without warranty of any kind, express or |
| implied, including  but not limited  to the warranties of  merchantability, |
| fitness for a particular purpose and noninfringement. In no event shall the |
| authors or  copyright  holders be  liable for any claim,  damages or  other |
| liability, whether  in an  action of  contract, tort  or otherwise, arising |
| from,  out of  or in  connection with  the software or  the  use  or  other |
| dealings in the software.                                                   |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| This  software is  available under the  three different licenses  mentioned |
| below.  To use this software you must chose, and qualify, for one of those. |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| The WebFX Non-Commercial License          http://webfx.eae.net/license.html |
| Permits  anyone the right to use the  software in a  non-commercial context |
| free of charge.                                                             |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| The WebFX Commercial license           http://webfx.eae.net/commercial.html |
| Permits the  license holder the right to use  the software in a  commercial |
| context. Such license must be specifically obtained, however it's valid for |
| any number of  implementations of the licensed software.                    |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| GPL - The GNU General Public License    http://www.gnu.org/licenses/gpl.txt |
| Permits anyone the right to use and modify the software without limitations |
| as long as proper  credits are given  and the original  and modified source |
| code are included. Requires  that the final product, software derivate from |
| the original  source or any  software  utilizing a GPL  component, such  as |
| this, is also licensed under the GPL license.                               |
|-----------------------------------------------------------------------------|
| 2002-09-27 |                                                                |
| 2001-11-25 | Added a resize to the tooltip if the document width is too     |
|            | small.                                                         |
| 2002-05-19 | IE50 did not recognise the JS keyword undefined so the test    |
|            | for scroll support was updated to be IE50 friendly.            |
| 2002-07-06 | Added flag to hide selects for IE                              |
| 2002-10-04 | (1.1) Restructured and made code more IE garbage collector     |
|            | friendly. This solved the most nasty memory leaks. Also added  |
|            | support for hiding the tooltip if ESC is pressed.              |
| 2002-10-18 | Fixed verrical position in case of scrolled document.          |
| 2002-12-02 | Mozilla bug workaround related to mousedown and move.          |
|-----------------------------------------------------------------------------|
| Dependencies: helptip.css (To set up the CSS of the help-tooltip class)     |
|-----------------------------------------------------------------------------|
| Usage:                                                                      |
|                                                                             |
|   <script type="text/javascript" src="helptip.js">< /script>                |
|   <link type="text/css" rel="StyleSheet" href="helptip.css" />              |
|                                                                             |
|   <a class="helpLink" href="?" onclick="showHelp(event, 'String to show');  |
|      return false">Help</a>                                                 |
|-----------------------------------------------------------------------------|
| Created 2001-09-27 | All changes are in the log above. | Updated 2002-12-02 |
\----------------------------------------------------------------------------*/
var aHelp = "Disk space is used to store files such as your website pages and images. Disk space is also used to store email messages and databases.";
var bHelp = "Data Transfer is the uploading and down loading of information from your domain. It includes web, ftp and email traffic.";
var cHelp = "At ATOMEhosting, you will have your own unique place on the web. With this feature you can select a domain that encompasses you interests or a distinctive home on the web for your business. When ordering you will have the ability to pick you home on the web.";
var dHelp = "Websites allowed signifies the number of different websites that can be served from your account. This allows you to have multiple websites under your account. Please note that this is different than domain aliases. Domain Aliases allows you to point other domains to yours. So if you owned yourdomain.com and yourdomain.net but only wanted one site you could point yourdomain.net to yourdomain.com.";
var eHelp = "All accounts come with unlimited POP3 accounts. POP email is a private secure storage location for your email that has to be accessed through a third party email program such as Eudora or Outlook. Our online tutorial provides detailed instructions on how to setup and use POP email.";
var fHelp = "ATOMEhosting provides spam filtering through the control panel. You can block email based upon email address, email domain or even ip address. By entering in the information all emails sent from these unwanted sources will be blocked.";
var gHelp = "With this feature, you can check your email using your web browser from anywhere around the world where you have access to the Internet.";
var hHelp = "Email Forwarding: All plans include unlimited use of email forwarding. Whith this, messages sent to a certain email address are forwarded to another address. For example, John sends an email to webmaster@yourdomain.com. If you choose, this message is then automatically forwarded to you@yourisp.com. Email Autoresponders: All plans include the unlimited use of email autoresponders. An email autoresponder sends an automated email response to each incoming message that is sent to a specific address. Each email address on your account can have a different autoresponder. For example, John sends an email to sales@yourdomain.com. The autoresponder sends your prewritten message back to John automatically. With this feature, you can improve your company’s image. Your customers know you have received their e-mail.";
var iHelp = "Email Aliases: All plans include unlimited use of email forwarding. With this, messages sent to a specific email address are forwarded to another. For example, John sends an email to webmaster@yourdomain.com. This message is then automatically forwarded to you@yourisp.com or you@yourdomain.com. Catch-all Email Account: A catch-all account collects email that is sent to your domain to accounts that do not exist.";
var jHelp = "Mailing lists simplify sending email to a group of people, i.e. sending a weekly newsletter out to 20 people is simplified to just one address.";
var kHelp = "Most Companies make you pay to talk to them whether it is long distance charges or per incident fees. At ATOMEhosting, we do not believe in making you pay twice for the service that you purchased. We are here 24 hours a day 7 days a week to service your needs with one simple 800 number to call.";
var lHelp = "At ATOMEhosting we are here 24 hours a day 7 days a week. Whether you have a question at 3pm or 3am our staff will be here to assist you.";
var mHelp = "You can contact us easily from 9h to 17h Est Time 7 days per week on MSN Messenger";
var nHelp = "Network Reliability & Performance:100% network uptime - one day credit for each hour of downtime - no packet loss from us to our Tier 1 backbone bandwidth providers - one day credit for each 1% of packet loss - below 3 ms latency from us to our Tier 1 backbone bandwidth providers - one day credit for each additional 3 ms of latency - Server Uptime: 99.99% server Uptime - one day credit for each hour of downtime";
var oHelp = "With our easy to use web site submission tool you can submit your site to 7 major search engines.";
var pHelp = "Our Web Based Control Panel is easy to navigate and simple to use";
var qHelp = "Click Here for a Demo";
var rHelp = "Click Here for more information";
var sHelp = "Click Here for more details";
var tHelp = "SSH (Secure Shell) is a program that enables you to log into your account securely. SSH provides strong authentication and secure communications over unsecured channels. With SSH, you can log onto your home computer, which is considered a remote terminal, and feel safe, because SSH secures the connection as if that terminal was directly attached to our server.";
var uHelp = "Hiring a professional web site designer is very expensive. There is a do-it-yourself alternative of using programs such as Microsoft FrontPage, one of the most popular and easy to use web site design and management tools for average people like us. All Unix web hosting and ecommerce plans support FrontPage2002(and older) extensions, and all Windows2000 web hosting plans support FrontPage2002(and older) extensions free of charge so that you can utilize all the advanced FrontPage functionalities";
var vHelp = "All ATOMEhosting accounts include unlimited subdomains. A subdomain is an extension of your domain that helps you to manage your site. It allows you to have additional, easily memorized hostnames (such as 'products.yourdomain.com') which people can use to access specialized areas of your web site.";
var wHelp = "CGI, SSI, PHP, PERL, PYTHON";
var xHelp = "Custom Error pages allow you to provide a error page when someone requests/goes to a page that has been moved or changed.";
var yHelp = "Digital certificates encrypt data using Secure Sockets Layer (SSL) technology, the industry-standard method for protecting web communications. The SSL security protocol provides data encryption for a TCP/IP connection. Because SSL is built into all major browsers and web servers, simply installing a digital certificate turns on their SSL capabilities.";
var zHelp = "MySQL, the most popular Open Source SQL database, is a very fast, reliable relational database management system. You can use MySQL as the database layer for your dynamically generated web pages. Like most Open Source programs and languages, MySQL has a very practical set of features developed with contribution from many users worldwide. The connectivity, speed, and security make MySQL highly suited for accessing databases on the Internet. MySQL is provided as is, i.e. ATOMEhosting does not provide technical support beyond installation of MySQL database on your account.";
var aaHelp = "Easily protect information or data on your site. You can restrict access to these areas by setting a username and password with our simple web based control panel.";
var bbHelp = "Allow uses to listen to files and watch videos on your site.";
var ccHelp = "Flash allows designers and developers to integrate video, text, audio, and graphics into immersive, rich experiences that deliver superior results for interactive marketing and presentations, e-learning, and application user interfaces. Flash is the world’s most pervasive software platform, used by over one million professionals and reaching more than 97% of Internet-enabled desktops worldwide, as well as a wide range of devices.";
var ddHelp = "A cron job is an automated process which is set up to run automatically at a scheduled time of day, week, month, or hour. Example: run my backup at 7:30 p.m. everyday. To do this, you need to create a cron table, or “crontab,” which is a file of the times and commands you want to run. This file instructs your system to run your cron jobs. You can run unlimited cron jobs a day. In order to have a cron file enabled for your domain, please contact our support department.";
var eeHelp = "Easily provide an area for vistors to upload, download and share information without the use of a password.";
var ffHelp = "Web-based file manager system provides full control to maintain and modify your accounts files and subdirectories. This also includes the ability to upload files.";
var ggHelp = "You have unlimited access to your account, 24 hours a day, 7 days a week, 365 days a year. This allows you to set up, change, or maintain your web site at any time of the day or night.";
var hhHelp = "You are in full control of your site. At no time will we or anyone else place forced advertising, banners or links on your site."
var iiHelp = "Our systems are backed up on a daily and weekly basis. We take great steps to ensure that your site data is secure in case your site needs to be restored. To protect the data even further we ship our weekly backups offsite to further ensure your data is never lost.";
var jjHelp = "Detailed Site Statistics to see who is visiting your site, when and where they are from";
var kkHelp = "A sophisticated montiroing systems keeps a watchful eye on your site 24x7x365. Even the smallest 'hiccup' in the system is reported to our network operations staff to ensure that your site remains up and available on the web.";
var llHelp = "Our OC-48 SONET Rings provide self healing technology so that in the unlikely event of a fiber cut or hardware failure your site will still be accessable and performance will not be degraded.";
var mmHelp = "We operate a high-capacity Liebert UPS system, augmented by a number of smaller per-rack UPSes. Both UPS sytems are able to power all the servers for over 45 minutes in case of a power outage.";
var nnHelp = "Our network was deisgned by Cisco and boasts a high availbility core so that your site is accessable 24 hours a day 7 days a week.";
var ooHelp = "Our data center is monitored and staffed 24 hours a day which provides instant to response to any items which require attention.";
var ppHelp = "By Default all Promo Plans are billed quarterly. Non Promotional plans are availble in monthly and annual billing cycles. As a bonus all annual plans recieve 2 months free.";
var qqHelp = "At ATOMEhosting, we believe in our service so strongly that we offer the first 1 months of hosting for $1. Why $1 you ask? Well we have listened to our customers who have transferred from other hosting companies and heard the hassles that they had to endure to receive the 30 day guarantee refund. The $1 allows you to try our services for 1 months hassle free to see that we in fact deliver what we promise and the $1 fee allows us to verify your identity so we can keep the fraudulent activity on our servers to a minimum.";
var rrHelp = "all setup fees is free for now, we believe in you to stay with us for a while, so why charge a setup fee?";

function showHelpTip(e, sHtml, bHideSelects) {

	// find anchor element
	var el = e.target || e.srcElement;
	while (el.tagName != "A")
		el = el.parentNode;
	
	// is there already a tooltip? If so, remove it
	if (el._helpTip) {
		helpTipHandler.hideHelpTip(el);
	}

	helpTipHandler.hideSelects = Boolean(bHideSelects);

	// create element and insert last into the body
	helpTipHandler.createHelpTip(el, sHtml);
	
	// position tooltip
	helpTipHandler.positionToolTip(e);

	// add a listener to the blur event.
	// When blurred remove tooltip and restore anchor
	el.onblur = helpTipHandler.anchorBlur;
	el.onkeydown = helpTipHandler.anchorKeyDown;
}

var helpTipHandler = {
	hideSelects:	false,
	
	helpTip:		null,
	
	showSelects:	function (bVisible) {
		if (!this.hideSelects) return;
		// only IE actually do something in here
		var selects = [];
		if (document.all)
			selects = document.all.tags("SELECT");
		var l = selects.length;
		for	(var i = 0; i < l; i++)
			selects[i].runtimeStyle.visibility = bVisible ? "" : "hidden";	
	},
	
	create:	function () {
		var d = document.createElement("DIV");
		d.className = "help-tooltip";
		d.onmousedown = this.helpTipMouseDown;
		d.onmouseup = this.helpTipMouseUp;
		document.body.appendChild(d);		
		this.helpTip = d;
	},
	
	createHelpTip:	function (el, sHtml) {
		if (this.helpTip == null) {
			this.create();
		}

		var d = this.helpTip;
		d.innerHTML = sHtml;
		d._boundAnchor = el;
		el._helpTip = d;
		return d;
	},
	
	// Allow clicks on A elements inside tooltip
	helpTipMouseDown:	function (e) {
		var d = this;
		var el = d._boundAnchor;
		if (!e) e = event;
		var t = e.target || e.srcElement;
		while (t.tagName != "A" && t != d)
			t = t.parentNode;
		if (t == d) return;
		
		el._onblur = el.onblur;
		el.onblur = null;
	},
	
	helpTipMouseUp:	function () {
		var d = this;
		var el = d._boundAnchor;
		el.onblur = el._onblur;
		el._onblur = null;
		el.focus();
	},	
	
	anchorBlur:	function (e) {
		var el = this;
		helpTipHandler.hideHelpTip(el);
	},
	
	anchorKeyDown:	function (e) {
		if (!e) e = window.event
		if (e.keyCode == 27) {	// ESC
			helpTipHandler.hideHelpTip(this);
		}
	},
	
	removeHelpTip:	function (d) {
		d._boundAnchor = null;
		d.style.filter = "none";
		d.innerHTML = "";
		d.onmousedown = null;
		d.onmouseup = null;
		d.parentNode.removeChild(d);
		//d.style.display = "none";
	},
	
	hideHelpTip:	function (el) {
		var d = el._helpTip;
		/*	Mozilla (1.2+) starts a selection session when moved
			and this destroys the mouse events until reloaded
		d.style.top = -el.offsetHeight - 100 + "px";
		*/		
		
		d.style.visibility = "hidden";
		//d._boundAnchor = null;

		el.onblur = null;
		el._onblur = null;
		el._helpTip = null;
		el.onkeydown = null;
		
		this.showSelects(true);
	},
	
	positionToolTip:	function (e) {
		this.showSelects(false);		
		var scroll = this.getScroll();
		var d = this.helpTip;
		
		// width
		if (d.offsetWidth >= scroll.width)
			d.style.width = scroll.width - 10 + "px";
		else
			d.style.width = "";
		
		// left
		if (e.clientX > scroll.width - d.offsetWidth)
			d.style.left = scroll.width - d.offsetWidth + scroll.left + "px";
		else
			d.style.left = e.clientX + 20 + scroll.left + "px";
		
		// top
		if (e.clientY + d.offsetHeight + 18 < scroll.height)
			d.style.top = e.clientY + 18 + scroll.top + "px";
		else if (e.clientY - d.offsetHeight > 0)
			d.style.top = e.clientY + scroll.top - d.offsetHeight + "px";
		else
			d.style.top = scroll.top + 5 + "px";
			
		d.style.visibility = "visible";
	},
	
	// returns the scroll left and top for the browser viewport.
	getScroll:	function () {
		if (document.all && typeof document.body.scrollTop != "undefined") {	// IE model
			var ieBox = document.compatMode != "CSS1Compat";
			var cont = ieBox ? document.body : document.documentElement;
			return {
				left:	cont.scrollLeft,
				top:	cont.scrollTop,
				width:	cont.clientWidth,
				height:	cont.clientHeight
			};
		}
		else {
			return {
				left:	window.pageXOffset,
				top:	window.pageYOffset,
				width:	window.innerWidth,
				height:	window.innerHeight
			};
		}
		
	}

};