﻿
/*
*
* TERMS OF USE - EASING EQUATIONS
* 
* Open source under the BSD License. 
* 
* Copyright © 2001 Robert Penner
* All rights reserved.
* 
* Redistribution and use in source and binary forms, with or without modification, 
* are permitted provided that the following conditions are met:
* 
* Redistributions of source code must retain the above copyright notice, this list of 
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list 
* of conditions and the following disclaimer in the documentation and/or other materials 
* provided with the distribution.
* 
* Neither the name of the author nor the names of contributors may be used to endorse 
* or promote products derived from this software without specific prior written permission.
* 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
*  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
*  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
*  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
*  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
* OF THE POSSIBILITY OF SUCH DAMAGE. 
*
*/

/*
* Thickbox 3.1 - One Box To Rule Them All.
* By Cody Lindley (http://www.codylindley.com)
* Copyright (c) 2007 cody lindley
* Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/

var tb_pathToImage = "/Site_Assets/includes/images/loadingAnimation.gif";
jQuery(document).ready(function() { tb_init('a.thickbox, area.thickbox, input.thickbox'); imgLoader = new Image(); imgLoader.src = tb_pathToImage }); function tb_init(b) { jQuery(b).click(function() { var t = this.title || this.name || null; var a = this.href || this.alt; var g = this.rel || false; tb_show(t, a, g); this.blur(); return false }) } function tb_show(d, f, g) { try { if (typeof document.body.style.maxHeight === "undefined") { jQuery("body", "html").css({ height: "100%", width: "100%" }); jQuery("html").css("overflow", "hidden"); if (document.getElementById("TB_HideSelect") === null) { jQuery("form").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>"); jQuery("#TB_overlay").click(tb_remove) } } else { if (document.getElementById("TB_overlay") === null) { jQuery("form").append("<div id='TB_overlay'></div><div id='TB_window'></div>"); jQuery("#TB_overlay").click(tb_remove) } } if (tb_detectMacXFF()) { jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack") } else { jQuery("#TB_overlay").addClass("TB_overlayBG") } if (d === null) { d = "" } jQuery("form").append("<div id='TB_load'><img src='" + imgLoader.src + "' /></div>"); jQuery('#TB_load').show(); var h; if (f.indexOf("?") !== -1) { h = f.substr(0, f.indexOf("?")) } else { h = f } var i = /\.jpgjQuery|\.jpegjQuery|\.pngjQuery|\.gifjQuery|\.bmpjQuery/; var j = h.toLowerCase().match(i); if (j == '.jpg' || j == '.jpeg' || j == '.png' || j == '.gif' || j == '.bmp') { TB_PrevCaption = ""; TB_PrevURL = ""; TB_PrevHTML = ""; TB_NextCaption = ""; TB_NextURL = ""; TB_NextHTML = ""; TB_imageCount = ""; TB_FoundURL = false; if (g) { TB_TempArray = jQuery("a[@rel=" + g + "]").get(); for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) { var k = TB_TempArray[TB_Counter].href.toLowerCase().match(i); if (!(TB_TempArray[TB_Counter].href == f)) { if (TB_FoundURL) { TB_NextCaption = TB_TempArray[TB_Counter].title; TB_NextURL = TB_TempArray[TB_Counter].href; TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>" } else { TB_PrevCaption = TB_TempArray[TB_Counter].title; TB_PrevURL = TB_TempArray[TB_Counter].href; TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>" } } else { TB_FoundURL = true; TB_imageCount = "Image " + (TB_Counter + 1) + " of " + (TB_TempArray.length) } } } imgPreloader = new Image(); imgPreloader.onload = function() { imgPreloader.onload = null; var a = tb_getPageSize(); var x = a[0] - 150; var y = a[1] - 150; var b = imgPreloader.width; var c = imgPreloader.height; if (b > x) { c = c * (x / b); b = x; if (c > y) { b = b * (y / c); c = y } } else if (c > y) { b = b * (y / c); c = y; if (b > x) { c = c * (x / b); b = x } } TB_WIDTH = b; TB_HEIGHT = c; jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='" + f + "' width='" + b + "' height='" + c + "' alt='" + d + "'/></a>" + "<div id='TB_caption'>" + d + "<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div>"); jQuery("#TB_closeWindowButton").click(tb_remove); if (!(TB_PrevHTML === "")) { function goPrev() { if (jQuery(document).unbind("click", goPrev)) { jQuery(document).unbind("click", goPrev) } jQuery("#TB_window").remove(); jQuery("form").append("<div id='TB_window'></div>"); tb_show(TB_PrevCaption, TB_PrevURL, g); return false } jQuery("#TB_prev").click(goPrev) } if (!(TB_NextHTML === "")) { function goNext() { jQuery("#TB_window").remove(); jQuery("form").append("<div id='TB_window'></div>"); tb_show(TB_NextCaption, TB_NextURL, g); return false } jQuery("#TB_next").click(goNext) } document.onkeydown = function(e) { if (e == null) { keycode = event.keyCode } else { keycode = e.which } if (keycode == 27) { tb_remove() } else if (keycode == 190) { if (!(TB_NextHTML == "")) { document.onkeydown = ""; goNext() } } else if (keycode == 188) { if (!(TB_PrevHTML == "")) { document.onkeydown = ""; goPrev() } } }; tb_position(); jQuery("#TB_load").remove(); jQuery("#TB_ImageOff").click(tb_remove); jQuery("#TB_window").css({ display: "block" }) }; imgPreloader.src = f } else { var l = f.replace(/^[^\?]+\??/, ''); var m = tb_parseQuery(l); TB_WIDTH = (m['width'] * 1) || 630; TB_HEIGHT = (m['height'] * 1) || 440; ajaxContentW = TB_WIDTH; ajaxContentH = TB_HEIGHT; if (f.indexOf('TB_iframe') != -1) { urlNoQuery = f.split('TB_'); jQuery("#TB_iframeContent").remove(); if (m['modal'] != "true") { jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>" + d + "</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div></div><iframe frameborder='0' hspace='0' src='" + urlNoQuery[0] + "' id='TB_iframeContent' name='TB_iframeContent" + Math.round(Math.random() * 1000) + "' onload='tb_showIframe()' style='width:" + (ajaxContentW + 29) + "px;height:" + (ajaxContentH + 17) + "px;' > </iframe>") } else { jQuery("#TB_overlay").unbind(); jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='" + urlNoQuery[0] + "' id='TB_iframeContent' name='TB_iframeContent" + Math.round(Math.random() * 1000) + "' onload='tb_showIframe()' style='width:" + (ajaxContentW + 29) + "px;height:" + (ajaxContentH + 17) + "px;'> </iframe>") } } else { if (jQuery("#TB_window").css("display") != "block") { if (m['modal'] != "true") { jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>" + d + "</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a></div></div><div id='TB_ajaxContent' style='width:" + ajaxContentW + "px;height:" + ajaxContentH + "px'></div>") } else { jQuery("#TB_overlay").unbind(); jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:" + ajaxContentW + "px;height:" + ajaxContentH + "px;'></div>") } } else { jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW + "px"; jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH + "px"; jQuery("#TB_ajaxContent")[0].scrollTop = 0; jQuery("#TB_ajaxWindowTitle").html(d) } } jQuery("#TB_closeWindowButton").click(tb_remove); if (f.indexOf('TB_inline') != -1) { jQuery("#TB_ajaxContent").append(jQuery('#' + m['inlineId']).children()); jQuery("#TB_window").unload(function() { jQuery('#' + m['inlineId']).append(jQuery("#TB_ajaxContent").children()) }); tb_position(); jQuery("#TB_load").remove(); jQuery("#TB_window").css({ display: "block" }) } else if (f.indexOf('TB_iframe') != -1) { tb_position(); if (jQuery.browser.safari) { jQuery("#TB_load").remove(); jQuery("#TB_window").css({ display: "block" }) } } else { jQuery("#TB_ajaxContent").load(f += "&random=" + (new Date().getTime()), function() { tb_position(); jQuery("#TB_load").remove(); tb_init("#TB_ajaxContent a.thickbox"); jQuery("#TB_window").css({ display: "block" }) }) } } if (!m['modal']) { document.onkeyup = function(e) { if (e == null) { keycode = event.keyCode } else { keycode = e.which } if (keycode == 27) { tb_remove() } } } } catch (e) { } } function tb_showIframe() { jQuery("#TB_load").remove(); jQuery("#TB_window").css({ display: "block" }) } function tb_remove() { jQuery("#TB_imageOff").unbind("click"); jQuery("#TB_closeWindowButton").unbind("click"); jQuery("#TB_window").fadeOut("fast", function() { jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove() }); jQuery("#TB_load").remove(); if (typeof document.body.style.maxHeight == "undefined") { jQuery("body", "html").css({ height: "auto", width: "auto" }); jQuery("html").css("overflow", "") } document.onkeydown = ""; document.onkeyup = ""; return false } function tb_position() { jQuery("#TB_window").css({ marginLeft: '-' + parseInt((TB_WIDTH / 2), 10) + 'px', width: TB_WIDTH + 'px' }); if (!(jQuery.browser.msie && jQuery.browser.version < 7)) { jQuery("#TB_window").css({ marginTop: '-' + parseInt((TB_HEIGHT / 2), 10) + 'px' }) } } function tb_parseQuery(a) { var b = {}; if (!a) { return b } var c = a.split(/[;&]/); for (var i = 0; i < c.length; i++) { var d = c[i].split('='); if (!d || d.length != 2) { continue } var e = unescape(d[0]); var f = unescape(d[1]); f = f.replace(/\+/g, ' '); b[e] = f } return b } function tb_getPageSize() { var a = document.documentElement; var w = window.innerWidth || self.innerWidth || (a && a.clientWidth) || document.body.clientWidth; var h = window.innerHeight || self.innerHeight || (a && a.clientHeight) || document.body.clientHeight; arrayPageSize = [w, h]; return arrayPageSize } function tb_detectMacXFF() { var a = navigator.userAgent.toLowerCase(); if (a.indexOf('mac') != -1 && a.indexOf('firefox') != -1) { return true } };


/**
* tools.tooltip 1.0.2 - Tooltips done right.
* 
* Copyright (c) 2009 Tero Piirainen
* http://flowplayer.org/tools/tooltip.html
*
* Dual licensed under MIT and GPL 2+ licenses
* http://www.opensource.org/licenses
*
* Launch  : November 2008
* Date: 2009-06-12 11:02:45 +0000 (Fri, 12 Jun 2009)
* Revision: 1911 
*/
(function(c) { c.tools = c.tools || { version: {} }; c.tools.version.tooltip = "1.0.2"; var b = { toggle: [function() { this.getTip().show() }, function() { this.getTip().hide() } ], fade: [function() { this.getTip().fadeIn(this.getConf().fadeInSpeed) }, function() { this.getTip().fadeOut(this.getConf().fadeOutSpeed) } ] }; c.tools.addTipEffect = function(d, f, e) { b[d] = [f, e] }; c.tools.addTipEffect("slideup", function() { var d = this.getConf(); var e = d.slideOffset || 10; this.getTip().css({ opacity: 0 }).animate({ top: "-=" + e, opacity: d.opacity }, d.slideInSpeed || 200).show() }, function() { var d = this.getConf(); var e = d.slideOffset || 10; this.getTip().animate({ top: "-=" + e, opacity: 0 }, d.slideOutSpeed || 200, function() { c(this).hide().animate({ top: "+=" + (e * 2) }, 0) }) }); function a(f, e) { var d = this; var h = f.next(); if (e.tip) { if (e.tip.indexOf("#") != -1) { h = c(e.tip) } else { h = f.nextAll(e.tip).eq(0); if (!h.length) { h = f.parent().nextAll(e.tip).eq(0) } } } function j(k, l) { c(d).bind(k, function(n, m) { if (l && l.call(this) === false && m) { m.proceed = false } }); return d } c.each(e, function(k, l) { if (c.isFunction(l)) { j(k, l) } }); var g = f.is("input, textarea"); f.bind(g ? "focus" : "click", function(k) { k.target = this; d.show(k); h.hover(function() { d.show() }, function() { d.hide() }) }); f.bind(g ? "blur" : "mouseout", function() { d.hide() }); h.css("opacity", e.opacity); var i = 0; c.extend(d, { show: function(q) { if (q) { f = c(q.target) } clearTimeout(i); if (h.is(":animated") || h.is(":visible")) { return d } var o = { proceed: true }; c(d).trigger("onBeforeShow", o); if (!o.proceed) { return d } var n = f.position().top - h.outerHeight(); var k = h.outerHeight() + f.outerHeight(); var r = e.position[0]; if (r == "center") { n += k / 2 } if (r == "bottom") { n += k } var l = f.outerWidth() + h.outerWidth(); var m = f.position().left + f.outerWidth(); r = e.position[1]; if (r == "center") { m -= l / 2 } if (r == "left") { m -= l } n += e.offset[0]; m += e.offset[1]; h.css({ position: "absolute", top: n, left: m }); b[e.effect][0].call(d); c(d).trigger("onShow"); return d }, hide: function() { clearTimeout(i); i = setTimeout(function() { if (!h.is(":visible")) { return d } var k = { proceed: true }; c(d).trigger("onBeforeHide", k); if (!k.proceed) { return d } b[e.effect][1].call(d); c(d).trigger("onHide") }, e.delay || 1); return d }, isShown: function() { return h.is(":visible, :animated") }, getConf: function() { return e }, getTip: function() { return h }, getTrigger: function() { return f }, onBeforeShow: function(k) { return j("onBeforeShow", k) }, onShow: function(k) { return j("onShow", k) }, onBeforeHide: function(k) { return j("onBeforeHide", k) }, onHide: function(k) { return j("onHide", k) } }) } c.prototype.tooltip = function(d) { var e = this.eq(typeof d == "number" ? d : 0).data("tooltip"); if (e) { return e } var f = { tip: null, effect: "slideup", delay: 30, opacity: 1, position: ["top", "center"], offset: [0, 0], api: false }; if (c.isFunction(d)) { d = { onBeforeShow: d} } c.extend(f, d); this.each(function() { e = new a(c(this), f); c(this).data("tooltip", e) }); return f.api ? e : this } })(jQuery);


/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
* Uses the built in easing capabilities added In jQuery 1.1
* to offer multiple easing options
*
* TERMS OF USE - jQuery Easing
* 
* Open source under the BSD License. 
* 
* Copyright © 2008 George McGinley Smith
* All rights reserved.
* 
* Redistribution and use in source and binary forms, with or without modification, 
* are permitted provided that the following conditions are met:
* 
* Redistributions of source code must retain the above copyright notice, this list of 
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list 
* of conditions and the following disclaimer in the documentation and/or other materials 
* provided with the distribution.
* 
* Neither the name of the author nor the names of contributors may be used to endorse 
* or promote products derived from this software without specific prior written permission.
* 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
*  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
*  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
*  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
*  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
* OF THE POSSIBILITY OF SUCH DAMAGE. 
*
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing']; jQuery.extend(jQuery.easing, { def: 'easeOutQuad', swing: function(x, t, b, c, d) { return jQuery.easing[jQuery.easing.def](x, t, b, c, d) }, easeInQuad: function(x, t, b, c, d) { return c * (t /= d) * t + b }, easeOutQuad: function(x, t, b, c, d) { return -c * (t /= d) * (t - 2) + b }, easeInOutQuad: function(x, t, b, c, d) { if ((t /= d / 2) < 1) return c / 2 * t * t + b; return -c / 2 * ((--t) * (t - 2) - 1) + b }, easeInCubic: function(x, t, b, c, d) { return c * (t /= d) * t * t + b }, easeOutCubic: function(x, t, b, c, d) { return c * ((t = t / d - 1) * t * t + 1) + b }, easeInOutCubic: function(x, t, b, c, d) { if ((t /= d / 2) < 1) return c / 2 * t * t * t + b; return c / 2 * ((t -= 2) * t * t + 2) + b }, easeInQuart: function(x, t, b, c, d) { return c * (t /= d) * t * t * t + b }, easeOutQuart: function(x, t, b, c, d) { return -c * ((t = t / d - 1) * t * t * t - 1) + b }, easeInOutQuart: function(x, t, b, c, d) { if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b; return -c / 2 * ((t -= 2) * t * t * t - 2) + b }, easeInQuint: function(x, t, b, c, d) { return c * (t /= d) * t * t * t * t + b }, easeOutQuint: function(x, t, b, c, d) { return c * ((t = t / d - 1) * t * t * t * t + 1) + b }, easeInOutQuint: function(x, t, b, c, d) { if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b; return c / 2 * ((t -= 2) * t * t * t * t + 2) + b }, easeInSine: function(x, t, b, c, d) { return -c * Math.cos(t / d * (Math.PI / 2)) + c + b }, easeOutSine: function(x, t, b, c, d) { return c * Math.sin(t / d * (Math.PI / 2)) + b }, easeInOutSine: function(x, t, b, c, d) { return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b }, easeInExpo: function(x, t, b, c, d) { return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b }, easeOutExpo: function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b }, easeInOutExpo: function(x, t, b, c, d) { if (t == 0) return b; if (t == d) return b + c; if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b; return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b }, easeInCirc: function(x, t, b, c, d) { return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b }, easeOutCirc: function(x, t, b, c, d) { return c * Math.sqrt(1 - (t = t / d - 1) * t) + b }, easeInOutCirc: function(x, t, b, c, d) { if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b; return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b }, easeInElastic: function(x, t, b, c, d) { var s = 1.70158; var p = 0; var a = c; if (t == 0) return b; if ((t /= d) == 1) return b + c; if (!p) p = d * .3; if (a < Math.abs(c)) { a = c; var s = p / 4 } else var s = p / (2 * Math.PI) * Math.asin(c / a); return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b }, easeOutElastic: function(x, t, b, c, d) { var s = 1.70158; var p = 0; var a = c; if (t == 0) return b; if ((t /= d) == 1) return b + c; if (!p) p = d * .3; if (a < Math.abs(c)) { a = c; var s = p / 4 } else var s = p / (2 * Math.PI) * Math.asin(c / a); return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b }, easeInOutElastic: function(x, t, b, c, d) { var s = 1.70158; var p = 0; var a = c; if (t == 0) return b; if ((t /= d / 2) == 2) return b + c; if (!p) p = d * (.3 * 1.5); if (a < Math.abs(c)) { a = c; var s = p / 4 } else var s = p / (2 * Math.PI) * Math.asin(c / a); if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b }, easeInBack: function(x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c * (t /= d) * t * ((s + 1) * t - s) + b }, easeOutBack: function(x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b }, easeInOutBack: function(x, t, b, c, d, s) { if (s == undefined) s = 1.70158; if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b; return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b }, easeInBounce: function(x, t, b, c, d) { return c - jQuery.easing.easeOutBounce(x, d - t, 0, c, d) + b }, easeOutBounce: function(x, t, b, c, d) { if ((t /= d) < (1 / 2.75)) { return c * (7.5625 * t * t) + b } else if (t < (2 / 2.75)) { return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b } else if (t < (2.5 / 2.75)) { return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b } else { return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b } }, easeInOutBounce: function(x, t, b, c, d) { if (t < d / 2) return jQuery.easing.easeInBounce(x, t * 2, 0, c, d) * .5 + b; return jQuery.easing.easeOutBounce(x, t * 2 - d, 0, c, d) * .5 + c * .5 + b } });

/* For Inspiration Gallery*/
/*
* Gallery 0.1a.
* By Mark Boxall (http://www.devotion.com.au)
* Copyright (c) 2008 Devotion]
* Based on http://www.gcmingati.net/wordpress/wp-content/lab/jquery/imagestrip/imageslide-plugin.html
*/
var j = 0;
var ajaxurl = "/site_assets/ajaxgallery.aspx"
jQuery.fn.devGallery = function(settings) {

    function DisplayDetails(galleryID) {
        $.ajax({
            type: "POST",
            dataType: "json",
            url: ajaxurl,
            data: "id=" + galleryID,
            success: function(msg) {
                $("#divProduct").html(msg.product)

                if (msg.color != "") {
                    $("#ctl00_holderBody_colourPanel").css("display", "block")
                    $("#divColour").html(msg.color)
                } else {
                    $("#ctl00_holderBody_colourPanel").css("display", "none")
                }

                if (msg.desc.length > 10) {
                    $("#ctl00_holderBody_otherPanel").css("display", "block")
                    $("#divOther").html(msg.desc)
                } else {
                    $("#ctl00_holderBody_otherPanel").css("display", "none")
                }


                $("#ctl00_holderBody_lnkProduct").attr("href", msg.url)
                $("#ctl00_holderBody_lnkEmail").attr("href", msg.image)
            }
        });
    }

    jQuery("#rightNav").bind('click', function() {
        var activeLI = $("div#devthumbnails ul a#active").parent();
        if (activeLI != null) {
            nextActive = activeLI.next().find("a")
            nextActive.attr('id', "active").parent().parent().find('a').not(nextActive).removeAttr('id');
            jQuery('div.devimageviewer .content').html('<img src="' + nextActive.find('img').attr("src") + '" alt="galleryImage" />');

            //$("#leftNav").show()
            $("#leftNav").css("background", "url(/site_assets/includes/images/left-icn.png) no-repeat left")
            $("#rightNav").show()

            if (nextActive.parent().next("li").html() == null) {
                $("#rightNav").hide()
            }

            DisplayDetails(nextActive.attr("rel"))

        }
    })

    jQuery("#leftNav").bind('click', function() {
        var activeLI = $("div#devthumbnails ul a#active").parent();
        if (activeLI != null) {
            nextActive = activeLI.prev().find("a")


            if (nextActive.attr("rel") == null || nextActive.attr("rel") == "undefined" || nextActive.attr("rel") == "") {

                return false;
            }

            nextActive.attr('id', "active").parent().parent().find('a').not(nextActive).removeAttr('id');
            jQuery('div.devimageviewer .content').html('<img src="' + nextActive.find('img').attr("src") + '" alt="galleryImage" />');

            //$("#leftNav").show()
            $("#leftNav").css("background", "url(/site_assets/includes/images/left-icn.png) no-repeat left")
            $("#rightNav").show()

            if (nextActive.parent().prev("li").html() == null) {
                //$("#leftNav").hide()
                $("#leftNav").css("background", "none")
            }

            DisplayDetails(nextActive.attr("rel"))
        }
    })
    settings = jQuery.extend({ easeFunc: "easeInOutExpo", easeTime: 750, toolTip: false }, settings);
    return this.each(function() {
        //$("#leftNav").hide()

        $("#leftNav").css("background", "none");
        var container = jQuery(this);
        var imageWidth = 680;
        var thumbnails = jQuery('div#devthumbnails');
        var imageCount = thumbnails.find('li').size();
        var viewerWidth = imageWidth * imageCount;
        thumbnails.each(function(i) {

            jQuery('div#devthumbnails a').each(function(z) {
                jQuery(this).bind('click', function() {
                    jQuery(this).attr('id', "active").parent().parent().find('a').not(jQuery(this)).removeAttr('id');
                    var cnt = -(imageWidth * z) + 14;

                    jQuery('div.devimageviewer .content').html('<img src="' + jQuery(this).find('img').attr("src") + '" alt="galleryImage" />');

                    var count = 0
                    $("#devthumbnails ul").find('li').each(function(n) {
                        count++

                        if (jQuery(this).find('a').attr('id') == 'active') {
                            return false;
                        }
                    });

                    //$("#leftNav").show()
                    $("#leftNav").css("background", "url(/site_assets/includes/images/left-icn.png) no-repeat left")
                    $("#rightNav").show()
                    if (count == 1) {
                        //$("#leftNav").hide()
                        $("#leftNav").css("background", "none")
                    } else if (count == imageCount) {
                        $("#rightNav").hide()

                    }

                    DisplayDetails(jQuery(this).attr("rel"))

                    return false
                })
            });
            jQuery('div#devthumbnails').find('a:first').attr("id", 'active')

            jQuery('div.devimageviewer .content').empty()
            var imgSrc = jQuery('div#devthumbnails').find('a:first').find("img").attr("src")
            jQuery('div.devimageviewer .content').append('<img src="' + imgSrc + '" alt="galleryImage" />');
        });
        var currentPosition = 0;
        var thumbnailContainerWidth = jQuery('div#devthumbnails').width();
        var thumbnailWidth = 133; jQuery('div#devthumbnails ul').css('width', imageCount * thumbnailWidth);
        var thumbnailUlWidth = imageCount * thumbnailWidth;

        if (imageCount > 6) {
            thumbnails.before('<a href="" id="devprevious" class="inspr-left-tb"></a>');
            jQuery('#devprevious').hide();

            jQuery('#devprevious').click(function(event) {
                event.preventDefault();
                var newPosition = 0;
                if (currentPosition > 0) {
                    newPosition = -(currentPosition - thumbnailWidth);
                    jQuery('div#devthumbnails ul').animate({ left: newPosition }, settings.easeTime, settings.easeFunc)
                }
                currentPosition -= thumbnailWidth;
                if (currentPosition == 0) {
                    jQuery(this).hide()
                }
                if ((currentPosition + thumbnailContainerWidth) < thumbnailUlWidth) {
                    jQuery('#devnext').show()
                }
            });
            thumbnails.after('<a href="" id="devnext" class="inspr-right-tb"></a>');
            jQuery('#devnext').click(function(event) {
                event.preventDefault();
                var newPosition = 0;
                if (currentPosition < thumbnailUlWidth) {
                    newPosition = -(currentPosition + thumbnailWidth);
                    jQuery('div#devthumbnails ul').animate({ left: newPosition }, settings.easeTime, settings.easeFunc)
                }
                currentPosition += thumbnailWidth;

                if ((currentPosition + thumbnailContainerWidth) >= thumbnailUlWidth) {
                    jQuery(this).hide()
                }
                if (currentPosition < thumbnailUlWidth) {
                    jQuery('#devprevious').show()
                }
            })
        } else if (imageCount == 1) {
            $("#rightNav").hide()
        }
    })


};

/* For Product page gallery*/

jQuery.fn.devSlideGallery = function(settings) {

    function IsLastDisplayed(currentIndex, ulSelection, containerHeight) {

        var index = 0;
        var position = 0
        ulSelection.find("li").each(function(e) {

            if (index <= currentIndex) {
                index++
                position += $(this).height()
            }

        })

        if (ulSelection.height() - position > containerHeight + 10) {
            return false;
        } else {
            return true;
        }

    }


    function GetPosition(currentIndex, ulSelection) {

        var index = 0;
        var position = 0
        ulSelection.find("li").each(function(e) {

            if (index <= currentIndex) {
                index++
                position += $(this).height() + 20;
            }

        })

        return -(position);
    }

    settings = jQuery.extend({ easeFunc: "easeInOutExpo", easeTime: 750, toolTip: false }, settings);
    var currentPosition = 0;
    var currentIndex = -1;
    var galPanel = jQuery(this);
    var ulSelections = galPanel.find("ul");
    var liCount = ulSelections.find('li').size();

    return this.each(function() {
        $("#devprevious").hide()
        $('#devnext').hide()
        var container = jQuery(this);
        var thumbnails = jQuery('div#verticalGallery');
        var imageCount = thumbnails.find('li').size();
        thumbnails.each(function(i) {

            jQuery('div#verticalGallery a').each(function(z) {

                jQuery(this).bind('click', function() {
                    jQuery(this).attr('id', "active").parent().parent().find('a').not(jQuery(this)).removeAttr('id');

                    $('#ctl00_holderBody_imgProduct').attr("src", jQuery(this).find("img").attr("src"))
                    return false
                })
            });
            jQuery('div#verticalGallery').find('a:first').attr("id", 'active')

            var imgSrc = jQuery('div#verticalGallery').find('a:first').find("img").attr("src")

        });
        var currentPosition = 0;
        var thumbnailContainerHeight = jQuery('div#verticalGallery').height();
        var thumbnailHeight = 79;
        jQuery('div#verticalGallery ul').css('height', imageCount * thumbnailHeight);
        var thumbnailUlHeight = imageCount * thumbnailHeight;

        if (imageCount > 2) {

            jQuery('#devprevious').hide();
            jQuery('#devnext').show();
            jQuery('#devprevious').click(function(event) {
                event.preventDefault();
                var newPosition = 0;
                /*if (currentPosition > 0) {
                newPosition = -(currentPosition - thumbnailHeight);
                jQuery('div#verticalGallery ul').animate({ top: newPosition }, settings.easeTime, settings.easeFunc)
                currentPosition -= thumbnailHeight;
                }
                
                if (currentPosition == 0) {
                jQuery(this).hide()
                }
                if ((currentPosition + thumbnailContainerHeight) < thumbnailUlHeight) {
                jQuery('#devnext').show()
                }*/
                if (currentIndex >= 0) {
                    currentIndex--;
                    newPosition = GetPosition(currentIndex, ulSelections);
                    ulSelections.animate({ top: newPosition }, settings.easeTime, settings.easeFunc)
                    //currentPosition -= movement;
                    jQuery('#devnext').show()
                    
                    if (currentIndex < 0) {
                        jQuery(this).hide()
                    }
                }

            });

            jQuery('#devnext').click(function(event) {

                event.preventDefault();
                var newPosition = 0;
                /*if (currentPosition < thumbnailUlHeight) {

                    newPosition = -(currentPosition + thumbnailHeight);

                    jQuery('div#verticalGallery ul').animate({ top: newPosition }, settings.easeTime, settings.easeFunc)
                currentPosition += thumbnailHeight;

                }
                
                if ((currentPosition + thumbnailContainerHeight) >= thumbnailUlHeight) {
                jQuery(this).hide()
                }
                if (currentPosition < thumbnailUlHeight) {
                jQuery('#devprevious').show()
                }*/
                if (currentIndex < liCount - 3) {

                    //if (!IsLastDisplayed(currentIndex, ulSelections, galPanel.height())) {
                    currentIndex++
                    newPosition = GetPosition(currentIndex, ulSelections);
                    ulSelections.animate({ top: newPosition }, settings.easeTime, settings.easeFunc)
                    jQuery('#devprevious').show()
                    //}
                    
                    if (currentIndex >= liCount - 3)
                    {
                        jQuery(this).hide();
                    }
                }



            })
        }
        //jQuery('div#devthumbnails').addClass('show');
    })
};

/* For Newsletter Subscription*/

var subscribeDefault = 'Insert your email address'

$(function() {
    $('#aSubscribe').click(function(event) {
        var email = $('#ctl00_footer_txtEmail').val();
        if (subscribeDefault == email) {
            return;
        } else {

            $.ajax({
                type: "POST",
                url: "/Site_Assets/ajaxSubscribe.aspx",
                data: "email=" + email,
                success: function(msg) {
                    $("#ctl00_footer_txtEmail").val(subscribeDefault)
                }
            });

        }
    })

    if ($('#aSubscribe').length) {
        jQuery('#aSubscribe').tooltip(
                { position: ['top', 'center'], offset: [5, 10], delay: 60000 }).click(function(_e) {
                    var email = $('#ctl00_footer_txtEmail').val();

                    if (subscribeDefault == email) {
                        $('.tooltip').css("display", "none")
                    }
                });
    }
})


/* For Colour Popup image*/

//Copyright 2006,2007 Bontrager Connection, LLC
// http://bontragerconnection.com/ and http://willmaster.com/
// Version: July 28, 2007
var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e) {
    cX = e.pageX; cY = e.pageY;
}

function UpdateCursorPositionDocAll(e) {
    cX = event.clientX; cY = event.clientY;
}

if (document.all) {
    document.onmousemove = UpdateCursorPositionDocAll; 
}
else {
    document.onmousemove = UpdateCursorPosition;
}
/*
function AssignPosition(d) {
    if (self.pageYOffset) {
        rX = self.pageXOffset;
        rY = self.pageYOffset;
    }
    else if (document.documentElement && document.documentElement.scrollTop) {
        rX = document.documentElement.scrollLeft;
        rY = document.documentElement.scrollTop;
    }
    else if (document.body) {
        rX = document.body.scrollLeft;
        rY = document.body.scrollTop;
    }
    if (document.all) {
        cX += rX;
        cY += rY;
    }
    d.style.left = (cX + 10) + "px";
    d.style.top = (cY + 10) + "px";
}
*/
function AssignPosition(d, mode) {
    if (self.pageYOffset) {
        rX = self.pageXOffset;
        rY = self.pageYOffset;
    }
    else if (document.documentElement && document.documentElement.scrollTop) {
        rX = document.documentElement.scrollLeft;
        rY = document.documentElement.scrollTop;
    }
    else if (document.body) {
        rX = document.body.scrollLeft;
        rY = document.body.scrollTop;
    }
    if (document.all) {
        cX += rX;
        cY += rY;
    }

    if (mode == 0) {
        d.style.left = "0px";
        d.style.top = "0px";
    } else {
        d.style.left = (cX + 10) + "px";
        d.style.top = (cY + 10) + "px";
    }
}

function HideContent(d) {
    if (d.length < 1) { return; }
        document.getElementById(d).style.display = "none";
}
function ShowContent(d, mode) {
    if (d.length < 1) { return; }
    var dd = document.getElementById(d);
    AssignPosition(dd, mode);
    dd.style.display = "block";
}

function ReverseContentDisplay(d, mode) {
    if (d.length < 1) { return; }
    var dd = document.getElementById(d);
    AssignPosition(dd, mode);
    if (dd.style.display == "none") { dd.style.display = "block"; }
    else {
        dd.style.display = "none";
    }
}

/* For Create A Tank Accessories Selection*/

jQuery.fn.devAccSlide = function(settings) {

function IsLastDisplayed(currentIndex, ulSelection, containerHeight ) {

        var index = 0;
        var position = 0
        ulSelection.find("li").each(function(e) {

            if (index <= currentIndex) {
                index++
                position += $(this).height()
            }

        })

        if (ulSelection.height() - position > containerHeight + 10) {
            return false;
        } else {
            return true;
        }

    }


    function GetPosition(currentIndex, ulSelection) {

        var index = 0;
        var position = 0
        ulSelection.find("li").each(function(e) {

            if (index <= currentIndex) {
                index++
                position += $(this).height()
            }

        })

        return -(position);
    }
    var movement = 100;
    var currentPosition = 0;
    var currentIndex = -1;
    settings = jQuery.extend({ easeFunc: "easeInOutExpo", easeTime: 750, toolTip: false }, settings);
    return this.each(function() {

        var container = jQuery(this);
        var accPanel = jQuery(this).find("div.acc-panel");
        var ulSelections = accPanel.find("ul");
        var liCount = ulSelections.find('li').size();


        /* up arrow scroll event*/
        container.find("a.up_arrow").click(function(event) {

            event.preventDefault();
            var newPosition = 0;

            if (currentIndex >= 0) {
                currentIndex--;
                newPosition = GetPosition(currentIndex, ulSelections);
                ulSelections.animate({ top: newPosition }, settings.easeTime, settings.easeFunc)
                currentPosition -= movement;

            }
        });

        /* down arrow scroll event*/
        container.find("a.dwn_arrow").click(function(event) {

            event.preventDefault();
            var newPosition = 0;

            if (currentIndex < liCount - 2) {

                if (!IsLastDisplayed(currentIndex, ulSelections, accPanel.height())) {
                    currentIndex++
                    newPosition = GetPosition(currentIndex, ulSelections);
                    ulSelections.animate({ top: newPosition }, settings.easeTime, settings.easeFunc)
                }
            }
        });

        container.find("ul li a").click(function(event) {
            var ulObj = $(this).parent().parent().parent()
            var hidName = ulObj.attr("rel")

            if ($(this).find("img").hasClass("active")) {

                $(this).find("img").removeClass("active")
            } else {
                if (hidName.indexOf("Acc") > 0) {
                    $(this).find("img").addClass("active")
                } else {
               
                    $(this).find("img").addClass("active").parent().parent().parent().parent().find("img").not($(this).find("img")).removeClass("active")
                }

            }

            var ids = "";

            ulObj.find("img").each(function(e) {

                if ($(this).hasClass("active")) {

                    if (ids == "") {
                        ids = $(this).attr("rel")
                    } else {
                        ids += "," + $(this).attr("rel")
                    }
                }

            })

            $("#" + hidName).val(ids)
        })
    })
};


/* For Create A Tank Colour Selection*/

jQuery.fn.devColourSelect = function(settings) {
    return this.each(function() {
        var hidName = $(this).attr("rel")

        $(this).find("a").click(function(event) {
            var mainDiv = $(this).parent().parent().parent()

            if (mainDiv.attr("id") == "colourPanel") {
            
                $("#paintedPanel").find("img").each(function(e) {

                    $(this).removeClass("active")

                })

            } else {
                $("#colourPanel").find("img").each(function(e) {

                    $(this).removeClass("active")

                })
            }
            
            if ($(this).find("img").hasClass("active")) {
                $(this).find("img").removeClass("active")
            } else {

                $(this).find("img").addClass("active").parent().parent().parent().parent().find("img").not($(this).find("img")).removeClass("active")

            }

            


            var ids = "";

            if ($(this).find("img").hasClass("active")) {

                ids = $(this).attr("rel")
            }

            $("#" + hidName).val(ids)
        })
    })
}

//Tank Selection
/*
jQuery.fn.devProductSelect = function(settings) {

    return this.each(function() {
    var hidName = $(this).attr("rel")

    $(this).find("div.step-01").click(function(event) {


        $(this).addClass("active").parent().parent().find("div.step-01").not($(this)).removeClass("active")

        $("#" + hidName).val($(this).attr("rel"))
    })
    })
}
*/

