/** 
 * This is the copy for all of the tooltips. 
 */
var bizTips = {
    "broadband" : "High-speed internet as fast as your line can go.",
    "annex M" : "Send files faster.",
    "naked DSL" : "An all-in-one internet &amp; phone solution.",
    "VPN access" : "Secure, reliable data sharing between your offices.",
    "SHDSL" : "Fast uploads &amp; downloads, ideal for heavy duty data transfer.",
    "fibre" : "Super-fast &amp; reliable internet - just for you.",
    "phone" : "More download quota for your internet when you bundle with phone.",
    "VOIP" : "Save money on phone calls.",
    "multiline VOIP" : "Control your phone bills, even with more than one line.",
    "SIP trunking" : "Pay only for the phone lines you use.",
    "ISDN" : "Fast, reliable internet when you can't get broadband.",
    "computer support" : "Complimentary computer support &amp; troubleshooting.",
    "domains" : "www.yourname.com",
    "website hosting" : "Reliable hosting for your website."
};

/**
 * This is a map of what copy to associate with what id's 
 */
var bizTipsMap = {
    "small" : [
        "broadband", "annex M", "naked DSL", "VPN access", "SHDSL",
        "fibre", "phone", "VOIP", "multiline VOIP", "SIP trunking",
        "ISDN", "computer support", "domains", "website hosting"
    ],
    "medium" : [
        "broadband", "annex M", "naked DSL", "VPN access", "SHDSL",
        "fibre", "phone", "VOIP", "multiline VOIP", "SIP trunking",
        "ISDN", "computer support", "domains", "website hosting"
    ],
    "large" : [
        "broadband", "annex M", "naked DSL", "VPN access", "SHDSL",
        "fibre", "phone", "VOIP", "multiline VOIP", "SIP trunking",
        "ISDN", "computer support", "domains", "website hosting"
    ],

    /** 
     * Elements should be in the form: tips_[group]_[id], 
     * eg. tips_small_annexm
     */
    "ids" : {
        "broadband" : "broadband",
        "annex M" : "annexm",
        "naked DSL" : "naked",
        "VPN access" : "vpn",
        "SHDSL" : "shdsl",
        "fibre" : "fibre",
        "phone" : "phone",
        "VOIP" : "voip",
        "multiline VOIP" : "multiline" ,
        "SIP trunking" : "sip",
        "ISDN" : "isdn", 
        "computer support" : "support",
        "domains" : "domains",
        "website hosting" : "hosting"
    },

    /** Urls to load via tabbing. */
    "urls" : {
        "broadband" : "/bizSelector/inc/broadband.html",
        "annex M" : "/bizSelector/inc/annex-m.html",
        "naked DSL" : "/bizSelector/inc/naked-dsl.html",
        "VPN access" : "/bizSelector/inc/vpn-services.html",
        "SHDSL" : "/bizSelector/inc/shdsl-services.html",
        "fibre" : "/bizSelector/inc/fibre-connections.html",
        "phone" : "/bizSelector/inc/phone-services.html",
        "VOIP" : "/bizSelector/inc/voip-services.html",
        "multiline VOIP" : "/bizSelector/inc/multi-line-voip.html",
        "SIP trunking" : "/bizSelector/inc/sip-trunking.html",
        "ISDN" : "/bizSelector/inc/isdn.html",
        "computer support" : "/bizSelector/inc/computer-support.html",
        "domains" : "/bizSelector/inc/domains.html",
        "website hosting" : "/bizSelector/inc/web-hosting-services.html"
    }
};

/** Binds the tooltips. */
if (!iiWidgetsReady) { var iiWidgetsReady = {}; }
iiWidgetsReady.Tooltips = function() {
    var api = iiWidgets.Tooltips();
    api.setActiveStyle("biz-product-tip");
    api.setTimeout(500);
    var set = ["small", "medium", "large"];
    for (var i in set) {
        var group = bizTipsMap[set[i]];
        for (var j in group) {
            var name = group[j];
            var id = "tips_"+set[i]+"_"+bizTipsMap.ids[name];
            var value = bizTips[name];
            var inner = "<h5 class='biz-product-tip-header'>"+name+"</h5><div class='tip-detail'>" + value + "</div>";
            api.bind(id, inner);

            /** Tabbing. */
            if (bizTipsMap.urls[name])
				bizTabbing("#"+id, bizTipsMap.urls[name]);

			/** Autoload */
			if (bizTipsMap.urls[name]) {
				id = bizTipsMap.ids[name];
				var url = bizTipsMap.urls[name];
				bizAutoload(id, url);
			}
		}
    }

	// Bind the special small, medium, large.
	bizAutoload("small", "/bizSelector/inc/small.html");
	bizAutoload("medium", "/bizSelector/inc/medium.html");
	bizAutoload("large", "/bizSelector/inc/large.html");

	// Auto open the correct tab, if required.
	try {
		var set = window.location.toString();
		set = set.split("?");
		if (set.length > 1) {
			var h = set[1];
			h = h.replace("#", "");
			bizAutoloadCheck(h);
		}
	}
	catch(error) {
	}
};
