PageSourceSearch

https://mpt.gov.my/sites/default/files/advagg_js/js__PwtzGAEpjOy4f…oJz15kRCXhC5dMLPhjMFmrU1jMEBd-3medT9f8Uw.js

js mpt.gov.my collected 2026-09-25 01:30:33 UTC 82,722 bytes, 1,926 lines download raw bytes

1/**
2 * @file
3 * JavaScript integrations between the Caption Filter module and particular
4 * WYSIWYG editors. This file also implements Insert module hooks to respond
5 * to the insertion of content into a WYSIWYG or textarea.
6 */
7(function ($) {
8
9$(document).bind('insertIntoActiveEditor', function(event, options) {
10  if (options['fields']['title'] && Drupal.settings.captionFilter.widgets[options['widgetType']]) {
11    options['content'] = '[caption caption="' + options['fields']['title'].replace(/"/g, '\\"') + '"]' + options['content'] + '[/caption]';
12  }
13});
14
15Drupal.captionFilter = Drupal.captionFilter || {};
16
17Drupal.captionFilter.toHTML = function(co, editor) {
18  return co.replace(/(?:<p>)?\[caption([^\]]*)\]([\s\S]+?)\[\/caption\](?:<\/p>)?[\s\u00a0]*/g, function(a,b,c){
19    var id, cls, w, tempClass;
20
21    b = b.replace(/\\?'|\\&#39;|\\&#039;/g, '&#39;').replace(/\\"|\\&quot;/g, '&quot;');
22    c = c.replace(/\\&#39;|\\&#039;/g, '&#39;').replace(/\\&quot;/g, '&quot;');
23    id = b.match(/id=['"]([^'"]+)/i);
24    cls = b.match(/align=['"]([^'"]+)/i);
25    ct = b.match(/caption=['"]([^'"]+)/i);
26    w = c.match(/width=['"]([0-9]+)/);
27
28    id = ( id && id[1] ) ? id[1] : '';
29    cls = ( cls && cls[1] ) ? 'caption-' + cls[1] : '';
30    ct = ( ct && ct[1] ) ? ct[1].replace(/\\\\"/,'"') : '';
31    w = ( w && w[1] ) ? parseInt(w[1])+'px' : 'auto';
32
33    if (editor == 'tinymce')
34      tempClass = (cls == 'caption-center') ? 'mceTemp mceIEcenter' : 'mceTemp';
35    else if (editor == 'ckeditor')
36      tempClass = (cls == 'caption-center') ? 'mceTemp mceIEcenter' : 'mceTemp';
37    else
38      tempClass = '';
39
40    if (ct) {
41      return '<div class="caption ' + cls + ' ' + tempClass + ' draggable"><div class="caption-width-container" style="width: ' + w + '"><div class="caption-inner">' + c + '<p class="caption-text">' + ct + '</p></div></div></div><br />';
42    }
43    else {
44      return '<div class="caption ' + cls + ' ' + tempClass + ' draggable"><div class="caption-width-container" style="width: ' + w + '"><div class="caption-inner">' + c + '</div></div></div><br />';
45    }
46  });
47};
48
49Drupal.captionFilter.toTag = function(co) {
50  return co.replace(/(<div class="caption [^"]*">)\s*<div[^>]+>\s*<div[^>]+>(.+?)<\/div>\s*<\/div>\s*<\/div>\s*/gi, function(match, captionWrapper, contents) {
51    var align;
52    align = captionWrapper.match(/class=.*?caption-(left|center|right)/i);
53    align = (align && align[1]) ? align[1] : '';
54    caption = contents.match(/\<p class=\"caption-text\"\>(.*)\<\/p\>/);
55    caption_html = (caption && caption[0]) ? caption[0] : '';
56    caption = (caption && caption[1]) ? caption[1].replace(/"/g, '\\"') : '';
57    contents = contents.replace(caption_html, '');
58
59    return '[caption' + (caption ? (' caption="' + caption + '"') : '') + (align ? (' align="' + align + '"') : '') + ']' + contents + '[/caption]';
60  });
61};
62
63})(jQuery);
64;/**/
65/**
66 * Javascript for Radix Admin module.
67 */
68
69(function ($, Drupal) {
70
71"use strict";
72
73/**
74 * Store the open menu tray.
75 */
76var activeItem = Drupal.settings.basePath + Drupal.settings.currentPath;
77
78  $.fn.drupalNavbarMenu = function () {
79
80    var ui = {
81      'handleOpen': '<i class="fa fa-angle-down"></i>',
82      'handleClose': '<i class="fa fa-angle-up"></i>'
83    };
84    /**
85     * Handle clicks from the disclosure button on an item with sub-items.
86     *
87     * @param {Object} event
88     *   A jQuery Event object.
89     */
90    function toggleClickHandler (event) {
91      var $toggle = $(event.target);
92      var $item = $toggle.closest('li');
93      // Toggle the list item.
94      toggleList($item);
95      // Close open sibling menus.
96      var $openItems = $item.siblings().filter('.open');
97      toggleList($openItems, false);
98      // Save link of the closest open item through a unique selector.
99      var href = $toggle.siblings('a[href]').attr('href');
100
101      event.stopPropagation();
102    }
103    /**
104     * Toggle the open/close state of a list is a menu.
105     *
106     * @param {jQuery} $item
107     *   The li item to be toggled.
108     *
109     * @param {Boolean} switcher
110     *   A flag that forces toggleClass to add or a remove a class, rather than
111     *   simply toggling its presence.
112     */
113    function toggleList ($item, switcher) {
114      var $toggle = $item.find('> .navbar-box > .navbar-handle');
115      switcher = (typeof switcher !== 'undefined') ? switcher : !$item.hasClass('open');
116      // Toggle the item open state.
117      $item.toggleClass('open', switcher);
118      // Twist the toggle.
119      $toggle.toggleClass('open', switcher);
120      // Adjust the toggle text.
121      $toggle
122        .find('.action')
123        // Expand Structure, Collapse Structure
124        .html((switcher) ?  ui.handleClose : ui.handleOpen);
125    }
126    /**
127     * Add markup to the menu elements.
128     *
129     * Items with sub-elements have a list toggle attached to them. Menu item
130     * links and the corresponding list toggle are wrapped with in a div
131     * classed with .navbar-box. The .navbar-box div provides a positioning
132     * context for the item list toggle.
133     *
134     * @param {jQuery} $menu
135     *   The root of the menu to be initialized.
136     */
137    function initItems ($menu) {
138      var options = {
139        'class': 'navbar-icon navbar-handle',
140        'action': ui.handleOpen,
141        'text': ''
142      };
143      // Initialize items and their links.
144      $menu.find('li > a').wrap('<div class="navbar-box">');
145        // Add a handle to each list item if it has a menu.
146      $menu.find('li').each(function (index, element) {
147          var $item = $(element);
148          if ($item.find('> ul.menu').length) {
149            var $box = $item.find('> .navbar-box');
150            options.text = Drupal.t('@label', {'@label': $box.find('a').text()});
151            $item.find('> .navbar-box')
152              .append(Drupal.theme('navbarMenuItemToggle', options));
153          }
154        });
155    }
156    /**
157     * Adds a level class to each list based on its depth in the menu.
158     *
159     * This function is called recursively on each sub level of lists elements
160     * until the depth of the menu is exhausted.
161     *
162     * @param {jQuery} $lists
163     *   A jQuery object of ul elements.
164     *
165     * @param {Integer} level
166     *   The current level number to be assigned to the list elements.
167     */
168    function markListLevels ($lists, level) {
169      level = (!level) ? 1 : level;
170      var $lis = $lists.find('> li').addClass('level-' + level);
171      $lists = $lis.find('> ul');
172      if ($lists.length) {
vendor: 5,642 bytes, lines 173-233
173        markListLevels($lists, level + 1);
174      }
175    }
176    /**
177     * On page load, open the active menu item.
178     *
179     * Marks the trail of the active link in the menu back to the root of the
180     * menu with .active-trail.
181     *
182     * @param {jQuery} $menu
183     *   The root of the menu.
184     */
185    function openActiveItem ($menu) {
186      var pathItem = $menu.find('a[href="' + location.pathname + '"]');
187      if (pathItem.length && !activeItem) {
188        activeItem = location.pathname;
189      }
190      if (activeItem) {
191        var $activeItem = $menu.find('a[href="' + activeItem + '"]').addClass('active');
192        var $activeTrail = $activeItem.parentsUntil('.root', 'li').addClass('active-trail');
193        toggleList($activeTrail, true);
194      }
195    }
196
197    // Return the jQuery object.
198    return this.each(function (selector) {
199      var $menu = $(this).once('navbar-menu');
200      if ($menu.length) {
201        $menu.addClass('root');
202        initItems($menu);
203        markListLevels($menu);
204        // Attach handlers.
205        // Bind event handlers.
206        $menu
207          .delegate('.navbar-handle', 'click.navbar', toggleClickHandler);
208        // Restore previous and active states.
209        openActiveItem($menu);
210      }
211    });
212  };
213
214  /**
215   * A toggle is an interactive element often bound to a click handler.
216   *
217   * @return {String}
218   *   A string representing a DOM fragment.
219   */
220  Drupal.theme.navbarMenuItemToggle = function (options) {
221    var iconClass = (options.action == Drupal.t('Extend')) ? 'fa-angle-down' : 'fa-angle-up';
222    return '<button class="' + options['class'] + '"><span class="action">' + options.action + '</span></button>';
223  };
224
225}(jQuery, Drupal));
226;/**/
227/*!
228	Colorbox v1.5.9 - 2014-04-25
229	jQuery lightbox and modal window plugin
230	(c) 2014 Jack Moore - http://www.jacklmoore.com/colorbox
231	license: http://www.opensource.org/licenses/mit-license.php
232*/
233(function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(z+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in x[0]&&!x[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),x.focus())}function c(t){c.str!==t&&(x.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){z=0,e&&e!==!1?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),z=W.index(_.el),-1===z&&(W=W.add(_.el),z=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data("colorbox"),_=new r(i,o),g(_.get("rel")),!$){$=q=!0,c(_.get("className")),x.css({visibility:"hidden",display:"block",opacity:""}),L=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(L),D=T.height()+k.height()+b.outerHeight(!0)-b.height(),j=C.width()+H.width()+b.outerWidth(!0)-b.width(),A=L.outerHeight(!0),N=L.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=(l!==!1?Math.min(h,a(l,"x")):h)-N-j,_.h=(f!==!1?Math.min(s,a(f,"y")):s)-A-D,L.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(I).hide(),x.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}v.css({opacity:parseFloat(_.get("opacity"))||"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("<div/>"),w()}}function p(){!x&&e.body&&(V=!1,E=t(i),x=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),S=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),y=n(se,"Wrapper"),b=n(se,"Content").append(I=n(se,"Title"),R=n(se,"Current"),P=t('<button type="button"/>').attr({id:Z+"Previous"}),K=t('<button type="button"/>').attr({id:Z+"Next"}),F=n("button","Slideshow"),S),B=t('<button type="button"/>').attr({id:Z+"Close"}),y.append(n(se).append(n(se,"TopLeft"),T=n(se,"TopCenter"),n(se,"TopRight")),n(se,!1,"clear:left").append(C=n(se,"MiddleLeft"),b,H=n(se,"MiddleRight")),n(se,!1,"clear:left").append(n(se,"BottomLeft"),k=n(se,"BottomCenter"),n(se,"BottomRight"))).find("div div").css({"float":"left"}),M=n(se,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),O=K.add(P).add(R).add(F),t(e.body).append(v,x.append(y,M)))}function m(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),f(this))}return x?(V||(V=!0,K.click(function(){J.next()}),P.click(function(){J.prev()}),B.click(function(){J.close()}),v.click(function(){_.get("overlayClose")&&J.close()}),t(e).bind("keydown."+Z,function(t){var e=t.keyCode;$&&_.get("escKey")&&27===e&&(t.preventDefault(),J.close()),$&&_.get("arrowKey")&&W[1]&&!t.altKey&&
233(37===e?(t.preventDefault(),P.click()):39===e&&(t.preventDefault(),K.click()))}),t.isFunction(t.fn.on)?t(e).on("click."+Z,"."+te,i):t("."+te).live("click."+Z,i)),!0):!1}function w(){var e,o,r,h=J.prep,d=++le;if(q=!0,U=!1,u(he),u(ie),_.get("onLoad"),_.h=_.get("height")?a(_.get("height"),"y")-A-D:_.get("innerHeight")&&a(_.get("innerHeight"),"y"),_.w=_.get("width")?a(_.get("width"),"x")-N-j:_.get("innerWidth")&&a(_.get("innerWidth"),"x"),_.mw=_.w,_.mh=_.h,_.get("maxWidth")&&(_.mw=a(_.get("maxWidth"),"x")-N-j,_.mw=_.w&&_.w<_.mw?_.w:_.mw),_.get("maxHeight")&&(_.mh=a(_.get("maxHeight"),"y")-A-D,_.mh=_.h&&_.h<_.mh?_.h:_.mh),e=_.get("href"),Q=setTimeout(function(){S.show()},100),_.get("inline")){var c=t(e);r=t("<div>").hide().insertBefore(c),ae.one(he,function(){r.replaceWith(c)}),h(c)}else _.get("iframe")?h(" "):_.get("html")?h(_.get("html")):s(_,e)?(e=l(_,e),U=new Image,t(U).addClass(Z+"Photo").bind("error",function(){h(n(se,"Error").html(_.get("imgError")))}).one("load",function(){d===le&&setTimeout(function(){var e;t.each(["alt","longdesc","aria-describedby"],function(e,i){var n=t(_.el).attr(i)||t(_.el).attr("data-"+i);n&&U.setAttribute(i,n)}),_.get("retinaImage")&&i.devicePixelRatio>1&&(U.height=U.height/i.devicePixelRatio,U.width=U.width/i.devicePixelRatio),_.get("scalePhotos")&&(o=function(){U.height-=U.height*e,U.width-=U.width*e},_.mw&&U.width>_.mw&&(e=(U.width-_.mw)/U.width,o()),_.mh&&U.height>_.mh&&(e=(U.height-_.mh)/U.height,o())),_.h&&(U.style.marginTop=Math.max(_.mh-U.height,0)/2+"px"),W[1]&&(_.get("loop")||W[z+1])&&(U.style.cursor="pointer",U.onclick=function(){J.next()}),U.style.width=U.width+"px",U.style.height=U.height+"px",h(U)},1)}),U.src=e):e&&M.load(e,_.get("data"),function(e,i){d===le&&h("error"===i?n(se,"Error").html(_.get("xhrError")):t(this).contents())})}var v,x,y,b,T,C,H,k,W,E,L,M,S,I,R,F,K,P,B,O,_,D,j,A,N,z,U,$,q,G,Q,J,V,X={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return t(this).attr("href")},title:function(){return this.title}},Y="colorbox",Z="cbox",te=Z+"Element",ee=Z+"_open",ie=Z+"_load",ne=Z+"_complete",oe=Z+"_cleanup",re=Z+"_closed",he=Z+"_purge",ae=t("<a/>"),se="div",le=0,de={},ce=function(){function t(){clearTimeout(h)}function e(){(_.get("loop")||W[z+1])&&(t(),h=setTimeout(J.next,_.get("slideshowSpeed")))}function i(){F.html(_.get("slideshowStop")).unbind(s).one(s,n),ae.bind(ne,e).bind(ie,t),x.removeClass(a+"off").addClass(a+"on")}function n(){t(),ae.unbind(ne,e).unbind(ie,t),F.html(_.get("slideshowStart")).unbind(s).one(s,function(){J.next(),i()}),x.removeClass(a+"on").addClass(a+"off")}function o(){r=!1,F.hide(),t(),ae.unbind(ne,e).unbind(ie,t),x.removeClass(a+"off "+a+"on")}var r,h,a=Z+"Slideshow_",s="click."+Z;return function(){r?_.get("slideshow")||(ae.unbind(oe,o),o()):_.get("slideshow")&&W[1]&&(r=!0,ae.one(oe,o),_.get("slideshowAuto")?i():n(),F.show())}}();t.colorbox||(t(p),J=t.fn[Y]=t[Y]=function(e,i){var n,o=this;if(e=e||{},t.isFunction(o))o=t("<a/>"),e.open=!0;else if(!o[0])return o;return o[0]?(p(),m()&&(i&&(e.onComplete=i),o.each(function(){var i=t.data(this,Y)||{};t.data(this,Y,t.extend(i,e))}).addClass(te),n=new r(o[0],e),n.get("open")&&f(o[0])),o):o},J.position=function(e,i){function n(){T[0].style.width=k[0].style.width=b[0].style.width=parseInt(x[0].style.width,10)-j+"px",b[0].style.height=C[0].style.height=H[0].style.height=parseInt(x[0].style.height,10)-D+"px"}var r,h,s,l=0,d=0,c=x.offset();if(E.unbind("resize."+Z),x.css({top:-9e4,left:-9e4}),h=E.scrollTop(),s=E.scrollLeft(),_.get("fixed")?(c.top-=h,c.left-=s,x.css({position:"fixed"})):(l=h,d=s,x.css({position:"absolute"})),d+=_.get("right")!==!1?Math.max(E.width()-_.w-N-j-a(_.get("right"),"x"),0):_.get("left")!==!1?a(_.get("left"),"x"):Math.round(Math.max(E.width()-_.w-N-j,0)/2),l+=_.get("bottom")!==!1?Math.max(o()-_.h-A-D-a(_.get("bottom"),"y"),0):_.get("top")!==!1?a(_.get("top"),"y"):Math.round(Math.max(o()-_.h-A-D,0)/2),x.css({top:c.top,left
233:c.left,visibility:"visible"}),y[0].style.width=y[0].style.height="9999px",r={width:_.w+N+j,height:_.h+A+D,top:l,left:d},e){var g=0;t.each(r,function(t){return r[t]!==de[t]?(g=e,void 0):void 0}),e=g}de=r,e||x.css(r),x.dequeue().animate(r,{duration:e||0,complete:function(){n(),q=!1,y[0].style.width=_.w+N+j+"px",y[0].style.height=_.h+A+D+"px",_.get("reposition")&&setTimeout(function(){E.bind("resize."+Z,J.position)},1),i&&i()},step:n})},J.resize=function(t){var e;$&&(t=t||{},t.width&&(_.w=a(t.width,"x")-N-j),t.innerWidth&&(_.w=a(t.innerWidth,"x")),L.css({width:_.w}),t.height&&(_.h=a(t.height,"y")-A-D),t.innerHeight&&(_.h=a(t.innerHeight,"y")),t.innerHeight||t.height||(e=L.scrollTop(),L.css({height:"auto"}),_.h=L.height()),L.css({height:_.h}),e&&L.scrollTop(e),J.position("none"===_.get("transition")?0:_.get("speed")))},J.prep=function(i){function o(){return _.w=_.w||L.width(),_.w=_.mw&&_.mw<_.w?_.mw:_.w,_.w}function a(){return _.h=_.h||L.height(),_.h=_.mh&&_.mh<_.h?_.mh:_.h,_.h}if($){var d,g="none"===_.get("transition")?0:_.get("speed");L.remove(),L=n(se,"LoadedContent").append(i),L.hide().appendTo(M.show()).css({width:o(),overflow:_.get("scrolling")?"auto":"hidden"}).css({height:a()}).prependTo(b),M.hide(),t(U).css({"float":"none"}),c(_.get("className")),d=function(){function i(){t.support.opacity===!1&&x[0].style.removeAttribute("filter")}var n,o,a=W.length;$&&(o=function(){clearTimeout(Q),S.hide(),u(ne),_.get("onComplete")},I.html(_.get("title")).show(),L.show(),a>1?("string"==typeof _.get("current")&&R.html(_.get("current").replace("{current}",z+1).replace("{total}",a)).show(),K[_.get("loop")||a-1>z?"show":"hide"]().html(_.get("next")),P[_.get("loop")||z?"show":"hide"]().html(_.get("previous")),ce(),_.get("preloading")&&t.each([h(-1),h(1)],function(){var i,n=W[this],o=new r(n,t.data(n,Y)),h=o.get("href");h&&s(o,h)&&(h=l(o,h),i=e.createElement("img"),i.src=h)})):O.hide(),_.get("iframe")?(n=e.createElement("iframe"),"frameBorder"in n&&(n.frameBorder=0),"allowTransparency"in n&&(n.allowTransparency="true"),_.get("scrolling")||(n.scrolling="no"),t(n).attr({src:_.get("href"),name:(new Date).getTime(),"class":Z+"Iframe",allowFullScreen:!0}).one("load",o).appendTo(L),ae.one(he,function(){n.src="//about:blank"}),_.get("fastIframe")&&t(n).trigger("load")):o(),"fade"===_.get("transition")?x.fadeTo(g,1,i):i())},"fade"===_.get("transition")?x.fadeTo(g,0,function(){J.position(0,d)}):J.position(g,d)}},J.next=function(){!q&&W[1]&&(_.get("loop")||W[z+1])&&(z=h(1),f(W[z]))},J.prev=function(){!q&&W[1]&&(_.get("loop")||z)&&(z=h(-1),f(W[z]))},J.close=function(){$&&!G&&(G=!0,$=!1,u(oe),_.get("onCleanup"),E.unbind("."+Z),v.fadeTo(_.get("fadeOut")||0,0),x.stop().fadeTo(_.get("fadeOut")||0,0,function(){x.hide(),v.hide(),u(he),L.remove(),setTimeout(function(){G=!1,u(re),_.get("onClosed")},1)}))},J.remove=function(){x&&(x.stop(),t.colorbox.close(),x.stop().remove(),v.remove(),G=!1,x=null,t("."+te).removeData(Y).removeClass(te),t(e).unbind("click."+Z))},J.element=function(){return t(_.el)},J.settings=X)})(jQuery,document,window);;/**/
234(function ($) {
235
236Drupal.behaviors.initColorbox = {
237  attach: function (context, settings) {
238    if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') {
239      return;
240    }
241
242    if (settings.colorbox.mobiledetect && window.matchMedia) {
243      // Disable Colorbox for small screens.
244      var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")");
245      if (mq.matches) {
246        return;
247      }
248    }
249
250    $('.colorbox', context)
251      .once('init-colorbox')
252      .colorbox(settings.colorbox);
253
254    $(context).bind('cbox_complete', function () {
255      Drupal.attachBehaviors('#cboxLoadedContent');
256    });
257  }
258};
259
260})(jQuery);
261;/**/
262(function ($) {
263
264Drupal.behaviors.initColorboxLoad = {
265  attach: function (context, settings) {
266    if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') {
267      return;
268    }
269    $.urlParams = function (url) {
270      var p = {},
271          e,
272          a = /\+/g,  // Regex for replacing addition symbol with a space
273          r = /([^&=]+)=?([^&]*)/g,
274          d = function (s) { return decodeURIComponent(s.replace(a, ' ')); },
275          q = url.split('?');
276      while (e = r.exec(q[1])) {
277        e[1] = d(e[1]);
278        e[2] = d(e[2]);
279        switch (e[2].toLowerCase()) {
280          case 'true':
281          case 'yes':
282            e[2] = true;
283            break;
284          case 'false':
285          case 'no':
286            e[2] = false;
287            break;
288        }
289        if (e[1] == 'width') { e[1] = 'innerWidth'; }
290        if (e[1] == 'height') { e[1] = 'innerHeight'; }
291        p[e[1]] = e[2];
292      }
293      return p;
294    };
295    $('.colorbox-load', context)
296      .once('init-colorbox-load', function () {
297        var params = $.urlParams($(this).attr('href'));
298        $(this).colorbox($.extend({}, settings.colorbox, params));
299      });
300  }
301};
302
303})(jQuery);
304;/**/
305(function ($) {
306
307Drupal.behaviors.initColorboxInline = {
308  attach: function (context, settings) {
309    if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') {
310      return;
311    }
312    $.urlParam = function(name, url){
313      if (name == 'fragment') {
314        var results = new RegExp('(#[^&#]*)').exec(url);
315      }
316      else {
317        var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url);
318      }
319      if (!results) { return ''; }
320      return results[1] || '';
321    };
322    $('.colorbox-inline', context).once('init-colorbox-inline').colorbox({
323      transition:settings.colorbox.transition,
324      speed:settings.colorbox.speed,
325      opacity:settings.colorbox.opacity,
326      slideshow:settings.colorbox.slideshow,
327      slideshowAuto:settings.colorbox.slideshowAuto,
328      slideshowSpeed:settings.colorbox.slideshowSpeed,
329      slideshowStart:settings.colorbox.slideshowStart,
330      slideshowStop:settings.colorbox.slideshowStop,
331      current:settings.colorbox.current,
332      previous:settings.colorbox.previous,
333      next:settings.colorbox.next,
334      close:settings.colorbox.close,
335      overlayClose:settings.colorbox.overlayClose,
336      maxWidth:settings.colorbox.maxWidth,
337      maxHeight:settings.colorbox.maxHeight,
338      innerWidth:function(){
339        return $.urlParam('width', $(this).attr('href'));
340      },
341      innerHeight:function(){
342        return $.urlParam('height', $(this).attr('href'));
343      },
344      title:function(){
345        return decodeURIComponent($.urlParam('title', $(this).attr('href')));
346      },
347      iframe:function(){
348        return $.urlParam('iframe', $(this).attr('href'));
349      },
350      inline:function(){
351        return $.urlParam('inline', $(this).attr('href'));
352      },
353      href:function(){
354        return $.urlParam('fragment', $(this).attr('href'));
355      }
356    });
357  }
358};
359
360})(jQuery);
361;/**/
362/* $Id: lightbox.js,v 1.5.2.6.2.136 2010/09/24 08:39:40 snpower Exp $ */
363
364/**
365 * jQuery Lightbox
366 * @author
367 *   Stella Power, <http://drupal.org/user/66894>
368 *
369 * Based on Lightbox v2.03.3 by Lokesh Dhakar
370 * <http://www.huddletogether.com/projects/lightbox2/>
371 * Also partially based on the jQuery Lightbox by Warren Krewenki
372 *   <http://warren.mesozen.com>
373 *
374 * Permission has been granted to Mark Ashmead & other Drupal Lightbox2 module
375 * maintainers to distribute this file via Drupal.org
376 * Under GPL license.
377 *
378 * Slideshow, iframe and video functionality added by Stella Power.
379 */
380
381var Lightbox;
382(function($) {
383Lightbox = {
384  auto_modal : false,
385  overlayOpacity : 0.8, // Controls transparency of shadow overlay.
386  overlayColor : '000', // Controls colour of shadow overlay.
387  disableCloseClick : true,
388  // Controls the order of the lightbox resizing animation sequence.
389  resizeSequence: 0, // 0: simultaneous, 1: width then height, 2: height then width.
390  resizeSpeed: 'normal', // Controls the speed of the lightbox resizing animation.
391  fadeInSpeed: 'normal', // Controls the speed of the image appearance.
392  slideDownSpeed: 'slow', // Controls the speed of the image details appearance.
393  minWidth: 240,
394  borderSize : 10,
395  boxColor : 'fff',
396  fontColor : '000',
397  topPosition : '',
398  infoHeight: 20,
399  alternative_layout : false,
400  imageArray : [],
401  imageNum : null,
402  total : 0,
403  activeImage : null,
404  inprogress : false,
405  disableResize : false,
406  disableZoom : false,
407  isZoomedIn : false,
408  rtl : false,
409  loopItems : false,
410  keysClose : ['c', 'x', 27],
411  keysPrevious : ['p', 37],
412  keysNext : ['n', 39],
413  keysZoom : ['z'],
414  keysPlayPause : [32],
415
416  // Slideshow options.
417  slideInterval : 5000, // In milliseconds.
418  showPlayPause : true,
419  autoStart : true,
420  autoExit : true,
421  pauseOnNextClick : false, // True to pause the slideshow when the "Next" button is clicked.
422  pauseOnPrevClick : true, // True to pause the slideshow when the "Prev" button is clicked.
423  slideIdArray : [],
424  slideIdCount : 0,
425  isSlideshow : false,
426  isPaused : false,
427  loopSlides : false,
428
429  // Iframe options.
430  isLightframe : false,
431  iframe_width : 600,
432  iframe_height : 400,
433  iframe_border : 1,
434
435  // Video and modal options.
436  enableVideo : false,
437  flvPlayer : '/flvplayer.swf',
438  flvFlashvars : '',
439  isModal : false,
440  isVideo : false,
441  videoId : false,
442  modalWidth : 400,
443  modalHeight : 400,
444  modalHTML : null,
445
446
447  // initialize()
448  // Constructor runs on completion of the DOM loading.
449  // The function inserts html at the bottom of the page which is used
450  // to display the shadow overlay and the image container.
451  initialize: function() {
452
453    var s = Drupal.settings.lightbox2;
454    Lightbox.overlayOpacity = s.overlay_opacity;
455    Lightbox.overlayColor = s.overlay_color;
456    Lightbox.disableCloseClick = s.disable_close_click;
457    Lightbox.resizeSequence = s.resize_sequence;
458    Lightbox.resizeSpeed = s.resize_speed;
459    Lightbox.fadeInSpeed = s.fade_in_speed;
460    Lightbox.slideDownSpeed = s.slide_down_speed;
461    Lightbox.borderSize = s.border_size;
462    Lightbox.boxColor = s.box_color;
463    Lightbox.fontColor = s.font_color;
464    Lightbox.topPosition = s.top_position;
465    Lightbox.rtl = s.rtl;
466    Lightbox.loopItems = s.loop_items;
467    Lightbox.keysClose = s.keys_close.split(" ");
468    Lightbox.keysPrevious = s.keys_previous.split(" ");
469    Lightbox.keysNext = s.keys_next.split(" ");
470    Lightbox.keysZoom = s.keys_zoom.split(" ");
471    Lightbox.keysPlayPause = s.keys_play_pause.split(" ");
472    Lightbox.disableResize = s.disable_resize;
473    Lightbox.disableZoom = s.disable_zoom;
474    Lightbox.slideInterval = s.slideshow_interval;
475    Lightbox.showPlayPause = s.show_play_pause;
476    Lightbox.showCaption = s.show_caption;
477    Lightbox.autoStart = s.slideshow_automatic_start;
478    Lightbox.autoExit = s.slideshow_automatic_exit;
479    Lightbox.pauseOnNextClick = s.pause_on_next_click;
480    Lightbox.pauseOnPrevClick = s.pause_on_previous_click;
481    Lightbox.loopSlides = s.loop_slides;
482    Lightbox.alternative_layout = s.use_alt_layout;
483    Lightbox.iframe_width = s.iframe_width;
484    Lightbox.iframe_height = s.iframe_height;
485    Lightbox.iframe_border = s.iframe_border;
486    Lightbox.enableVideo = s.enable_video;
487    if (s.enable_video) {
488      Lightbox.flvPlayer = s.flvPlayer;
489      Lightbox.flvFlashvars = s.flvFlashvars;
490    }
491
492    // Make the lightbox divs.
493    var layout_class = (s.use_alt_layout ? 'lightbox2-alt-layout' : 'lightbox2-orig-layout');
494    var output = '<div id="lightbox2-overlay" style="display: none;"></div>\
495      <div id="lightbox" style="display: none;" class="' + layout_class + '">\
496        <div id="outerImageContainer"></div>\
497        <div id="imageDataContainer" class="clearfix">\
498          <div id="imageData"></div>\
499        </div>\
500      </div>';
501    var loading = '<div id="loading"><a href="#" id="loadingLink"></a></div>';
502    var modal = '<div id="modalContainer" style="display: none;"></div>';
503    var frame = '<div id="frameContainer" style="display: none;"></div>';
504    var imageContainer = '<div id="imageContainer" style="display: none;"></div>';
505    var details = '<div id="imageDetails"></div>';
506    var bottomNav = '<div id="bottomNav"></div>';
507    var image = '<img id="lightboxImage" alt="" />';
508    var hoverNav = '<div id="hoverNav"><a id="prevLink" href="#"></a><a id="nextLink" href="#"></a></div>';
509    var frameNav = '<div id="frameHoverNav"><a id="framePrevLink" href="#"></a><a id="frameNextLink" href="#"></a></div>';
510    var hoverNav = '<div id="hoverNav"><a id="prevLink" title="' + Drupal.t('Previous') + '" href="#"></a><a id="nextLink" title="' + Drupal.t('Next') + '" href="#"></a></div>';
511    var frameNav = '<div id="frameHoverNav"><a id="framePrevLink" title="' + Drupal.t('Previous') + '" href="#"></a><a id="frameNextLink" title="' + Drupal.t('Next') + '" href="#"></a></div>';
512    var caption = '<span id="caption"></span>';
513    var numberDisplay = '<span id="numberDisplay"></span>';
514    var close = '<a id="bottomNavClose" title="' + Drupal.t('Close') + '" href="#"></a>';
515    var zoom = '<a id="bottomNavZoom" href="#"></a>';
516    var zoomOut = '<a id="bottomNavZoomOut" href="#"></a>';
517    var pause = '<a id="lightshowPause" title="' + Drupal.t('Pause Slideshow') + '" href="#" style="display: none;"></a>';
518    var play = '<a id="lightshowPlay" title="' + Drupal.t('Play Slideshow') + '" href="#" style="display: none;"></a>';
519
520    $("body").append(output);
521    $('#outerImageContainer').append(modal + frame + imageContainer + loading);
522    if (!s.use_alt_layout) {
523      $('#imageContainer').append(image + hoverNav);
524      $('#imageData').append(details + bottomNav);
525      $('#imageDetails').append(caption + numberDisplay);
526      $('#bottomNav').append(frameNav + close + zoom + zoomOut + pause + play);
527    }
528    else {
529      $('#outerImageContainer').append(bottomNav);
530      $('#imageContainer').append(image);
531      $('#bottomNav').append(close + zoom + zoomOut);
532      $('#imageData').append(hoverNav + details);
533      $('#imageDetails').append(caption + numberDisplay + pause + play);
534    }
535
536    // Setup onclick handlers.
537    if (Lightbox.disableCloseClick) {
538      $('#lightbox2-overlay').click(function() { Lightbox.end(); return false; } ).hide();
539    }
540    $('#loadingLink, #bottomNavClose').click(function() { Lightbox.end('forceClose'); return false; } );
541    $('#prevLink, #framePrevLink').click(function() { Lightbox.changeData(Lightbox.activeImage - 1); return false; } );
542    $('#nextLink, #frameNextLink').click(function() { Lightbox.changeData(Lightbox.activeImage + 1); return false; } );
543    $('#bottomNavZoom').click(function() { Lightbox.changeData(Lightbox.activeImage, true); return false; } );
544    $('#bottomNavZoomOut').click(function() { Lightbox.changeData(Lightbox.activeImage, false); return false; } );
545    $('#lightshowPause').click(function() { Lightbox.togglePlayPause("lightshowPause", "lightshowPlay"); return false; } );
546    $('#lightshowPlay').click(function() { Lightbox.togglePlayPause("lightshowPlay", "lightshowPause"); return false; } );
547
548    // Fix positioning.
549    $('#prevLink, #nextLink, #framePrevLink, #frameNextLink').css({ 'paddingTop': Lightbox.borderSize + 'px'});
550    $('#imageContainer, #frameContainer, #modalContainer').css({ 'padding': Lightbox.borderSize + 'px'});
551    $('#outerImageContainer, #imageDataContainer, #bottomNavClose').css({'backgroundColor': '#' + Lightbox.boxColor, 'color': '#'+Lightbox.fontColor});
552    if (Lightbox.alternative_layout) {
553      $('#bottomNavZoom, #bottomNavZoomOut').css({'bottom': Lightbox.borderSize + 'px', 'right': Lightbox.borderSize + 'px'});
554    }
555    else if (Lightbox.rtl == 1 && Drupal.settings.lightbox2.useragent.search('MSIE') !== -1) {
556      $('#bottomNavZoom, #bottomNavZoomOut').css({'left': '0px'});
557    }
558
559    // Force navigation links to always be displayed
560    if (s.force_show_nav) {
561      $('#prevLink, #nextLink').addClass("force_show_nav");
562    }
563
564  },
565
566  // initList()
567  // Loops through anchor tags looking for 'lightbox', 'lightshow' and
568  // 'lightframe', etc, references and applies onclick events to appropriate
569  // links. You can rerun after dynamically adding images w/ajax.
570  initList : function(context) {
571
572    if (context == undefined || context == null) {
573      context = document;
574    }
575
576    // Attach lightbox to any links with rel 'lightbox', 'lightshow' or
577    // 'lightframe', etc.
578    $("a[rel^='lightbox']:not(.lightbox-processed), area[rel^='lightbox']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) {
579      if (Lightbox.disableCloseClick) {
580        $('#lightbox').unbind('click');
581        $('#lightbox').click(function() { Lightbox.end('forceClose'); } );
582      }
583      Lightbox.start(this, false, false, false, false);
584      if (e.preventDefault) { e.preventDefault(); }
585      return false;
586    });
587    $("a[rel^='lightshow']:not(.lightbox-processed), area[rel^='lightshow']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) {
588      if (Lightbox.disableCloseClick) {
589        $('#lightbox').unbind('click');
590        $('#lightbox').click(function() { Lightbox.end('forceClose'); } );
591      }
592      Lightbox.start(this, true, false, false, false);
593      if (e.preventDefault) { e.preventDefault(); }
594      return false;
595    });
596    $("a[rel^='lightframe']:not(.lightbox-processed), area[rel^='lightframe']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) {
597      if (Lightbox.disableCloseClick) {
598        $('#lightbox').unbind('click');
599        $('#lightbox').click(function() { Lightbox.end('forceClose'); } );
600      }
601      Lightbox.start(this, false, true, false, false);
602      if (e.preventDefault) { e.preventDefault(); }
603      return false;
604    });
605    if (Lightbox.enableVideo) {
606      $("a[rel^='lightvideo']:not(.lightbox-processed), area[rel^='lightvideo']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) {
607        if (Lightbox.disableCloseClick) {
608          $('#lightbox').unbind('click');
609          $('#lightbox').click(function() { Lightbox.end('forceClose'); } );
610        }
611        Lightbox.start(this, false, false, true, false);
612        if (e.preventDefault) { e.preventDefault(); }
613        return false;
614      });
615    }
616    $("a[rel^='lightmodal']:not(.lightbox-processed), area[rel^='lightmodal']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) {
617      $('#lightbox').unbind('click');
618      // Add classes from the link to the lightbox div - don't include lightbox-processed
619      $('#lightbox').addClass($(this).attr('class'));
620      $('#lightbox').removeClass('lightbox-processed');
621      Lightbox.start(this, false, false, false, true);
622      if (e.preventDefault) { e.preventDefault(); }
623      return false;
624    });
625    $("#lightboxAutoModal:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) {
626      Lightbox.auto_modal = true;
627      $('#lightbox').unbind('click');
628      Lightbox.start(this, false, false, false, true);
629      if (e.preventDefault) { e.preventDefault(); }
630      return false;
631    });
632  },
633
634  // start()
635  // Display overlay and lightbox. If image is part of a set, add siblings to
636  // imageArray.
637  start: function(imageLink, slideshow, lightframe, lightvideo, lightmodal) {
638
639    Lightbox.isPaused = !Lightbox.autoStart;
640
641    // Replaces hideSelectBoxes() and hideFlash() calls in original lightbox2.
642    Lightbox.toggleSelectsFlash('hide');
643
644    // Stretch overlay to fill page and fade in.
645    var arrayPageSize = Lightbox.getPageSize();
646    $("#lightbox2-overlay").hide().css({
647      'width': '100%',
648      'zIndex': '10090',
649      'height': arrayPageSize[1] + 'px',
650      'backgroundColor' : '#' + Lightbox.overlayColor
651    });
652    // Detect OS X FF2 opacity + flash issue.
653    if (lightvideo && this.detectMacFF2()) {
654      $("#lightbox2-overlay").removeClass("overlay_default");
655      $("#lightbox2-overlay").addClass("overlay_macff2");
656      $("#lightbox2-overlay").css({'opacity' : null});
657    }
658    else {
659      $("#lightbox2-overlay").removeClass("overlay_macff2");
660      $("#lightbox2-overlay").addClass("overlay_default");
661      $("#lightbox2-overlay").css({'opacity' : Lightbox.overlayOpacity});
662    }
663    $("#lightbox2-overlay").fadeIn(Lightbox.fadeInSpeed);
664
665
666    Lightbox.isSlideshow = slideshow;
667    Lightbox.isLightframe = lightframe;
668    Lightbox.isVideo = lightvideo;
669    Lightbox.isModal = lightmodal;
670    Lightbox.imageArray = [];
671    Lightbox.imageNum = 0;
672
673    var anchors = $(imageLink.tagName);
674    var anchor = null;
675    var rel_parts = Lightbox.parseRel(imageLink);
676    var rel = rel_parts["rel"];
677    var rel_group = rel_parts["group"];
678    var title = (rel_parts["title"] ? rel_parts["title"] : imageLink.title);
679    var rel_style = null;
680    var i = 0;
681
682    if (rel_parts["flashvars"]) {
683      Lightbox.flvFlashvars = Lightbox.flvFlashvars + '&' + rel_parts["flashvars"];
684    }
685
686    // Set the title for image alternative text.
687    var alt = imageLink.title;
688    if (!alt) {
689      var img = $(imageLink).find("img");
690      if (img && $(img).attr("alt")) {
691        alt = $(img).attr("alt");
692      }
693      else {
694        alt = title;
695      }
696    }
697
698    if ($(imageLink).attr('id') == 'lightboxAutoModal') {
699      rel_style = rel_parts["style"];
700      Lightbox.imageArray.push(['#lightboxAutoModal > *', title, alt, rel_style, 1]);
701    }
702    else {
703      // Handle lightbox images with no grouping.
704      if ((rel == 'lightbox' || rel == 'lightshow') && !rel_group) {
705        Lightbox.imageArray.push([imageLink.href, title, alt]);
706      }
707
708      // Handle other items with no grouping.
709      else if (!rel_group) {
710        rel_style = rel_parts["style"];
711        Lightbox.imageArray.push([imageLink.href, title, alt, rel_style]);
712      }
713
714      // Handle grouped items.
715      else {
716
717        // Loop through anchors and add them to imageArray.
718        for (i = 0; i < anchors.length; i++) {
719          anchor = anchors[i];
720          if (anchor.href && typeof(anchor.href) == "string" && $(anchor).attr('rel')) {
721            var rel_data = Lightbox.parseRel(anchor);
722            var anchor_title = (rel_data["title"] ? rel_data["title"] : anchor.title);
723            img_alt = anchor.title;
724            if (!img_alt) {
725              var anchor_img = $(anchor).find("img");
726              if (anchor_img && $(anchor_img).attr("alt")) {
727                img_alt = $(anchor_img).attr("alt");
728              }
729              else {
730                img_alt = title;
731              }
732            }
733            if (rel_data["rel"] == rel) {
734              if (rel_data["group"] == rel_group) {
735                if (Lightbox.isLightframe || Lightbox.isModal || Lightbox.isVideo) {
736                  rel_style = rel_data["style"];
737                }
738                Lightbox.imageArray.push([anchor.href, anchor_title, img_alt, rel_style]);
739              }
740            }
741          }
742        }
743
744        // Remove duplicates.
745        for (i = 0; i < Lightbox.imageArray.length; i++) {
746          for (j = Lightbox.imageArray.length-1; j > i; j--) {
747            if (Lightbox.imageArray[i][0] == Lightbox.imageArray[j][0]) {
748              Lightbox.imageArray.splice(j,1);
749            }
750          }
751        }
752        while (Lightbox.imageArray[Lightbox.imageNum][0] != imageLink.href) {
753          Lightbox.imageNum++;
754        }
755      }
756    }
757
758    if (Lightbox.isSlideshow && Lightbox.showPlayPause && Lightbox.isPaused) {
759      $('#lightshowPlay').show();
760      $('#lightshowPause').hide();
761    }
762
763    // Calculate top and left offset for the lightbox.
764    var arrayPageScroll = Lightbox.getPageScroll();
765    var lightboxTop = arrayPageScroll[1] + (Lightbox.topPosition == '' ? (arrayPageSize[3] / 10) : Lightbox.topPosition) * 1;
766    var lightboxLeft = arrayPageScroll[0];
767    $('#frameContainer, #modalContainer, #lightboxImage').hide();
768    $('#hoverNav, #prevLink, #nextLink, #frameHoverNav, #framePrevLink, #frameNextLink').hide();
769    $('#imageDataContainer, #numberDisplay, #bottomNavZoom, #bottomNavZoomOut').hide();
770    $('#outerImageContainer').css({'width': '250px', 'height': '250px'});
771    $('#lightbox').css({
772      'zIndex': '10500',
773      'top': lightboxTop + 'px',
774      'left': lightboxLeft + 'px'
775    }).show();
776
777    Lightbox.total = Lightbox.imageArray.length;
778    Lightbox.changeData(Lightbox.imageNum);
779  },
780
781  // changeData()
782  // Hide most elements and preload image in preparation for resizing image
783  // container.
784  changeData: function(imageNum, zoomIn) {
785
786    if (Lightbox.inprogress === false) {
787      if (Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) {
788        if (imageNum >= Lightbox.total) imageNum = 0;
789        if (imageNum < 0) imageNum = Lightbox.total - 1;
790      }
791
792      if (Lightbox.isSlideshow) {
793        for (var i = 0; i < Lightbox.slideIdCount; i++) {
794          window.clearTimeout(Lightbox.slideIdArray[i]);
795        }
796      }
797      Lightbox.inprogress = true;
798      Lightbox.activeImage = imageNum;
799
800      if (Lightbox.disableResize && !Lightbox.isSlideshow) {
801        zoomIn = true;
802      }
803      Lightbox.isZoomedIn = zoomIn;
804
805
806      // Hide elements during transition.
807      $('#loading').css({'zIndex': '10500'}).show();
808      if (!Lightbox.alternative_layout) {
809        $('#imageContainer').hide();
810      }
811      $('#frameContainer, #modalContainer, #lightboxImage').hide();
812      $('#hoverNav, #prevLink, #nextLink, #frameHoverNav, #framePrevLink, #frameNextLink').hide();
813      $('#imageDataContainer, #numberDisplay, #bottomNavZoom, #bottomNavZoomOut').hide();
814
815      // Preload image content, but not iframe pages.
816      if (!Lightbox.isLightframe && !Lightbox.isVideo && !Lightbox.isModal) {
817        $("#lightbox #imageDataContainer").removeClass('lightbox2-alt-layout-data');
818        imgPreloader = new Image();
819        imgPreloader.onerror = function() { Lightbox.imgNodeLoadingError(this); };
820
821        imgPreloader.onload = function() {
822          var photo = document.getElementById('lightboxImage');
823          photo.src = Lightbox.imageArray[Lightbox.activeImage][0];
824          photo.alt = Lightbox.imageArray[Lightbox.activeImage][2];
825
826          var imageWidth = imgPreloader.width;
827          var imageHeight = imgPreloader.height;
828
829          // Resize code.
830          var arrayPageSize = Lightbox.getPageSize();
831          var targ = { w:arrayPageSize[2] - (Lightbox.borderSize * 2), h:arrayPageSize[3] - (Lightbox.borderSize * 6) - (Lightbox.infoHeight * 4) - (arrayPageSize[3] / 10) };
832          var orig = { w:imgPreloader.width, h:imgPreloader.height };
833
834          // Image is very large, so show a smaller version of the larger image
835          // with zoom button.
836          if (zoomIn !== true) {
837            var ratio = 1.0; // Shrink image with the same aspect.
838            $('#bottomNavZoomOut, #bottomNavZoom').hide();
839            if ((orig.w >= targ.w || orig.h >= targ.h) && orig.h && orig.w) {
840              ratio = ((targ.w / orig.w) < (targ.h / orig.h)) ? targ.w / orig.w : targ.h / orig.h;
841              if (!Lightbox.disableZoom && !Lightbox.isSlideshow) {
842                $('#bottomNavZoom').css({'zIndex': '10500'}).show();
843              }
844            }
845
846            imageWidth  = Math.floor(orig.w * ratio);
847            imageHeight = Math.floor(orig.h * ratio);
848          }
849
850          else {
851            $('#bottomNavZoom').hide();
852            // Only display zoom out button if the image is zoomed in already.
853            if ((orig.w >= targ.w || orig.h >= targ.h) && orig.h && orig.w) {
854              // Only display zoom out button if not a slideshow and if the
855              // buttons aren't disabled.
856              if (!Lightbox.disableResize && Lightbox.isSlideshow === false && !Lightbox.disableZoom) {
857                $('#bottomNavZoomOut').css({'zIndex': '10500'}).show();
858              }
859            }
860          }
861
862          photo.style.width = (imageWidth) + 'px';
863          photo.style.height = (imageHeight) + 'px';
864          Lightbox.resizeContainer(imageWidth, imageHeight);
865
866          // Clear onLoad, IE behaves irratically with animated gifs otherwise.
867          imgPreloader.onload = function() {};
868        };
869
870        imgPreloader.src = Lightbox.imageArray[Lightbox.activeImage][0];
871        imgPreloader.alt = Lightbox.imageArray[Lightbox.activeImage][2];
872      }
873
874      // Set up frame size, etc.
875      else if (Lightbox.isLightframe) {
876        $("#lightbox #imageDataContainer").addClass('lightbox2-alt-layout-data');
877        var src = Lightbox.imageArray[Lightbox.activeImage][0];
878        $('#frameContainer').html('<iframe id="lightboxFrame" style="display: none;" src="'+src+'"></iframe>');
879
880        // Enable swf support in Gecko browsers.
881        if (Drupal.settings.lightbox2.useragent.search('Mozilla') !== -1 && src.indexOf('.swf') != -1) {
882          setTimeout(function () {
883            document.getElementById("lightboxFrame").src = Lightbox.imageArray[Lightbox.activeImage][0];
884          }, 1000);
885        }
886
887        if (!Lightbox.iframe_border) {
888          $('#lightboxFrame').css({'border': 'none'});
889          $('#lightboxFrame').attr('frameborder', '0');
890        }
891        var iframe = document.getElementById('lightboxFrame');
892        var iframeStyles = Lightbox.imageArray[Lightbox.activeImage][3];
893        iframe = Lightbox.setStyles(iframe, iframeStyles);
894        Lightbox.resizeContainer(parseInt(iframe.width, 10), parseInt(iframe.height, 10));
895      }
896      else if (Lightbox.isVideo || Lightbox.isModal) {
897        $("#lightbox #imageDataContainer").addClass('lightbox2-alt-layout-data');
898        var container = document.getElementById('modalContainer');
899        var modalStyles = Lightbox.imageArray[Lightbox.activeImage][3];
900        container = Lightbox.setStyles(container, modalStyles);
901        if (Lightbox.isVideo) {
902          Lightbox.modalHeight =  parseInt(container.height, 10) - 10;
903          Lightbox.modalWidth =  parseInt(container.width, 10) - 10;
904          Lightvideo.startVideo(Lightbox.imageArray[Lightbox.activeImage][0]);
905        }
906        Lightbox.resizeContainer(parseInt(container.width, 10), parseInt(container.height, 10));
907      }
908    }
909  },
910
911  // imgNodeLoadingError()
912  imgNodeLoadingError: function(image) {
913    var s = Drupal.settings.lightbox2;
914    var original_image = Lightbox.imageArray[Lightbox.activeImage][0];
915    if (s.display_image_size !== "") {
916      original_image = original_image.replace(new RegExp("."+s.display_image_size), "");
917    }
918    Lightbox.imageArray[Lightbox.activeImage][0] = original_image;
919    image.onerror = function() { Lightbox.imgLoadingError(image); };
920    image.src = original_image;
921  },
922
923  // imgLoadingError()
924  imgLoadingError: function(image) {
925    var s = Drupal.settings.lightbox2;
926    Lightbox.imageArray[Lightbox.activeImage][0] = s.default_image;
927    image.src = s.default_image;
928  },
929
930  // resizeContainer()
931  resizeContainer: function(imgWidth, imgHeight) {
932
933    imgWidth = (imgWidth < Lightbox.minWidth ? Lightbox.minWidth : imgWidth);
934
935    this.widthCurrent = $('#outerImageContainer').width();
936    this.heightCurrent = $('#outerImageContainer').height();
937
938    var widthNew = (imgWidth  + (Lightbox.borderSize * 2));
939    var heightNew = (imgHeight  + (Lightbox.borderSize * 2));
940
941    // Scalars based on change from old to new.
942    this.xScale = ( widthNew / this.widthCurrent) * 100;
943    this.yScale = ( heightNew / this.heightCurrent) * 100;
944
945    // Calculate size difference between new and old image, and resize if
946    // necessary.
947    wDiff = this.widthCurrent - widthNew;
948    hDiff = this.heightCurrent - heightNew;
949
950    $('#modalContainer').css({'width': imgWidth, 'height': imgHeight});
951    // Detect animation sequence.
952    if (Lightbox.resizeSequence) {
953      var animate1 = {width: widthNew};
954      var animate2 = {height: heightNew};
955      if (Lightbox.resizeSequence == 2) {
956        animate1 = {height: heightNew};
957        animate2 = {width: widthNew};
958      }
959      $('#outerImageContainer').animate(animate1, Lightbox.resizeSpeed).animate(animate2, Lightbox.resizeSpeed, 'linear', function() { Lightbox.showData(); });
960    }
961    // Simultaneous.
962    else {
963      $('#outerImageContainer').animate({'width': widthNew, 'height': heightNew}, Lightbox.resizeSpeed, 'linear', function() { Lightbox.showData(); });
964    }
965
966    // If new and old image are same size and no scaling transition is necessary
967    // do a quick pause to prevent image flicker.
968    if ((hDiff === 0) && (wDiff === 0)) {
969      if (Drupal.settings.lightbox2.useragent.search('MSIE') !== -1) {
970        Lightbox.pause(250);
971      }
972      else {
973        Lightbox.pause(100);
974      }
975    }
976
977    var s = Drupal.settings.lightbox2;
978    if (!s.use_alt_layout) {
979      $('#prevLink, #nextLink').css({'height': imgHeight + 'px'});
980    }
981    $('#imageDataContainer').css({'width': widthNew + 'px'});
982  },
983
984  // showData()
985  // Display image and begin preloading neighbors.
986  showData: function() {
987    $('#loading').hide();
988
989    if (Lightbox.isLightframe || Lightbox.isVideo || Lightbox.isModal) {
990      Lightbox.updateDetails();
991      if (Lightbox.isLightframe) {
992        $('#frameContainer').show();
993        if (Drupal.settings.lightbox2.useragent.search('Safari') !== -1 || Lightbox.fadeInSpeed === 0) {
994          $('#lightboxFrame').css({'zIndex': '10500'}).show();
995        }
996        else {
997          $('#lightboxFrame').css({'zIndex': '10500'}).fadeIn(Lightbox.fadeInSpeed);
998        }
999      }
1000      else {
1001        if (Lightbox.isVideo) {
1002          $("#modalContainer").html(Lightbox.modalHTML).click(function(){return false;}).css('zIndex', '10500').show();
1003        }
1004        else {
1005          var src = unescape(Lightbox.imageArray[Lightbox.activeImage][0]);
1006          if (Lightbox.imageArray[Lightbox.activeImage][4]) {
1007            $(src).appendTo("#modalContainer");
1008            $('#modalContainer').css({'zIndex': '10500'}).show();
1009          }
1010          else {
1011            // Use a callback to show the new image, otherwise you get flicker.
1012            $("#modalContainer").hide().load(src, function () {$('#modalContainer').css({'zIndex': '10500'}).show();});
1013          }
1014          $('#modalContainer').unbind('click');
1015        }
1016        // This might be needed in the Lightframe section above.
1017        //$('#modalContainer').css({'zIndex': '10500'}).show();
1018      }
1019    }
1020
1021    // Handle display of image content.
1022    else {
1023      $('#imageContainer').show();
1024      if (Drupal.settings.lightbox2.useragent.search('Safari') !== -1 || Lightbox.fadeInSpeed === 0) {
1025        $('#lightboxImage').css({'zIndex': '10500'}).show();
1026      }
1027      else {
1028        $('#lightboxImage').css({'zIndex': '10500'}).fadeIn(Lightbox.fadeInSpeed);
1029      }
1030      Lightbox.updateDetails();
1031      this.preloadNeighborImages();
1032    }
1033    Lightbox.inprogress = false;
1034
1035    // Slideshow specific stuff.
1036    if (Lightbox.isSlideshow) {
1037      if (!Lightbox.loopSlides && Lightbox.activeImage == (Lightbox.total - 1)) {
1038        if (Lightbox.autoExit) {
1039          Lightbox.slideIdArray[Lightbox.slideIdCount++] = setTimeout(function () {Lightbox.end('slideshow');}, Lightbox.slideInterval);
1040        }
1041      }
1042      else {
1043        if (!Lightbox.isPaused && Lightbox.total > 1) {
1044          Lightbox.slideIdArray[Lightbox.slideIdCount++] = setTimeout(function () {Lightbox.changeData(Lightbox.activeImage + 1);}, Lightbox.slideInterval);
1045        }
1046      }
1047      if (Lightbox.showPlayPause && Lightbox.total > 1 && !Lightbox.isPaused) {
1048        $('#lightshowPause').show();
1049        $('#lightshowPlay').hide();
1050      }
1051      else if (Lightbox.showPlayPause && Lightbox.total > 1) {
1052        $('#lightshowPause').hide();
1053        $('#lightshowPlay').show();
1054      }
1055    }
1056
1057    // Adjust the page overlay size.
1058    var arrayPageSize = Lightbox.getPageSize();
1059    var arrayPageScroll = Lightbox.getPageScroll();
1060    var pageHeight = arrayPageSize[1];
1061    if (Lightbox.isZoomedIn && arrayPageSize[1] > arrayPageSize[3]) {
1062      var lightboxTop = (Lightbox.topPosition == '' ? (arrayPageSize[3] / 10) : Lightbox.topPosition) * 1;
1063      pageHeight = pageHeight + arrayPageScroll[1] + lightboxTop;
1064    }
1065    $('#lightbox2-overlay').css({'height': pageHeight + 'px', 'width': arrayPageSize[0] + 'px'});
1066
1067    // Gecko browsers (e.g. Firefox, SeaMonkey, etc) don't handle pdfs as
1068    // expected.
1069    if (Drupal.settings.lightbox2.useragent.search('Mozilla') !== -1) {
1070      if (Lightbox.imageArray[Lightbox.activeImage][0].indexOf(".pdf") != -1) {
1071        setTimeout(function () {
1072          document.getElementById("lightboxFrame").src = Lightbox.imageArray[Lightbox.activeImage][0];
1073        }, 1000);
1074      }
1075    }
1076  },
1077
1078  // updateDetails()
1079  // Display caption, image number, and bottom nav.
1080  updateDetails: function() {
1081
1082    $("#imageDataContainer").hide();
1083
1084    var s = Drupal.settings.lightbox2;
1085
1086    if (s.show_caption) {
1087      var caption = Lightbox.filterXSS(Lightbox.imageArray[Lightbox.activeImage][1]);
1088      if (!caption) caption = '';
1089      $('#caption').html(caption).css({'zIndex': '10500'}).show();
1090    }
1091
1092    // If image is part of set display 'Image x of x'.
1093    var numberDisplay = null;
1094    if (s.image_count && Lightbox.total > 1) {
1095      var currentImage = Lightbox.activeImage + 1;
1096      if (!Lightbox.isLightframe && !Lightbox.isModal && !Lightbox.isVideo) {
1097        numberDisplay = s.image_count.replace(/\!current/, currentImage).replace(/\!total/, Lightbox.total);
1098      }
1099      else if (Lightbox.isVideo) {
1100        numberDisplay = s.video_count.replace(/\!current/, currentImage).replace(/\!total/, Lightbox.total);
1101      }
1102      else {
1103        numberDisplay = s.page_count.replace(/\!current/, currentImage).replace(/\!total/, Lightbox.total);
1104      }
1105      $('#numberDisplay').html(numberDisplay).css({'zIndex': '10500'}).show();
1106    }
1107    else {
1108      $('#numberDisplay').hide();
1109    }
1110
1111    $("#imageDataContainer").hide().slideDown(Lightbox.slideDownSpeed, function() {
1112      $("#bottomNav").show();
1113    });
1114    if (Lightbox.rtl == 1) {
1115      $("#bottomNav").css({'float': 'left'});
1116    }
1117    Lightbox.updateNav();
1118  },
1119
1120  // updateNav()
1121  // Display appropriate previous and next hover navigation.
1122  updateNav: function() {
1123
1124    $('#hoverNav').css({'zIndex': '10500'}).show();
1125    var prevLink = '#prevLink';
1126    var nextLink = '#nextLink';
1127
1128    // Slideshow is separated as we need to show play / pause button.
1129    if (Lightbox.isSlideshow) {
1130      if ((Lightbox.total > 1 && Lightbox.loopSlides) || Lightbox.activeImage !== 0) {
1131        $(prevLink).css({'zIndex': '10500'}).show().click(function() {
1132          if (Lightbox.pauseOnPrevClick) {
1133            Lightbox.togglePlayPause("lightshowPause", "lightshowPlay");
1134          }
1135          Lightbox.changeData(Lightbox.activeImage - 1); return false;
1136        });
1137      }
1138      else {
1139        $(prevLink).hide();
1140      }
1141
1142      // If not last image in set, display next image button.
1143      if ((Lightbox.total > 1 && Lightbox.loopSlides) || Lightbox.activeImage != (Lightbox.total - 1)) {
1144        $(nextLink).css({'zIndex': '10500'}).show().click(function() {
1145          if (Lightbox.pauseOnNextClick) {
1146            Lightbox.togglePlayPause("lightshowPause", "lightshowPlay");
1147          }
1148          Lightbox.changeData(Lightbox.activeImage + 1); return false;
1149        });
1150      }
1151      // Safari browsers need to have hide() called again.
1152      else {
1153        $(nextLink).hide();
1154      }
1155    }
1156
1157    // All other types of content.
1158    else {
1159
1160      if ((Lightbox.isLightframe || Lightbox.isModal || Lightbox.isVideo) && !Lightbox.alternative_layout) {
1161        $('#frameHoverNav').css({'zIndex': '10500'}).show();
1162        $('#hoverNav').css({'zIndex': '10500'}).hide();
1163        prevLink = '#framePrevLink';
1164        nextLink = '#frameNextLink';
1165      }
1166
1167      // If not first image in set, display prev image button.
1168      if ((Lightbox.total > 1 && Lightbox.loopItems) || Lightbox.activeImage !== 0) {
1169        // Unbind any other click handlers, otherwise this adds a new click handler
1170        // each time the arrow is clicked.
1171        $(prevLink).css({'zIndex': '10500'}).show().unbind().click(function() {
1172          Lightbox.changeData(Lightbox.activeImage - 1); return false;
1173        });
1174      }
1175      // Safari browsers need to have hide() called again.
1176      else {
1177        $(prevLink).hide();
1178      }
1179
1180      // If not last image in set, display next image button.
1181      if ((Lightbox.total > 1 && Lightbox.loopItems) || Lightbox.activeImage != (Lightbox.total - 1)) {
1182        // Unbind any other click handlers, otherwise this adds a new click handler
1183        // each time the arrow is clicked.
1184        $(nextLink).css({'zIndex': '10500'}).show().unbind().click(function() {
1185          Lightbox.changeData(Lightbox.activeImage + 1); return false;
1186        });
1187      }
1188      // Safari browsers need to have hide() called again.
1189      else {
1190        $(nextLink).hide();
1191      }
1192    }
1193
1194    // Don't enable keyboard shortcuts so forms will work.
1195    if (!Lightbox.isModal) {
1196      this.enableKeyboardNav();
1197    }
1198  },
1199
1200
1201  // enableKeyboardNav()
1202  enableKeyboardNav: function() {
1203    $(document).bind("keydown", this.keyboardAction);
1204  },
1205
1206  // disableKeyboardNav()
1207  disableKeyboardNav: function() {
1208    $(document).unbind("keydown", this.keyboardAction);
1209  },
1210
1211  // keyboardAction()
1212  keyboardAction: function(e) {
1213    if (e === null) { // IE.
1214      keycode = event.keyCode;
1215      escapeKey = 27;
1216    }
1217    else { // Mozilla.
1218      keycode = e.keyCode;
1219      escapeKey = e.DOM_VK_ESCAPE;
1220    }
1221
1222    key = String.fromCharCode(keycode).toLowerCase();
1223
1224    // Close lightbox.
1225    if (Lightbox.checkKey(Lightbox.keysClose, key, keycode)) {
1226      Lightbox.end('forceClose');
1227    }
1228    // Display previous image (p, <-).
1229    else if (Lightbox.checkKey(Lightbox.keysPrevious, key, keycode)) {
1230      if ((Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) || Lightbox.activeImage !== 0) {
1231        Lightbox.changeData(Lightbox.activeImage - 1);
1232      }
1233
1234    }
1235    // Display next image (n, ->).
1236    else if (Lightbox.checkKey(Lightbox.keysNext, key, keycode)) {
1237      if ((Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) || Lightbox.activeImage != (Lightbox.total - 1)) {
1238        Lightbox.changeData(Lightbox.activeImage + 1);
1239      }
1240    }
1241    // Zoom in.
1242    else if (Lightbox.checkKey(Lightbox.keysZoom, key, keycode) && !Lightbox.disableResize && !Lightbox.disableZoom && !Lightbox.isSlideshow && !Lightbox.isLightframe) {
1243      if (Lightbox.isZoomedIn) {
1244        Lightbox.changeData(Lightbox.activeImage, false);
1245      }
1246      else if (!Lightbox.isZoomedIn) {
1247        Lightbox.changeData(Lightbox.activeImage, true);
1248      }
1249      return false;
1250    }
1251    // Toggle play / pause (space).
1252    else if (Lightbox.checkKey(Lightbox.keysPlayPause, key, keycode) && Lightbox.isSlideshow) {
1253
1254      if (Lightbox.isPaused) {
1255        Lightbox.togglePlayPause("lightshowPlay", "lightshowPause");
1256      }
1257      else {
1258        Lightbox.togglePlayPause("lightshowPause", "lightshowPlay");
1259      }
1260      return false;
1261    }
1262  },
1263
1264  preloadNeighborImages: function() {
1265
1266    if ((Lightbox.total - 1) > Lightbox.activeImage) {
1267      preloadNextImage = new Image();
1268      preloadNextImage.src = Lightbox.imageArray[Lightbox.activeImage + 1][0];
1269    }
1270    if (Lightbox.activeImage > 0) {
1271      preloadPrevImage = new Image();
1272      preloadPrevImage.src = Lightbox.imageArray[Lightbox.activeImage - 1][0];
1273    }
1274
1275  },
1276
1277  end: function(caller) {
1278    var closeClick = (caller == 'slideshow' ? false : true);
1279    if (Lightbox.isSlideshow && Lightbox.isPaused && !closeClick) {
1280      return;
1281    }
1282    // To prevent double clicks on navigation links.
1283    if (Lightbox.inprogress === true && caller != 'forceClose') {
1284      return;
1285    }
1286    Lightbox.disableKeyboardNav();
1287    $('#lightbox').hide();
1288    $("#lightbox2-overlay").fadeOut();
1289    Lightbox.isPaused = true;
1290    Lightbox.inprogress = false;
1291    Lightbox.imageArray = [];
1292    Lightbox.imageNum = 0;
1293    // Replaces calls to showSelectBoxes() and showFlash() in original
1294    // lightbox2.
1295    Lightbox.toggleSelectsFlash('visible');
1296    if (Lightbox.isSlideshow) {
1297      for (var i = 0; i < Lightbox.slideIdCount; i++) {
1298        window.clearTimeout(Lightbox.slideIdArray[i]);
1299      }
1300      $('#lightshowPause, #lightshowPlay').hide();
1301    }
1302    else if (Lightbox.isLightframe) {
1303      $('#frameContainer').empty().hide();
1304    }
1305    else if (Lightbox.isVideo || Lightbox.isModal) {
1306      if (!Lightbox.auto_modal) {
1307        $('#modalContainer').hide().html("");
1308      }
1309      Lightbox.auto_modal = false;
1310    }
1311  },
1312
1313
1314  // getPageScroll()
1315  // Returns array with x,y page scroll values.
1316  // Core code from - quirksmode.com.
1317  getPageScroll : function() {
1318
1319    var xScroll, yScroll;
1320
1321    if (self.pageYOffset || self.pageXOffset) {
1322      yScroll = self.pageYOffset;
1323      xScroll = self.pageXOffset;
1324    }
1325    else if (document.documentElement && (document.documentElement.scrollTop || document.documentElement.scrollLeft)) {  // Explorer 6 Strict.
1326      yScroll = document.documentElement.scrollTop;
1327      xScroll = document.documentElement.scrollLeft;
1328    }
1329    else if (document.body) {// All other Explorers.
1330      yScroll = document.body.scrollTop;
1331      xScroll = document.body.scrollLeft;
1332    }
1333
1334    arrayPageScroll = [xScroll,yScroll];
1335    return arrayPageScroll;
1336  },
1337
1338  // getPageSize()
1339  // Returns array with page width, height and window width, height.
1340  // Core code from - quirksmode.com.
1341  // Edit for Firefox by pHaez.
1342
1343  getPageSize : function() {
1344
1345    var xScroll, yScroll;
1346
1347    if (window.innerHeight && window.scrollMaxY) {
1348      xScroll = window.innerWidth + window.scrollMaxX;
1349      yScroll = window.innerHeight + window.scrollMaxY;
1350    }
1351    else if (document.body.scrollHeight > document.body.offsetHeight) { // All but Explorer Mac.
1352      xScroll = document.body.scrollWidth;
1353      yScroll = document.body.scrollHeight;
1354    }
1355    else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari.
1356      xScroll = document.body.offsetWidth;
1357      yScroll = document.body.offsetHeight;
1358    }
1359
1360    var windowWidth, windowHeight;
1361
1362    if (self.innerHeight) { // All except Explorer.
1363      if (document.documentElement.clientWidth) {
1364        windowWidth = document.documentElement.clientWidth;
1365      }
1366      else {
1367        windowWidth = self.innerWidth;
1368      }
1369      windowHeight = self.innerHeight;
1370    }
1371    else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode.
1372      windowWidth = document.documentElement.clientWidth;
1373      windowHeight = document.documentElement.clientHeight;
1374    }
1375    else if (document.body) { // Other Explorers.
1376      windowWidth = document.body.clientWidth;
1377      windowHeight = document.body.clientHeight;
1378    }
1379    // For small pages with total height less than height of the viewport.
1380    if (yScroll < windowHeight) {
1381      pageHeight = windowHeight;
1382    }
1383    else {
1384      pageHeight = yScroll;
1385    }
1386    // For small pages with total width less than width of the viewport.
1387    if (xScroll < windowWidth) {
1388      pageWidth = xScroll;
1389    }
1390    else {
1391      pageWidth = windowWidth;
1392    }
1393    arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
1394    return arrayPageSize;
1395  },
1396
1397
1398  // pause(numberMillis)
1399  pause : function(ms) {
1400    var date = new Date();
1401    var curDate = null;
1402    do { curDate = new Date(); }
1403    while (curDate - date < ms);
1404  },
1405
1406
1407  // toggleSelectsFlash()
1408  // Hide / unhide select lists and flash objects as they appear above the
1409  // lightbox in some browsers.
1410  toggleSelectsFlash: function (state) {
1411    if (state == 'visible') {
1412      $("select.lightbox_hidden, embed.lightbox_hidden, object.lightbox_hidden").show();
1413    }
1414    else if (state == 'hide') {
1415      $("select:visible, embed:visible, object:visible").not('#lightboxAutoModal select, #lightboxAutoModal embed, #lightboxAutoModal object').addClass("lightbox_hidden");
1416      $("select.lightbox_hidden, embed.lightbox_hidden, object.lightbox_hidden").hide();
1417    }
1418  },
1419
1420
1421  // parseRel()
1422  parseRel: function (link) {
1423    var parts = [];
1424    parts["rel"] = parts["title"] = parts["group"] = parts["style"] = parts["flashvars"] = null;
1425    if (!$(link).attr('rel')) return parts;
1426    parts["rel"] = $(link).attr('rel').match(/\w+/)[0];
1427
1428    if ($(link).attr('rel').match(/\[(.*)\]/)) {
1429      var info = $(link).attr('rel').match(/\[(.*?)\]/)[1].split('|');
1430      parts["group"] = info[0];
1431      parts["style"] = info[1];
1432      if (parts["style"] != undefined && parts["style"].match(/flashvars:\s?(.*?);/)) {
1433        parts["flashvars"] = parts["style"].match(/flashvars:\s?(.*?);/)[1];
1434      }
1435    }
1436    if ($(link).attr('rel').match(/\[.*\]\[([\s\S]*)\]/)) {
1437      var title = $(link).attr('rel').match(/\[.*\]\[([\s\S]*)\]/)[1];
1438      parts["title"] = title.replace(/\n/g, '<br />');
1439    }
1440    return parts;
1441  },
1442
1443  // setStyles()
1444  setStyles: function(item, styles) {
1445    item.width = Lightbox.iframe_width;
1446    item.height = Lightbox.iframe_height;
1447    item.scrolling = "auto";
1448
1449    if (!styles) return item;
1450    var stylesArray = styles.split(';');
1451    for (var i = 0; i< stylesArray.length; i++) {
1452      if (stylesArray[i].indexOf('width:') >= 0) {
1453        var w = stylesArray[i].replace('width:', '');
1454        item.width = jQuery.trim(w);
1455      }
1456      else if (stylesArray[i].indexOf('height:') >= 0) {
1457        var h = stylesArray[i].replace('height:', '');
1458        item.height = jQuery.trim(h);
1459      }
1460      else if (stylesArray[i].indexOf('scrolling:') >= 0) {
1461        var scrolling = stylesArray[i].replace('scrolling:', '');
1462        item.scrolling = jQuery.trim(scrolling);
1463      }
1464      else if (stylesArray[i].indexOf('overflow:') >= 0) {
1465        var overflow = stylesArray[i].replace('overflow:', '');
1466        item.overflow = jQuery.trim(overflow);
1467      }
1468    }
1469    return item;
1470  },
1471
1472
1473  // togglePlayPause()
1474  // Hide the pause / play button as appropriate.  If pausing the slideshow also
1475  // clear the timers, otherwise move onto the next image.
1476  togglePlayPause: function(hideId, showId) {
1477    if (Lightbox.isSlideshow && hideId == "lightshowPause") {
1478      for (var i = 0; i < Lightbox.slideIdCount; i++) {
1479        window.clearTimeout(Lightbox.slideIdArray[i]);
1480      }
1481    }
1482    $('#' + hideId).hide();
1483    $('#' + showId).show();
1484
1485    if (hideId == "lightshowPlay") {
1486      Lightbox.isPaused = false;
1487      if (!Lightbox.loopSlides && Lightbox.activeImage == (Lightbox.total - 1)) {
1488        Lightbox.end();
1489      }
1490      else if (Lightbox.total > 1) {
1491        Lightbox.changeData(Lightbox.activeImage + 1);
1492      }
1493    }
1494    else {
1495      Lightbox.isPaused = true;
1496    }
1497  },
1498
1499  triggerLightbox: function (rel_type, rel_group) {
1500    if (rel_type.length) {
1501      if (rel_group && rel_group.length) {
1502        $("a[rel^='" + rel_type +"\[" + rel_group + "\]'], area[rel^='" + rel_type +"\[" + rel_group + "\]']").eq(0).trigger("click");
1503      }
1504      else {
1505        $("a[rel^='" + rel_type +"'], area[rel^='" + rel_type +"']").eq(0).trigger("click");
1506      }
1507    }
1508  },
1509
1510  detectMacFF2: function() {
1511    var ua = navigator.userAgent.toLowerCase();
1512    if (/firefox[\/\s](\d+\.\d+)/.test(ua)) {
1513      var ffversion = new Number(RegExp.$1);
1514      if (ffversion < 3 && ua.indexOf('mac') != -1) {
1515        return true;
1516      }
1517    }
1518    return false;
1519  },
1520
1521  checkKey: function(keys, key, code) {
1522    return (jQuery.inArray(key, keys) != -1 || jQuery.inArray(String(code), keys) != -1);
1523  },
1524
1525  filterXSS: function(str, allowed_tags) {
1526    var output = "";
1527    var prefix = Drupal.settings.pathPrefix;
1528    if (!prefix) prefix = '';
1529    $.ajax({
1530      url: Drupal.settings.basePath + prefix + '?q=system/lightbox2/filter-xss',
1531      data: {
1532        'string' : str,
1533        'allowed_tags' : allowed_tags
1534      },
1535      type: "POST",
1536      async: false,
1537      dataType:  "json",
1538      success: function(data) {
1539        output = data;
1540      }
1541    });
1542    return output;
1543  }
1544
1545};
1546
1547// Initialize the lightbox.
1548Drupal.behaviors.initLightbox = {
1549  attach: function(context) {
1550
1551  $('body:not(.lightbox-processed)', context).addClass('lightbox-processed').each(function() {
1552    Lightbox.initialize();
1553    return false; // Break the each loop.
1554  });
1555
1556  // Attach lightbox to any links with lightbox rels.
1557  Lightbox.initList(context);
1558  $('#lightboxAutoModal', context).triggerHandler('click');
1559  }
1560};
1561})(jQuery);
1562;/**/
1563(function(c,q){var m="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";c.fn.imagesLoaded=function(f){function n(){var b=c(j),a=c(h);d&&(h.length?d.reject(e,b,a):d.resolve(e));c.isFunction(f)&&f.call(g,e,b,a)}function p(b){k(b.target,"error"===b.type)}function k(b,a){b.src===m||-1!==c.inArray(b,l)||(l.push(b),a?h.push(b):j.push(b),c.data(b,"imagesLoaded",{isBroken:a,src:b.src}),r&&d.notifyWith(c(b),[a,e,c(j),c(h)]),e.length===l.length&&(setTimeout(n),e.unbind(".imagesLoaded",
1564p)))}var g=this,d=c.isFunction(c.Deferred)?c.Deferred():0,r=c.isFunction(d.notify),e=g.find("img").add(g.filter("img")),l=[],j=[],h=[];c.isPlainObject(f)&&c.each(f,function(b,a){if("callback"===b)f=a;else if(d)d[b](a)});e.length?e.bind("load.imagesLoaded error.imagesLoaded",p).each(function(b,a){var d=a.src,e=c.data(a,"imagesLoaded");if(e&&e.src===d)k(a,e.isBroken);else if(a.complete&&a.naturalWidth!==q)k(a,0===a.naturalWidth||0===a.naturalHeight);else if(a.readyState||a.complete)a.src=m,a.src=d}):
1565n();return d?d.promise(g):g}})(jQuery);
1566;/**/
1567Drupal.TBMegaMenu = Drupal.TBMegaMenu || {};
1568
1569(function ($) {
1570  Drupal.TBMegaMenu.oldWindowWidth = 0;
1571  Drupal.TBMegaMenu.displayedMenuMobile = false;
1572  Drupal.TBMegaMenu.supportedScreens = [2];
1573  Drupal.TBMegaMenu.menuResponsive = function () {
1574    var windowWidth = window.innerWidth ? window.innerWidth : $(window).width();
1575    var navCollapse = $('.tb-megamenu').children('.nav-collapse');
1576    if (windowWidth < Drupal.TBMegaMenu.supportedScreens[0]) {
1577      navCollapse.addClass('collapse');
1578      if (Drupal.TBMegaMenu.displayedMenuMobile) {
1579        navCollapse.css({height: 'auto', overflow: 'visible'});
1580      } else {
1581        navCollapse.css({height: 0, overflow: 'hidden'});
1582      }
1583    } else {
1584      // If width of window is greater than 980 (supported screen).
1585      navCollapse.removeClass('collapse');
1586      if (navCollapse.height() <= 0) {
1587        navCollapse.css({height: 'auto', overflow: 'visible'});
1588      }
1589    }
1590  };
1591  
1592  Drupal.behaviors.tbMegaMenuAction = {
1593    attach: function(context) {
1594      $('.tb-megamenu-button', context).once('menuIstance', function () {
1595        var This = this;
1596        $(This).click(function() {
1597          if(parseInt($(this).parent().children('.nav-collapse').height())) {
1598            $(this).parent().children('.nav-collapse').css({height: 0, overflow: 'hidden'});
1599            Drupal.TBMegaMenu.displayedMenuMobile = false;
1600          }
1601          else {
1602            $(this).parent().children('.nav-collapse').css({height: 'auto', overflow: 'visible'});
1603            Drupal.TBMegaMenu.displayedMenuMobile = true;
1604          }
1605        });
1606      });
1607      
1608      
1609      var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion);
1610      if(!isTouch){
1611        $(document).ready(function($){
1612          var mm_duration = 0;
1613          $('.tb-megamenu').each (function(){
1614            if ($(this).data('duration')) {
1615              mm_duration = $(this).data('duration');
1616            }
1617          });
1618          var mm_timeout = mm_duration ? 100 + mm_duration : 500;
1619          $('.nav > li, li.mega').hover(function(event) {
1620            var $this = $(this);
1621            if ($this.hasClass ('mega')) {
1622              $this.addClass ('animating');
1623              clearTimeout ($this.data('animatingTimeout'));
1624              $this.data('animatingTimeout', setTimeout(function(){$this.removeClass ('animating')}, mm_timeout));
1625              clearTimeout ($this.data('hoverTimeout'));
1626              $this.data('hoverTimeout', setTimeout(function(){$this.addClass ('open')}, 100));  
1627            } else {
1628              clearTimeout ($this.data('hoverTimeout'));
1629              $this.data('hoverTimeout', 
1630              setTimeout(function(){$this.addClass ('open')}, 100));
1631            }
1632          },
1633          function(event) {
1634            var $this = $(this);
1635            if ($this.hasClass ('mega')) {
1636              $this.addClass ('animating');
1637              clearTimeout ($this.data('animatingTimeout'));
1638              $this.data('animatingTimeout', 
1639              setTimeout(function(){$this.removeClass ('animating')}, mm_timeout));
1640              clearTimeout ($this.data('hoverTimeout'));
1641              $this.data('hoverTimeout', setTimeout(function(){$this.removeClass ('open')}, 100));
1642            } else {
1643              clearTimeout ($this.data('hoverTimeout'));
1644              $this.data('hoverTimeout', 
1645              setTimeout(function(){$this.removeClass ('open')}, 100));
1646            }
1647          });
1648        });
1649      }
1650      
1651      $(window).resize(function() {
1652        var windowWidth = window.innerWidth ? window.innerWidth : $(window).width();
1653        if(windowWidth != Drupal.TBMegaMenu.oldWindowWidth){
1654          Drupal.TBMegaMenu.oldWindowWidth = windowWidth;
1655          Drupal.TBMegaMenu.menuResponsive();
1656        }
1657      });
1658    },
1659  }
1660})(jQuery);
1661
1662;/**/
1663Drupal.TBMegaMenu = Drupal.TBMegaMenu || {};
1664
1665(function ($) {
1666  Drupal.TBMegaMenu.createTouchMenu = function(items) {
1667      items.children('a').each( function() {
1668	var $item = $(this);
1669        var tbitem = $(this).parent();
1670        $item.click( function(event){
1671          if ($item.hasClass('tb-megamenu-clicked')) {
1672            var $uri = $item.attr('href');
1673            window.location.href = $uri;
1674          }
1675          else {
1676            event.preventDefault();
1677            $item.addClass('tb-megamenu-clicked');
1678            if(!tbitem.hasClass('open')){	
1679              tbitem.addClass('open');
1680            }
1681          }
1682        }).closest('li').mouseleave( function(){
1683          $item.removeClass('tb-megamenu-clicked');
1684          tbitem.removeClass('open');
1685        });
1686     });
1687     /*
1688     items.children('a').children('span.caret').each( function() {
1689	var $item = $(this).parent();
1690        $item.click(function(event){
1691          tbitem = $item.parent();
1692          if ($item.hasClass('tb-megamenu-clicked')) {
1693            Drupal.TBMegaMenu.eventStopPropagation(event);
1694            if(tbitem.hasClass('open')){	
1695              tbitem.removeClass('open');
1696              $item.removeClass('tb-megamenu-clicked');
1697            }
1698          }
1699          else {
1700            Drupal.TBMegaMenu.eventStopPropagation(event);
1701            $item.addClass('tb-megamenu-clicked');
1702            if(!tbitem.hasClass('open')){	
1703              tbitem.addClass('open');
1704              $item.removeClass('tb-megamenu-clicked');
1705            }
1706          }
1707        });
1708     });
1709     */
1710  }
1711  
1712  Drupal.TBMegaMenu.eventStopPropagation = function(event) {
1713    if (event.stopPropagation) {
1714      event.stopPropagation();
1715    }
1716    else if (window.event) {
1717      window.event.cancelBubble = true;
1718    }
1719  }  
1720  Drupal.behaviors.tbMegaMenuTouchAction = {
1721    attach: function(context) {
1722      var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion);
1723      if(isTouch){
1724        $('html').addClass('touch');
1725        Drupal.TBMegaMenu.createTouchMenu($('.tb-megamenu ul.nav li.mega').has('.dropdown-menu'));
1726      }
1727    }
1728  }
1729})(jQuery);
1730;/**/
1731(function ($) {
1732
1733Drupal.googleanalytics = {};
1734
1735$(document).ready(function() {
1736
1737  // Attach mousedown, keyup, touchstart events to document only and catch
1738  // clicks on all elements.
1739  $(document.body).bind("mousedown keyup touchstart", function(event) {
1740
1741    // Catch the closest surrounding link of a clicked element.
1742    $(event.target).closest("a,area").each(function() {
1743
1744      // Is the clicked URL internal?
1745      if (Drupal.googleanalytics.isInternal(this.href)) {
1746        // Skip 'click' tracking, if custom tracking events are bound.
1747        if ($(this).is('.colorbox') && (Drupal.settings.googleanalytics.trackColorbox)) {
1748          // Do nothing here. The custom event will handle all tracking.
1749          //console.info("Click on .colorbox item has been detected.");
1750        }
1751        // Is download tracking activated and the file extension configured for download tracking?
1752        else if (Drupal.settings.googleanalytics.trackDownload && Drupal.googleanalytics.isDownload(this.href)) {
1753          // Download link clicked.
1754          ga("send", {
1755            "hitType": "event",
1756            "eventCategory": "Downloads",
1757            "eventAction": Drupal.googleanalytics.getDownloadExtension(this.href).toUpperCase(),
1758            "eventLabel": Drupal.googleanalytics.getPageUrl(this.href),
1759            "transport": "beacon"
1760          });
1761        }
1762        else if (Drupal.googleanalytics.isInternalSpecial(this.href)) {
1763          // Keep the internal URL for Google Analytics website overlay intact.
1764          ga("send", {
1765            "hitType": "pageview",
1766            "page": Drupal.googleanalytics.getPageUrl(this.href),
1767            "transport": "beacon"
1768          });
1769        }
1770      }
1771      else {
1772        if (Drupal.settings.googleanalytics.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) {
1773          // Mailto link clicked.
1774          ga("send", {
1775            "hitType": "event",
1776            "eventCategory": "Mails",
1777            "eventAction": "Click",
1778            "eventLabel": this.href.substring(7),
1779            "transport": "beacon"
1780          });
1781        }
1782        else if (Drupal.settings.googleanalytics.trackOutbound && this.href.match(/^\w+:\/\//i)) {
1783          if (Drupal.settings.googleanalytics.trackDomainMode !== 2 || (Drupal.settings.googleanalytics.trackDomainMode === 2 && !Drupal.googleanalytics.isCrossDomain(this.hostname, Drupal.settings.googleanalytics.trackCrossDomains))) {
1784            // External link clicked / No top-level cross domain clicked.
1785            ga("send", {
1786              "hitType": "event",
1787              "eventCategory": "Outbound links",
1788              "eventAction": "Click",
1789              "eventLabel": this.href,
1790              "transport": "beacon"
1791            });
1792          }
1793        }
1794      }
1795    });
1796  });
1797
1798  // Track hash changes as unique pageviews, if this option has been enabled.
1799  if (Drupal.settings.googleanalytics.trackUrlFragments) {
1800    window.onhashchange = function() {
1801      ga("send", {
1802        "hitType": "pageview",
1803        "page": location.pathname + location.search + location.hash
1804      });
1805    };
1806  }
1807
1808  // Colorbox: This event triggers when the transition has completed and the
1809  // newly loaded content has been revealed.
1810  if (Drupal.settings.googleanalytics.trackColorbox) {
1811    $(document).bind("cbox_complete", function () {
1812      var href = $.colorbox.element().attr("href");
1813      if (href) {
1814        ga("send", {
1815          "hitType": "pageview",
1816          "page": Drupal.googleanalytics.getPageUrl(href)
1817        });
1818      }
1819    });
1820  }
1821
1822});
1823
1824/**
1825 * Check whether the hostname is part of the cross domains or not.
1826 *
1827 * @param string hostname
1828 *   The hostname of the clicked URL.
1829 * @param array crossDomains
1830 *   All cross domain hostnames as JS array.
1831 *
1832 * @return boolean
1833 */
1834Drupal.googleanalytics.isCrossDomain = function (hostname, crossDomains) {
1835  /**
1836   * jQuery < 1.6.3 bug: $.inArray crushes IE6 and Chrome if second argument is
1837   * `null` or `undefined`, https://bugs.jquery.com/ticket/10076,
1838   * https://github.com/jquery/jquery/commit/a839af034db2bd934e4d4fa6758a3fed8de74174
1839   *
1840   * @todo: Remove/Refactor in D8
1841   */
1842  if (!crossDomains) {
1843    return false;
1844  }
1845  else {
1846    return $.inArray(hostname, crossDomains) > -1 ? true : false;
1847  }
1848};
1849
1850/**
1851 * Check whether this is a download URL or not.
1852 *
1853 * @param string url
1854 *   The web url to check.
1855 *
1856 * @return boolean
1857 */
1858Drupal.googleanalytics.isDownload = function (url) {
1859  var isDownload = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i");
1860  return isDownload.test(url);
1861};
1862
1863/**
1864 * Check whether this is an absolute internal URL or not.
1865 *
1866 * @param string url
1867 *   The web url to check.
1868 *
1869 * @return boolean
1870 */
1871Drupal.googleanalytics.isInternal = function (url) {
1872  var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i");
1873  return isInternal.test(url);
1874};
1875
1876/**
1877 * Check whether this is a special URL or not.
1878 *
1879 * URL types:
1880 *  - gotwo.module /go/* links.
1881 *
1882 * @param string url
1883 *   The web url to check.
1884 *
1885 * @return boolean
1886 */
1887Drupal.googleanalytics.isInternalSpecial = function (url) {
1888  var isInternalSpecial = new RegExp("(\/go\/.*)$", "i");
1889  return isInternalSpecial.test(url);
1890};
1891
1892/**
1893 * Extract the relative internal URL from an absolute internal URL.
1894 *
1895 * Examples:
1896 * - https://mydomain.com/node/1 -> /node/1
1897 * - https://example.com/foo/bar -> https://example.com/foo/bar
1898 *
1899 * @param string url
1900 *   The web url to check.
1901 *
1902 * @return string
1903 *   Internal website URL
1904 */
1905Drupal.googleanalytics.getPageUrl = function (url) {
1906  var extractInternalUrl = new RegExp("^(https?):\/\/" + window.location.host, "i");
1907  return url.replace(extractInternalUrl, '');
1908};
1909
1910/**
1911 * Extract the download file extension from the URL.
1912 *
1913 * @param string url
1914 *   The web url to check.
1915 *
1916 * @return string
1917 *   The file extension of the passed url. e.g. "zip", "txt"
1918 */
1919Drupal.googleanalytics.getDownloadExtension = function (url) {
1920  var extractDownloadextension = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i");
1921  var extension = extractDownloadextension.exec(url);
1922  return (extension === null) ? '' : extension[1];
1923};
1924
1925})(jQuery);
1926;/**/

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.