/*! colorbox v1.4.27 - 2013-07-16 jquery lightbox and modal window plugin (c) 2013 jack moore - http://www.jacklmoore.com/colorbox license: http://www.opensource.org/licenses/mit-license.php */ (function ($, document, window) { var // default settings object. // see http://jacklmoore.com/colorbox for details. defaults = { transition: "elastic", speed: 300, fadeout: 300, width: false, initialwidth: "600", innerwidth: false, maxwidth: false, height: false, initialheight: "450", innerheight: false, maxheight: false, scalephotos: true, scrolling: true, inline: false, html: false, iframe: false, fastiframe: true, photo: false, href: false, title: false, rel: false, opacity: 0.9, preloading: true, classname: false, // alternate image paths for high-res displays retinaimage: false, retinaurl: false, retinasuffix: '@2x.$1', // internationalization current: "image {current} of {total}", previous: "previous", next: "next", close: "close", xhrerror: "this content failed to load.", imgerror: "this image failed to load.", open: false, returnfocus: true, trapfocus: true, reposition: true, loop: true, slideshow: false, slideshowauto: true, slideshowspeed: 2500, slideshowstart: "start slideshow", slideshowstop: "stop slideshow", photoregex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp)((#|\?).*)?$/i, onopen: false, onload: false, oncomplete: false, oncleanup: false, onclosed: false, overlayclose: true, esckey: true, arrowkey: true, top: false, bottom: false, left: false, right: false, fixed: false, data: undefined, closebutton: true }, // abstracting the html and event identifiers for easy rebranding colorbox = 'colorbox', prefix = 'cbox', boxelement = prefix + 'element', // events event_open = prefix + '_open', event_load = prefix + '_load', event_complete = prefix + '_complete', event_cleanup = prefix + '_cleanup', event_closed = prefix + '_closed', event_purge = prefix + '_purge', // cached jquery object variables $overlay, $box, $wrap, $content, $topborder, $leftborder, $rightborder, $bottomborder, $related, $window, $loaded, $loadingbay, $loadingoverlay, $title, $current, $slideshow, $next, $prev, $close, $groupcontrols, $events = $(''), // variables for cached values or use across multiple functions settings, interfaceheight, interfacewidth, loadedheight, loadedwidth, element, index, photo, open, active, closing, loadingtimer, publicmethod, div = "div", classname, requests = 0, previouscss = {}, init; // **************** // helper functions // **************** // convenience function for creating new jquery objects function $tag(tag, id, css) { var element = document.createelement(tag); if (id) { element.id = prefix + id; } if (css) { element.style.csstext = css; } return $(element); } // get the window height using innerheight when available to avoid an issue with ios // http://bugs.jquery.com/ticket/6724 function winheight() { return window.innerheight ? window.innerheight : $(window).height(); } // determine the next and previous members in a group. function getindex(increment) { var max = $related.length, newindex = (index + increment) % max; return (newindex < 0) ? max + newindex : newindex; } // convert '%' and 'px' values to integers function setsize(size, dimension) { return math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseint(size, 10)); } // checks an href to see if it is a photo. // there is a force photo option (photo: true) for hrefs that cannot be matched by the regex. function isimage(settings, url) { return settings.photo || settings.photoregex.test(url); } function retinaurl(settings, url) { return settings.retinaurl && window.devicepixelratio > 1 ? url.replace(settings.photoregex, settings.retinasuffix) : url; } function trapfocus(e) { if ('contains' in $box[0] && !$box[0].contains(e.target)) { e.stoppropagation(); $box.focus(); } } // assigns function results to their respective properties function makesettings() { var i, data = $.data(element, colorbox); if (data == null) { settings = $.extend({}, defaults); if (console && console.log) { console.log('error: cboxelement missing settings object'); } } else { settings = $.extend({}, data); } for (i in settings) { if ($.isfunction(settings[i]) && i.slice(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time. settings[i] = settings[i].call(element); } } settings.rel = settings.rel || element.rel || $(element).data('rel') || 'nofollow'; settings.href = settings.href || $(element).attr('href'); settings.title = settings.title || element.title; if (typeof settings.href === "string") { settings.href = $.trim(settings.href); } } function trigger(event, callback) { // for external use $(document).trigger(event); // for internal use $events.trigger(event); if ($.isfunction(callback)) { callback.call(element); } } // slideshow functionality function slideshow() { var timeout, classname = prefix + "slideshow_", click = "click." + prefix, clear, set, start, stop; if (settings.slideshow && $related[1]) { clear = function () { cleartimeout(timeout); }; set = function () { if (settings.loop || $related[index + 1]) { timeout = settimeout(publicmethod.next, settings.slideshowspeed); } }; start = function () { $slideshow .html(settings.slideshowstop) .unbind(click) .one(click, stop); $events .bind(event_complete, set) .bind(event_load, clear) .bind(event_cleanup, stop); $box.removeclass(classname + "off").addclass(classname + "on"); }; stop = function () { clear(); $events .unbind(event_complete, set) .unbind(event_load, clear) .unbind(event_cleanup, stop); $slideshow .html(settings.slideshowstart) .unbind(click) .one(click, function () { publicmethod.next(); start(); }); $box.removeclass(classname + "on").addclass(classname + "off"); }; if (settings.slideshowauto) { start(); } else { stop(); } } else { $box.removeclass(classname + "off " + classname + "on"); } } function launch(target) { if (!closing) { element = target; makesettings(); $related = $(element); index = 0; if (settings.rel !== 'nofollow') { $related = $('.' + boxelement).filter(function () { var data = $.data(this, colorbox), relrelated; if (data) { relrelated = $(this).data('rel') || data.rel || this.rel; } return (relrelated === settings.rel); }); index = $related.index(element); // check direct calls to colorbox. if (index === -1) { $related = $related.add(element); index = $related.length - 1; } } $overlay.css({ opacity: parsefloat(settings.opacity), cursor: settings.overlayclose ? "pointer" : "auto", visibility: 'visible' }).show(); if (classname) { $box.add($overlay).removeclass(classname); } if (settings.classname) { $box.add($overlay).addclass(settings.classname); } classname = settings.classname; if (settings.closebutton) { $close.html(settings.close).appendto($content); } else { $close.appendto('
'); } if (!open) { open = active = true; // prevents the page-change action from queuing up if the visitor holds down the left or right keys. // show colorbox so the sizes can be calculated in older versions of jquery $box.css({visibility:'hidden', display:'block'}); $loaded = $tag(div, 'loadedcontent', 'width:0; height:0; overflow:hidden'); $content.css({width:'', height:''}).append($loaded); // cache values needed for size calculations interfaceheight = $topborder.height() + $bottomborder.height() + $content.outerheight(true) - $content.height(); interfacewidth = $leftborder.width() + $rightborder.width() + $content.outerwidth(true) - $content.width(); loadedheight = $loaded.outerheight(true); loadedwidth = $loaded.outerwidth(true); // opens inital empty colorbox prior to content being loaded. settings.w = setsize(settings.initialwidth, 'x'); settings.h = setsize(settings.initialheight, 'y'); publicmethod.position(); slideshow(); trigger(event_open, settings.onopen); $groupcontrols.add($title).hide(); $box.focus(); if (settings.trapfocus) { // confine focus to the modal // uses event capturing that is not supported in ie8- if (document.addeventlistener) { document.addeventlistener('focus', trapfocus, true); $events.one(event_closed, function () { document.removeeventlistener('focus', trapfocus, true); }); } } // return focus on closing if (settings.returnfocus) { $events.one(event_closed, function () { $(element).focus(); }); } } load(); } } // colorbox's markup needs to be added to the dom prior to being called // so that the browser will go ahead and load the css background images. function appendhtml() { if (!$box && document.body) { init = false; $window = $(window); $box = $tag(div).attr({ id: colorbox, 'class': $.support.opacity === false ? prefix + 'ie' : '', // class for optional ie8 & lower targeted css. role: 'dialog', tabindex: '-1' }).hide(); $overlay = $tag(div, "overlay").hide(); $loadingoverlay = $([$tag(div, "loadingoverlay")[0],$tag(div, "loadinggraphic")[0]]); $wrap = $tag(div, "wrapper"); $content = $tag(div, "content").append( $title = $tag(div, "title"), $current = $tag(div, "current"), $prev = $('