﻿(function ($) { $.fn.hoverIntent = function (f, g) { var cfg = { sensitivity: 5, interval: 50, timeout: 0 }; cfg = $.extend(cfg, g ? { over: f, out: g} : f); var cX, cY, pX, pY; var track = function (ev) { cX = ev.pageX; cY = ev.pageY; }; var compare = function (ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); if ((Math.abs(pX - cX) + Math.abs(pY - cY)) < cfg.sensitivity) { $(ob).unbind("mousemove", track); ob.hoverIntent_s = 1; return cfg.over.apply(ob, [ev]); } else { pX = cX; pY = cY; ob.hoverIntent_t = setTimeout(function () { compare(ev, ob); }, cfg.interval); } }; var delay = function (ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); ob.hoverIntent_s = 0; return cfg.out.apply(ob, [ev]); }; var handleHover = function (e) { var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget; while (p && p != this) { try { p = p.parentNode; } catch (e) { p = this; } } if (p == this) { return false; } var ev = jQuery.extend({}, e); var ob = this; if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); } if (e.type == "mouseover") { pX = ev.pageX; pY = ev.pageY; $(ob).bind("mousemove", track); if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout(function () { compare(ev, ob); }, cfg.interval); } } else { $(ob).unbind("mousemove", track); if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout(function () { delay(ev, ob); }, cfg.timeout); } } }; return this.mouseover(handleHover).mouseout(handleHover); }; })(jQuery);
(function (a) { var f = "blockUI.timeout", l = "borderLeftWidth", k = "borderTopWidth", g = "blockUI.history", j = "10px", n = "#000", b = true, d = null, i = "position", c = false; if (/1\.(0|1|2)\.(0|1|2)/.test(a.fn.jquery) || /^1.1/.test(a.fn.jquery)) { alert("blockUI requires jQuery v1.2.3 or later!  You are using v" + a.fn.jquery); return } a.fn._fadeIn = a.fn.fadeIn; var q = function () { }, p = document.documentMode || 0, x = a.browser.msie && (a.browser.version < 8 && !p || p < 8), w = a.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !p; a.blockUI = function (a) { s(window, a) }; a.unblockUI = function (a) { o(window, a) }; a.growlUI = function (f, e, b, g) { var d = a('<div class="growlUI"></div>'); f && d.append("<h1>" + f + "</h1>"); e && d.append("<h2>" + e + "</h2>"); if (b == undefined) b = 3e3; a.blockUI({ message: d, fadeIn: 700, fadeOut: 1e3, centerY: c, timeout: b, showOverlay: c, onUnblock: g, css: a.blockUI.defaults.growlCSS }) }; a.fn.block = function (b) { return this.unblock({ fadeOut: 0 }).each(function () { var c = this; if (a.css(c, i) == "static") c.style.position = "relative"; if (a.browser.msie) c.style.zoom = 1; s(c, b) }) }; a.fn.unblock = function (a) { return this.each(function () { o(this, a) }) }; a.blockUI.version = 2.31; a.blockUI.defaults = { message: "<h1>Please wait...</h1>", title: d, draggable: b, theme: c, css: { padding: 0, margin: 0, width: "30%", top: "40%", left: "35%", textAlign: "center", color: n, border: "3px solid #aaa", backgroundColor: "#fff", cursor: "wait" }, themedCSS: { width: "30%", top: "40%", left: "35%" }, overlayCSS: { backgroundColor: n, opacity: .6, cursor: "wait" }, growlCSS: { width: "350px", top: j, left: "", right: j, border: "none", padding: "5px", opacity: .6, cursor: "default", color: "#fff", backgroundColor: n, "-webkit-border-radius": j, "-moz-border-radius": j }, iframeSrc: /^https/i.test(window.location.href || "") ? "javascript:false" : "about:blank", forceIframe: c, baseZ: 1e3, centerX: b, centerY: b, allowBodyStretch: b, bindEvents: b, constrainTabKey: b, fadeIn: 200, fadeOut: 400, timeout: 0, showOverlay: b, focusInput: b, applyPlatformOpacityRules: b, onBlock: d, onUnblock: d, quirksmodeOffsetHack: 4 }; var h = d, e = []; function s(p, b) { var r = "height", z = "absolute", j = p == window, c = b && b.message !== undefined ? b.message : undefined; b = a.extend({}, a.blockUI.defaults, b || {}); b.overlayCSS = a.extend({}, a.blockUI.defaults.overlayCSS, b.overlayCSS || {}); var O = a.extend({}, a.blockUI.defaults.css, b.css || {}), I = a.extend({}, a.blockUI.defaults.themedCSS, b.themedCSS || {}); c = c === undefined ? b.message : c; j && h && o(window, { fadeOut: 0 }); if (c && typeof c != "string" && (c.parentNode || c.jquery)) { var A = c.jquery ? c[0] : c, s = {}; a(p).data(g, s); s.el = A; s.parent = A.parentNode; s.display = A.style.display; s.position = A.style.position; s.parent && s.parent.removeChild(A) } var B = b.baseZ, C = a.browser.msie || b.forceIframe ? a('<iframe class="blockUI" style="z-index:' + B++ + ';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="' + b.iframeSrc + '"></iframe>') : a('<div class="blockUI" style="display:none"></div>'), u = a('<div class="blockUI blockOverlay" style="z-index:' + B++ + ';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'), n; if (b.theme && j) { var Q = '<div class="blockUI blockMsg blockPage ui-dialog ui-widget ui-corner-all" style="z-index:' + B + ';display:none;position:fixed"><div class="ui-widget-header ui-dialog-titlebar blockTitle">' + (b.title || "&nbsp;") + '</div><div class="ui-widget-content ui-dialog-content"></div></div>'; n = a(Q) } else n = j ? a('<div class="blockUI blockMsg blockPage" style="z-index:' + B + ';display:none;position:fixed"></div>') : a('<div class="blockUI blockMsg blockElement" style="z-index:' + B + ';display:none;position:absolute"></div>'); if (c) if (b.theme) { n.css(I); n.addClass("ui-widget-content") } else n.css(O); (!b.applyPlatformOpacityRules || !(a.browser.mozilla && /Linux/.test(navigator.platform))) && u.css(b.overlayCSS); u.css(i, j ? "fixed" : z); (a.browser.msie || b.forceIframe) && C.css("opacity", 0); var J = [C, u, n], K = j ? a("body") : a(p); a.each(J, function () { this.appendTo(K) }); b.theme && b.draggable && a.fn.draggable && n.draggable({ handle: ".ui-dialog-titlebar", cancel: "li" }); var L = x && (!a.boxModel || a("object,embed", j ? d : p).length > 0); if (w || L) { j && b.allowBodyStretch && a.boxModel && a("html,body").css(r, "100%"); if ((w || !a.boxModel) && !j) var H = m(p, k), G = m(p, l), E = H ? "(0 - " + H + ")" : 0, D = G ? "(0 - " + G + ")" : 0; a.each([C, u, n], function (f, g) { var c = ') + "px"', a = g[0].style; a.position = z; if (f < 2) { j ? a.setExpression(r, "Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:" + b.quirksmodeOffsetHack + c) : a.setExpression(r, 'this.parentNode.offsetHeight + "px"'); j ? a.setExpression("width", 'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"') : a.setExpression("width", 'this.parentNode.offsetWidth + "px"'); D && a.setExpression("left", D); E && a.setExpression("top", E) } else if (b.centerY) { j && a.setExpression("top", '(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); a.marginTop = 0 } else if (!b.centerY && j) { var e = b.css && b.css.top ? parseInt(b.css.top) : 0, d = "((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + " + e + c; a.setExpression("top", d) } }) } if (c) { if (b.theme) n.find(".ui-widget-content").append(c); else n.append(c); (c.jquery || c.nodeType) && a(c).show() } (a.browser.msie || b.forceIframe) && b.showOverlay && C.show(); if (b.fadeIn) { var F = b.onBlock ? b.onBlock : q, M = b.showOverlay && !c ? F : q, N = c ? F : q; b.showOverlay && u._fadeIn(b.fadeIn, M); c && n._fadeIn(b.fadeIn, N) } else { b.showOverlay && u.show(); c && n.show(); b.onBlock && b.onBlock() } v(1, p, b); if (j) { h = n[0]; e = a(":input:enabled:visible", h); b.focusInput && setTimeout(t, 20) } else y(n[0], b.centerX, b.centerY); if (b.timeout) { var P = setTimeout(function () { j ? a.unblockUI(b) : a(p).unblock(b) }, b.timeout); a(p).data(f, P) } } function o(c, b) { var j = ".blockUI", m = c == window, k = a(c), l = k.data(g), n = k.data(f); if (n) { clearTimeout(n); k.removeData(f) } b = a.extend({}, a.blockUI.defaults, b || {}); v(0, c, b); var i; if (m) i = a("body").children().filter(j).add("body > .blockUI"); else i = a(j, c); if (m) h = e = d; if (b.fadeOut) { i.fadeOut(b.fadeOut); setTimeout(function () { u(i, l, b, c) }, b.fadeOut) } else u(i, l, b, c) } function u(e, b, c, d) { e.each(function () { this.parentNode && this.parentNode.removeChild(this) }); if (b && b.el) { b.el.style.display = b.display; b.el.style.position = b.position; b.parent && b.parent.appendChild(b.el); a(d).removeData(g) } if (typeof c.onUnblock == "function") c.onUnblock(d, c) } function v(c, i, e) { var b = "blockUI.isBlocked", d = i == window, g = a(i); if (!c && (d && !h || !d && !g.data(b))) return; !d && g.data(b, c); if (!e.bindEvents || c && !e.showOverlay) return; var f = "mousedown mouseup keydown keypress"; c ? a(document).bind(f, e, r) : a(document).unbind(f, r) } function r(d) { if (d.keyCode && d.keyCode == 9) if (h && d.data.constrainTabKey) { var f = e, i = !d.shiftKey && d.target == f[f.length - 1], g = d.shiftKey && d.target == f[0]; if (i || g) { setTimeout(function () { t(g) }, 10); return c } } return a(d.target).parents("div.blockMsg").length > 0 ? b : a(d.target).parents().children().filter("div.blockUI").length == 0 } function t(c) { if (!e) return; var a = e[c === b ? e.length - 1 : 0]; a && a.focus() } function y(a, f, g) { var b = a.parentNode, d = a.style, c = (b.offsetWidth - a.offsetWidth) / 2 - m(b, l), e = (b.offsetHeight - a.offsetHeight) / 2 - m(b, k); if (f) d.left = c > 0 ? c + "px" : "0"; if (g) d.top = e > 0 ? e + "px" : "0" } function m(b, c) { return parseInt(a.css(b, c)) || 0 } })(jQuery)  

$(document).ready(function () {
	// Document ready
    
	// Prepare the drop-down "PRODUCTS" menu
	// (Other menu effect options are commented out)
	$("td#products-title").hoverIntent({
		over: function () {
			$("div#products-dropdown").slideDown("fast");
		},
		sensitivity: 1,
		out: function () {
			$("div#products-dropdown").slideUp("fast");
		}
	});

    $("td#supportdrop-title").hoverIntent({
		over: function () {
			$("div#support-dropdown").slideDown("fast");
		},
		sensitivity: 1,
		out: function () {
			$("div#support-dropdown").slideUp("fast");
		}
	});

	var highlight = function (element) {
		$(element).css("border", "4px solid #663366");
	};

	var unhighlight = function (element) {
		$(element).css("border", "1px solid #adadaf");
	};

	// On the LiveAddress product page, we may need to scroll
	// the user down to the price list if they click certain links.
	$("a.api_trial_link").click(function () {
		var element = "#api_price_list";
		var scrollTo = $("#api_price_list").offset().top - 200;
		highlight(element);
		$("html, body").animate({ scrollTop: scrollTo }, 1000, function () { unhighlight(element); });
	});

	// Product Pages: Scroll to top of page when links with an href of '#top' are clicked. 
	//  also, highlight and focos on the address quantity box.
	$("a[href='#scroll_to_top']").click(function () {
		var element = 'input[id$="quantityText"]';
		highlight(element);
		$("html, body").animate({ scrollTop: 0 }, 1000, function () { unhighlight(element); });
		$(element).focus();
		return false;
	});

	// Product Pages: Scroll to bottom of page when links with an href of #bottom are clicked.
	$("a[href='#scroll_to_bottom']").click(function () {
		$("html, body").animate({ scrollTop: $(document).height() }, 1000);
		return false;
	});


	// Product Demo Video Stuff:
	$.fn.center = function () {
		this.css("position", "absolute");
		this.css("top", ($(window).height() - this.height()) / 2 + $(window).scrollTop() + "px");
		this.css("left", ($(window).width() - this.width()) / 2 + $(window).scrollLeft() + "px");
		return this;
	}

	$(".video-link").click(function () {
		$.blockUI({
			message: $("#product-demo-video"),
			css: { border: 'none' }
		});
		$('.blockUI.blockMsg').center();
		$('.blockOverlay').click($.unblockUI);
		return false;
	});

	$("#hide-parent").click(function () {
		$(this).parent().hide("fast");
		return false;
	});

    // API Price comparison table stuff:
    $("table.comp td").hover(function() {
        $(this).find("a").toggleClass("hover");
    });
});

// Preload the rollover image on the navigation bar for quick performance
img = new Image();
img.src = "/App_Themes/Normal/images/navbar_bg_2.png";

