Drupal.locale = { 'pluralFormula': function ($n) { return Number(($n!=1)); }, 'strings': {"":{"An AJAX HTTP error occurred.":"Hubo un error HTTP AJAX.","HTTP Result Code: !status":"C\u00f3digo de Resultado HTTP: !status","An AJAX HTTP request terminated abnormally.":"Una solicitud HTTP de AJAX termin\u00f3 de manera anormal.","Debugging information follows.":"A continuaci\u00f3n se detalla la informaci\u00f3n de depuraci\u00f3n.","Path: !uri":"Ruta: !uri","StatusText: !statusText":"StatusText: !statusText","ResponseText: !responseText":"ResponseText: !responseText","ReadyState: !readyState":"ReadyState: !readyState","Loading":"Cargando","(active tab)":"(solapa activa)","Hide":"Ocultar","Show":"Mostrar","Select all rows in this table":"Seleccionar todas las filas de esta tabla","Deselect all rows in this table":"Quitar la selecci\u00f3n a todas las filas de esta tabla","Restricted to certain pages":"Restringido a algunas p\u00e1ginas","Autocomplete popup":"Ventana emergente con autocompletado","Searching for matches...":"Buscando coincidencias","Re-order rows by numerical weight instead of dragging.":"Reordenar las filas por peso num\u00e9rico en lugar de arrastrar.","Show row weights":"Mostrar pesos de la fila","Hide row weights":"Ocultar pesos de la fila","Drag to re-order":"Arrastre para reordenar","Changes made in this table will not be saved until the form is submitted.":"Los cambios realizados en esta tabla no se guardar\u00e1n hasta que se env\u00ede el formulario","@title dialog":"Di\u00e1logo @title","Show shortcuts":"Mostrar atajos","Hide shortcuts":"Ocultar atajos","Not restricted":"Sin restricci\u00f3n","Not customizable":"No personalizable","The changes to these blocks will not be saved until the \u003Cem\u003ESave blocks\u003C\/em\u003E button is clicked.":"Los cambios sobre estos bloques no se guardar\u00e1n hasta que no pulse el bot\u00f3n \u003Cem\u003EGuardar bloques\u003C\/em\u003E.","The block cannot be placed in this region.":"El bloque no se puede colocar en esta regi\u00f3n.","Please wait...":"Espere, por favor...","Add":"Agregar","Remove group":"Eliminar grupo","Apply (all displays)":"Aplicar (todas las presentaciones)","Revert to default":"Volver al valor inicial","Apply (this display)":"Aplicar (esta presentaci\u00f3n)","Edit":"Editar","Requires a title":"Necesita un t\u00edtulo","Not published":"No publicado","Don\u0027t display post information":"No mostrar informaci\u00f3n del env\u00edo","The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.":"El archivo seleccionado %filename no puede ser subido. Solo se permiten archivos con las siguientes extensiones: %extensions.","This permission is inherited from the authenticated user role.":"Este permiso se hereda del rol de usuario registrado.","Hide summary":"Ocultar resumen","Edit summary":"Editar resumen","New revision":"Nueva revisi\u00f3n","No revision":"Sin revisi\u00f3n","By @name on @date":"Por @name en @date","By @name":"Por @name","Alias: @alias":"Alias: @alias","No alias":"Sin alias","Enabled":"Activado","Disabled":"Desactivado","Done":"Hecho","Prev":"Previo","Next":"Siguiente","Today":"Hoy","January":"Enero","February":"Febrero","March":"Marzo","April":"Abril","May":"Mayo","June":"Junio","July":"Julio","August":"Agosto","September":"Septiembre","October":"Octubre","November":"Noviembre","December":"Diciembre","Jan":"Ene","Feb":"Feb","Mar":"Mar","Apr":"Abr","Jun":"Jun","Jul":"Jul","Aug":"Ago","Sep":"Sep","Oct":"Oct","Nov":"Nov","Dec":"Dic","Sunday":"Domingo","Monday":"Lunes","Tuesday":"Martes","Wednesday":"Mi\u00e9rcoles","Thursday":"Jueves","Friday":"Viernes","Saturday":"S\u00e1bado","Sun":"Dom","Mon":"Lun","Tue":"Mar","Wed":"Mi\u00e9","Thu":"Jue","Fri":"Vie","Sat":"S\u00e1b","Su":"Do","Mo":"Lu","Tu":"Ma","We":"Mi","Th":"Ju","Fr":"Vi","Sa":"Sa","mm\/dd\/yy":"mm\/dd\/yy","Not in menu":"No est\u00e1 en un men\u00fa","Select files":"Seleccionar los archivos","Filename":"Nombre de archivo","Status":"Estado","Size":"Tama\u00f1o","Add files":"Agregar archivos","Stop current upload":"Detener la carga actual","N\/A":"N\/D","Drag files here.":"Arrastre los archivos aqu\u00ed.","File extension error.":"Error de extension de archivo.","File size error.":"Error del tama\u00f1o de archivo.","Security error.":"Error de seguridad.","Generic error.":"Error gen\u00e9rico.","Start upload":"Comenzar carga","Stop upload":"Detener la carga","%d files queued":"%d archivos en cola","Close":"Cerrar","Please wait while your files are being uploaded.":"Por favor espere mientras sus archivos est\u00e1n siendo cargados.","Ok":"Ok","This field is required.":"Este campo es obligatorio.","None":"Ninguno","Show description":"Mostrar descripci\u00f3n","Hide description":"Esconder descripci\u00f3n","Select":"Seleccionar","Add file":"Agregar archivo","none":"ninguno","OK":"OK","Flag translations as outdated":"Marcar traducciones como desactualizadas","@number comments per page":"@number comentarios por p\u00e1gina","all":"todo","Available tokens":"Comodines disponibles","Insert this token into your form":"Inserte este comod\u00edn en su formulario","Loading token browser...":"Cargando navegador de comodines...","Automatic alias":"Alias autom\u00e1tico","Inclusion: @value":"Inclusi\u00f3n: @value","Priority: @value":"Prioridad: @value","No redirects":"Sin redirecciones","1 redirect":"1 redirecci\u00f3n","@count redirects":"@count redirecciones","Translatable":"Traducible","Not translatable":"No traducible","Restricted to certain languages":"Restringido a ciertos idiomas","Also allow !name role to !permission?":"\u00bfTambi\u00e9n permitir al rol !name el permiso !permission?","CustomMessage: !customMessage":"CustomMessage: !customMessage","The response failed verification so will not be processed.":"La respuesta de verificaci\u00f3n fall\u00f3 por lo que no ser\u00e1 procesado.","The callback URL is not local and not trusted: !url":"La URL de llamada no es local y no es confiable: !url","Weight: !weight":"Peso: !weight","Needs to be updated":"Necesita ser actualizado","Does not need to be updated":"No necesita ser actualizado","List additional actions":"Lista adicional de acciones"}} };;
/*!
Colorbox 1.6.0
license: MIT
http://www.jacklmoore.com/colorbox
*/
(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=(A+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 y[0]&&!y[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),y.focus())}function c(t){c.str!==t&&(y.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){A=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),A=W.index(_.el),-1===A&&(W=W.add(_.el),A=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(Y),_=new r(i,o),g(_.get("rel")),!$){$=q=!0,c(_.get("className")),y.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),j=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),N=I.outerHeight(!0),z=I.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)-z-D,_.h=(f!==!1?Math.min(s,a(f,"y")):s)-N-j,I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(S).hide(),y.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()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("
").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=_.get("createImg"),t(U).addClass(Z+"Photo").bind("error",function(){h(n(se,"Error").html(_.get("imgError")))}).one("load",function(){d===le&&setTimeout(function(){var t;_.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*t,U.width-=U.width*t},_.mw&&U.width>_.mw&&(t=(U.width-_.mw)/U.width,o()),_.mh&&U.height>_.mh&&(t=(U.height-_.mh)/U.height,o())),_.h&&(U.style.marginTop=Math.max(_.mh-U.height,0)/2+"px"),W[1]&&(_.get("loop")||W[A+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&&L.load(e,_.get("data"),function(e,i){d===le&&h("error"===i?n(se,"Error").html(_.get("xhrError")):t(this).contents())})}var v,y,x,b,T,C,H,k,W,E,I,L,M,S,F,R,K,P,B,O,_,j,D,N,z,A,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},createImg:function(){var e=new Image,i=t(this).data("cbox-img-attrs");return"object"==typeof i&&t.each(i,function(t,i){e[t]=i}),e},createIframe:function(){var i=e.createElement("iframe"),n=t(this).data("cbox-iframe-attrs");return"object"==typeof n&&t.each(n,function(t,e){i[t]=e}),"frameBorder"in i&&(i.frameBorder=0),"allowTransparency"in i&&(i.allowTransparency="true"),i.name=(new Date).getTime(),i.allowFullScreen=!0,i}},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(""),se="div",le=0,de={},ce=function(){function t(){clearTimeout(h)}function e(){(_.get("loop")||W[A+1])&&(t(),h=setTimeout(J.next,_.get("slideshowSpeed")))}function i(){R.html(_.get("slideshowStop")).unbind(s).one(s,n),ae.bind(ne,e).bind(ie,t),y.removeClass(a+"off").addClass(a+"on")}function n(){t(),ae.unbind(ne,e).unbind(ie,t),R.html(_.get("slideshowStart")).unbind(s).one(s,function(){J.next(),i()}),y.removeClass(a+"on").addClass(a+"off")}function o(){r=!1,R.hide(),t(),ae.unbind(ne,e).unbind(ie,t),y.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(),R.show())}}();t[Y]||(t(p),J=t.fn[Y]=t[Y]=function(e,i){var n,o=this;return e=e||{},t.isFunction(o)&&(o=t(""),e.open=!0),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(y[0].style.width,10)-D+"px",b[0].style.height=C[0].style.height=H[0].style.height=parseInt(y[0].style.height,10)-j+"px"}var r,h,s,l=0,d=0,c=y.offset();if(E.unbind("resize."+Z),y.css({top:-9e4,left:-9e4}),h=E.scrollTop(),s=E.scrollLeft(),_.get("fixed")?(c.top-=h,c.left-=s,y.css({position:"fixed"})):(l=h,d=s,y.css({position:"absolute"})),d+=_.get("right")!==!1?Math.max(E.width()-_.w-z-D-a(_.get("right"),"x"),0):_.get("left")!==!1?a(_.get("left"),"x"):Math.round(Math.max(E.width()-_.w-z-D,0)/2),l+=_.get("bottom")!==!1?Math.max(o()-_.h-N-j-a(_.get("bottom"),"y"),0):_.get("top")!==!1?a(_.get("top"),"y"):Math.round(Math.max(o()-_.h-N-j,0)/2),y.css({top:c.top,left:c.left,visibility:"visible"}),x[0].style.width=x[0].style.height="9999px",r={width:_.w+z+D,height:_.h+N+j,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||y.css(r),y.dequeue().animate(r,{duration:e||0,complete:function(){n(),q=!1,x[0].style.width=_.w+z+D+"px",x[0].style.height=_.h+N+j+"px",_.get("reposition")&&setTimeout(function(){E.bind("resize."+Z,J.position)},1),t.isFunction(i)&&i()},step:n})},J.resize=function(t){var e;$&&(t=t||{},t.width&&(_.w=a(t.width,"x")-z-D),t.innerWidth&&(_.w=a(t.innerWidth,"x")),I.css({width:_.w}),t.height&&(_.h=a(t.height,"y")-N-j),t.innerHeight&&(_.h=a(t.innerHeight,"y")),t.innerHeight||t.height||(e=I.scrollTop(),I.css({height:"auto"}),_.h=I.height()),I.css({height:_.h}),e&&I.scrollTop(e),J.position("none"===_.get("transition")?0:_.get("speed")))},J.prep=function(i){function o(){return _.w=_.w||I.width(),_.w=_.mw&&_.mw<_.w?_.mw:_.w,_.w}function a(){return _.h=_.h||I.height(),_.h=_.mh&&_.mh<_.h?_.mh:_.h,_.h}if($){var d,g="none"===_.get("transition")?0:_.get("speed");I.remove(),I=n(se,"LoadedContent").append(i),I.hide().appendTo(L.show()).css({width:o(),overflow:_.get("scrolling")?"auto":"hidden"}).css({height:a()}).prependTo(b),L.hide(),t(U).css({"float":"none"}),c(_.get("className")),d=function(){function i(){t.support.opacity===!1&&y[0].style.removeAttribute("filter")}var n,o,a=W.length;$&&(o=function(){clearTimeout(Q),M.hide(),u(ne),_.get("onComplete")},S.html(_.get("title")).show(),I.show(),a>1?("string"==typeof _.get("current")&&F.html(_.get("current").replace("{current}",A+1).replace("{total}",a)).show(),K[_.get("loop")||a-1>A?"show":"hide"]().html(_.get("next")),P[_.get("loop")||A?"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=_.get("createIframe"),_.get("scrolling")||(n.scrolling="no"),t(n).attr({src:_.get("href"),"class":Z+"Iframe"}).one("load",o).appendTo(I),ae.one(he,function(){n.src="//about:blank"}),_.get("fastIframe")&&t(n).trigger("load")):o(),"fade"===_.get("transition")?y.fadeTo(g,1,i):i())},"fade"===_.get("transition")?y.fadeTo(g,0,function(){J.position(0,d)}):J.position(g,d)}},J.next=function(){!q&&W[1]&&(_.get("loop")||W[A+1])&&(A=h(1),f(W[A]))},J.prev=function(){!q&&W[1]&&(_.get("loop")||A)&&(A=h(-1),f(W[A]))},J.close=function(){$&&!G&&(G=!0,$=!1,u(oe),_.get("onCleanup"),E.unbind("."+Z),v.fadeTo(_.get("fadeOut")||0,0),y.stop().fadeTo(_.get("fadeOut")||0,0,function(){y.hide(),v.hide(),u(he),I.remove(),setTimeout(function(){G=!1,u(re),_.get("onClosed")},1)}))},J.remove=function(){y&&(y.stop(),t[Y].close(),y.stop(!1,!0).remove(),v.remove(),G=!1,y=null,t("."+te).removeData(Y).removeClass(te),t(e).unbind("click."+Z).unbind("keydown."+Z))},J.element=function(){return t(_.el)},J.settings=X)})(jQuery,document,window);;
(function ($) {
Drupal.behaviors.initColorbox = {
attach: function (context, settings) {
if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') {
return;
}
if (settings.colorbox.mobiledetect && window.matchMedia) {
// Disable Colorbox for small screens.
var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")");
if (mq.matches) {
return;
}
}
$('.colorbox', context)
.once('init-colorbox')
.colorbox(settings.colorbox);
$(context).bind('cbox_complete', function () {
Drupal.attachBehaviors('#cboxLoadedContent');
});
}
};
})(jQuery);
;
(function ($) {
Drupal.behaviors.initColorboxStockholmsyndromeStyle = {
attach: function (context, settings) {
$(context).bind('cbox_open', function () {
// Hide close button initially.
$('#cboxClose', context).css('opacity', 0);
});
$(context).bind('cbox_load', function () {
// Hide close button. (It doesn't handle the load animation well.)
$('#cboxClose', context).css('opacity', 0);
});
$(context).bind('cbox_complete', function () {
// Show close button with a delay.
$('#cboxClose', context).fadeTo('fast', 0, function () {$(this).css('opacity', 1)});
});
}
};
})(jQuery);
;
(function ($) {
Drupal.behaviors.initColorboxLoad = {
attach: function (context, settings) {
if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') {
return;
}
$.urlParams = function (url) {
var p = {},
e,
a = /\+/g, // Regex for replacing addition symbol with a space
r = /([^&=]+)=?([^&]*)/g,
d = function (s) { return decodeURIComponent(s.replace(a, ' ')); },
q = url.split('?');
while (e = r.exec(q[1])) {
e[1] = d(e[1]);
e[2] = d(e[2]);
switch (e[2].toLowerCase()) {
case 'true':
case 'yes':
e[2] = true;
break;
case 'false':
case 'no':
e[2] = false;
break;
}
if (e[1] == 'width') { e[1] = 'innerWidth'; }
if (e[1] == 'height') { e[1] = 'innerHeight'; }
p[e[1]] = e[2];
}
return p;
};
$('.colorbox-load', context)
.once('init-colorbox-load', function () {
var params = $.urlParams($(this).attr('href'));
$(this).colorbox($.extend({}, settings.colorbox, params));
});
}
};
})(jQuery);
;
(function ($) {
Drupal.behaviors.initColorboxInline = {
attach: function (context, settings) {
if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') {
return;
}
$.urlParam = function(name, url){
if (name == 'fragment') {
var results = new RegExp('(#[^]*)').exec(url);
}
else {
var results = new RegExp('[\\?&]' + name + '=([^]*)').exec(url);
}
if (!results) { return ''; }
return results[1] || '';
};
$('.colorbox-inline', context).once('init-colorbox-inline').colorbox({
transition:settings.colorbox.transition,
speed:settings.colorbox.speed,
opacity:settings.colorbox.opacity,
slideshow:settings.colorbox.slideshow,
slideshowAuto:settings.colorbox.slideshowAuto,
slideshowSpeed:settings.colorbox.slideshowSpeed,
slideshowStart:settings.colorbox.slideshowStart,
slideshowStop:settings.colorbox.slideshowStop,
current:settings.colorbox.current,
previous:settings.colorbox.previous,
next:settings.colorbox.next,
close:settings.colorbox.close,
overlayClose:settings.colorbox.overlayClose,
maxWidth:settings.colorbox.maxWidth,
maxHeight:settings.colorbox.maxHeight,
innerWidth:function(){
return $.urlParam('width', $(this).attr('href'));
},
innerHeight:function(){
return $.urlParam('height', $(this).attr('href'));
},
title:function(){
return decodeURIComponent($.urlParam('title', $(this).attr('href')));
},
iframe:function(){
return $.urlParam('iframe', $(this).attr('href'));
},
inline:function(){
return $.urlParam('inline', $(this).attr('href'));
},
href:function(){
return $.urlParam('fragment', $(this).attr('href'));
}
});
}
};
})(jQuery);
;
/*! SWFObject v2.2
is released under the MIT License
*/
var audioplayer_swfobject = function() {
var UNDEF = "undefined",
OBJECT = "object",
SHOCKWAVE_FLASH = "Shockwave Flash",
SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
FLASH_MIME_TYPE = "application/x-shockwave-flash",
EXPRESS_INSTALL_ID = "SWFObjectExprInst",
ON_READY_STATE_CHANGE = "onreadystatechange",
win = window,
doc = document,
nav = navigator,
plugin = false,
domLoadFnArr = [main],
regObjArr = [],
objIdArr = [],
listenersArr = [],
storedAltContent,
storedAltContentId,
storedCallbackFn,
storedCallbackObj,
isDomLoaded = false,
isExpressInstallActive = false,
dynamicStylesheet,
dynamicStylesheetMedia,
autoHideShow = true,
/* Centralized function for browser feature detection
- User agent string detection is only used when no good alternative is possible
- Is executed directly for optimal performance
*/
ua = function() {
var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
u = nav.userAgent.toLowerCase(),
p = nav.platform.toLowerCase(),
windows = p ? /win/.test(p) : /win/.test(u),
mac = p ? /mac/.test(p) : /mac/.test(u),
webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
playerVersion = [0,0,0],
d = null;
if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
d = nav.plugins[SHOCKWAVE_FLASH].description;
if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
plugin = true;
ie = false; // cascaded feature detection for Internet Explorer
d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
}
}
else if (typeof win.ActiveXObject != UNDEF) {
try {
var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
if (a) { // a will return null when ActiveX is disabled
d = a.GetVariable("$version");
if (d) {
ie = true; // cascaded feature detection for Internet Explorer
d = d.split(" ")[1].split(",");
playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
}
}
}
catch(e) {}
}
return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
}(),
/* Cross-browser onDomLoad
- Will fire an event as soon as the DOM of a web page is loaded
- Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- Regular onload serves as fallback
*/
onDomLoad = function() {
if (!ua.w3) { return; }
if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
callDomLoadFunctions();
}
if (!isDomLoaded) {
if (typeof doc.addEventListener != UNDEF) {
doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
}
if (ua.ie && ua.win) {
doc.attachEvent(ON_READY_STATE_CHANGE, function() {
if (doc.readyState == "complete") {
doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
callDomLoadFunctions();
}
});
if (win == top) { // if not inside an iframe
(function(){
if (isDomLoaded) { return; }
try {
doc.documentElement.doScroll("left");
}
catch(e) {
setTimeout(arguments.callee, 0);
return;
}
callDomLoadFunctions();
})();
}
}
if (ua.wk) {
(function(){
if (isDomLoaded) { return; }
if (!/loaded|complete/.test(doc.readyState)) {
setTimeout(arguments.callee, 0);
return;
}
callDomLoadFunctions();
})();
}
addLoadEvent(callDomLoadFunctions);
}
}();
function callDomLoadFunctions() {
if (isDomLoaded) { return; }
try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
t.parentNode.removeChild(t);
}
catch (e) { return; }
isDomLoaded = true;
var dl = domLoadFnArr.length;
for (var i = 0; i < dl; i++) {
domLoadFnArr[i]();
}
}
function addDomLoadEvent(fn) {
if (isDomLoaded) {
fn();
}
else {
domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
}
}
/* Cross-browser onload
- Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- Will fire an event as soon as a web page including all of its assets are loaded
*/
function addLoadEvent(fn) {
if (typeof win.addEventListener != UNDEF) {
win.addEventListener("load", fn, false);
}
else if (typeof doc.addEventListener != UNDEF) {
doc.addEventListener("load", fn, false);
}
else if (typeof win.attachEvent != UNDEF) {
addListener(win, "onload", fn);
}
else if (typeof win.onload == "function") {
var fnOld = win.onload;
win.onload = function() {
fnOld();
fn();
};
}
else {
win.onload = fn;
}
}
/* Main function
- Will preferably execute onDomLoad, otherwise onload (as a fallback)
*/
function main() {
if (plugin) {
testPlayerVersion();
}
else {
matchVersions();
}
}
/* Detect the Flash Player version for non-Internet Explorer browsers
- Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
a. Both release and build numbers can be detected
b. Avoid wrong descriptions by corrupt installers provided by Adobe
c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
*/
function testPlayerVersion() {
var b = doc.getElementsByTagName("body")[0];
var o = createElement(OBJECT);
o.setAttribute("type", FLASH_MIME_TYPE);
var t = b.appendChild(o);
if (t) {
var counter = 0;
(function(){
if (typeof t.GetVariable != UNDEF) {
var d = t.GetVariable("$version");
if (d) {
d = d.split(" ")[1].split(",");
ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
}
}
else if (counter < 10) {
counter++;
setTimeout(arguments.callee, 10);
return;
}
b.removeChild(o);
t = null;
matchVersions();
})();
}
else {
matchVersions();
}
}
/* Perform Flash Player and SWF version matching; static publishing only
*/
function matchVersions() {
var rl = regObjArr.length;
if (rl > 0) {
for (var i = 0; i < rl; i++) { // for each registered object element
var id = regObjArr[i].id;
var cb = regObjArr[i].callbackFn;
var cbObj = {success:false, id:id};
if (ua.pv[0] > 0) {
var obj = getElementById(id);
if (obj) {
if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
setVisibility(id, true);
if (cb) {
cbObj.success = true;
cbObj.ref = getObjectById(id);
cb(cbObj);
}
}
else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
var att = {};
att.data = regObjArr[i].expressInstall;
att.width = obj.getAttribute("width") || "0";
att.height = obj.getAttribute("height") || "0";
if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
// parse HTML object param element's name-value pairs
var par = {};
var p = obj.getElementsByTagName("param");
var pl = p.length;
for (var j = 0; j < pl; j++) {
if (p[j].getAttribute("name").toLowerCase() != "movie") {
par[p[j].getAttribute("name")] = p[j].getAttribute("value");
}
}
showExpressInstall(att, par, id, cb);
}
else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
displayAltContent(obj);
if (cb) { cb(cbObj); }
}
}
}
else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
setVisibility(id, true);
if (cb) {
var o = getObjectById(id); // test whether there is an HTML object element or not
if (o && typeof o.SetVariable != UNDEF) {
cbObj.success = true;
cbObj.ref = o;
}
cb(cbObj);
}
}
}
}
}
function getObjectById(objectIdStr) {
var r = null;
var o = getElementById(objectIdStr);
if (o && o.nodeName == "OBJECT") {
if (typeof o.SetVariable != UNDEF) {
r = o;
}
else {
var n = o.getElementsByTagName(OBJECT)[0];
if (n) {
r = n;
}
}
}
return r;
}
/* Requirements for Adobe Express Install
- only one instance can be active at a time
- fp 6.0.65 or higher
- Win/Mac OS only
- no Webkit engines older than version 312
*/
function canExpressInstall() {
return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
}
/* Show the Adobe Express Install dialog
- Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
*/
function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
isExpressInstallActive = true;
storedCallbackFn = callbackFn || null;
storedCallbackObj = {success:false, id:replaceElemIdStr};
var obj = getElementById(replaceElemIdStr);
if (obj) {
if (obj.nodeName == "OBJECT") { // static publishing
storedAltContent = abstractAltContent(obj);
storedAltContentId = null;
}
else { // dynamic publishing
storedAltContent = obj;
storedAltContentId = replaceElemIdStr;
}
att.id = EXPRESS_INSTALL_ID;
if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
fv = "MMredirectURL=" + win.location.toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
if (typeof par.flashvars != UNDEF) {
par.flashvars += "&" + fv;
}
else {
par.flashvars = fv;
}
// IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
// because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
if (ua.ie && ua.win && obj.readyState != 4) {
var newObj = createElement("div");
replaceElemIdStr += "SWFObjectNew";
newObj.setAttribute("id", replaceElemIdStr);
obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
obj.parentNode.removeChild(obj);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
createSWF(att, par, replaceElemIdStr);
}
}
/* Functions to abstract and display alternative content
*/
function displayAltContent(obj) {
if (ua.ie && ua.win && obj.readyState != 4) {
// IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
// because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
var el = createElement("div");
obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
el.parentNode.replaceChild(abstractAltContent(obj), el);
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
obj.parentNode.removeChild(obj);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
else {
obj.parentNode.replaceChild(abstractAltContent(obj), obj);
}
}
function abstractAltContent(obj) {
var ac = createElement("div");
if (ua.win && ua.ie) {
ac.innerHTML = obj.innerHTML;
}
else {
var nestedObj = obj.getElementsByTagName(OBJECT)[0];
if (nestedObj) {
var c = nestedObj.childNodes;
if (c) {
var cl = c.length;
for (var i = 0; i < cl; i++) {
if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
ac.appendChild(c[i].cloneNode(true));
}
}
}
}
}
return ac;
}
/* Cross-browser dynamic SWF creation
*/
function createSWF(attObj, parObj, id) {
var r, el = getElementById(id);
if (ua.wk && ua.wk < 312) { return r; }
if (el) {
if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
attObj.id = id;
}
if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
var att = "";
for (var i in attObj) {
if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
if (i.toLowerCase() == "data") {
parObj.movie = attObj[i];
}
else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
att += ' class="' + attObj[i] + '"';
}
else if (i.toLowerCase() != "classid") {
att += ' ' + i + '="' + attObj[i] + '"';
}
}
}
var par = "";
for (var j in parObj) {
if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
par += '';
}
}
el.outerHTML = '';
objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
r = getElementById(attObj.id);
}
else { // well-behaving browsers
var o = createElement(OBJECT);
o.setAttribute("type", FLASH_MIME_TYPE);
for (var m in attObj) {
if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
o.setAttribute("class", attObj[m]);
}
else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
o.setAttribute(m, attObj[m]);
}
}
}
for (var n in parObj) {
if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
createObjParam(o, n, parObj[n]);
}
}
el.parentNode.replaceChild(o, el);
r = o;
}
}
return r;
}
function createObjParam(el, pName, pValue) {
var p = createElement("param");
p.setAttribute("name", pName);
p.setAttribute("value", pValue);
el.appendChild(p);
}
/* Cross-browser SWF removal
- Especially needed to safely and completely remove a SWF in Internet Explorer
*/
function removeSWF(id) {
var obj = getElementById(id);
if (obj && obj.nodeName == "OBJECT") {
if (ua.ie && ua.win) {
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
removeObjectInIE(id);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
else {
obj.parentNode.removeChild(obj);
}
}
}
function removeObjectInIE(id) {
var obj = getElementById(id);
if (obj) {
for (var i in obj) {
if (typeof obj[i] == "function") {
obj[i] = null;
}
}
obj.parentNode.removeChild(obj);
}
}
/* Functions to optimize JavaScript compression
*/
function getElementById(id) {
var el = null;
try {
el = doc.getElementById(id);
}
catch (e) {}
return el;
}
function createElement(el) {
return doc.createElement(el);
}
/* Updated attachEvent function for Internet Explorer
- Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
*/
function addListener(target, eventType, fn) {
target.attachEvent(eventType, fn);
listenersArr[listenersArr.length] = [target, eventType, fn];
}
/* Flash Player and SWF content version matching
*/
function hasPlayerVersion(rv) {
var pv = ua.pv, v = rv.split(".");
v[0] = parseInt(v[0], 10);
v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
v[2] = parseInt(v[2], 10) || 0;
return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
}
/* Cross-browser dynamic CSS creation
- Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
*/
function createCSS(sel, decl, media, newStyle) {
if (ua.ie && ua.mac) { return; }
var h = doc.getElementsByTagName("head")[0];
if (!h) { return; } // to also support badly authored HTML pages that lack a head element
var m = (media && typeof media == "string") ? media : "screen";
if (newStyle) {
dynamicStylesheet = null;
dynamicStylesheetMedia = null;
}
if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
// create dynamic stylesheet + get a global reference to it
var s = createElement("style");
s.setAttribute("type", "text/css");
s.setAttribute("media", m);
dynamicStylesheet = h.appendChild(s);
if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
}
dynamicStylesheetMedia = m;
}
// add style rule
if (ua.ie && ua.win) {
if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
dynamicStylesheet.addRule(sel, decl);
}
}
else {
if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
}
}
}
function setVisibility(id, isVisible) {
if (!autoHideShow) { return; }
var v = isVisible ? "visible" : "hidden";
if (isDomLoaded && getElementById(id)) {
getElementById(id).style.visibility = v;
}
else {
createCSS("#" + id, "visibility:" + v);
}
}
/* Filter to avoid XSS attacks
*/
function urlEncodeIfNecessary(s) {
var regex = /[\\\"<>\.;]/;
var hasBadChars = regex.exec(s) != null;
return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
}
/* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
*/
var cleanup = function() {
if (ua.ie && ua.win) {
window.attachEvent("onunload", function() {
// remove listeners to avoid memory leaks
var ll = listenersArr.length;
for (var i = 0; i < ll; i++) {
listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
}
// cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
var il = objIdArr.length;
for (var j = 0; j < il; j++) {
removeSWF(objIdArr[j]);
}
// cleanup library's main closures to avoid memory leaks
for (var k in ua) {
ua[k] = null;
}
ua = null;
for (var l in audioplayer_swfobject) {
audioplayer_swfobject[l] = null;
}
audioplayer_swfobject = null;
});
}
}();
return {
/* Public API
- Reference: http://code.google.com/p/swfobject/wiki/documentation
*/
registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
if (ua.w3 && objectIdStr && swfVersionStr) {
var regObj = {};
regObj.id = objectIdStr;
regObj.swfVersion = swfVersionStr;
regObj.expressInstall = xiSwfUrlStr;
regObj.callbackFn = callbackFn;
regObjArr[regObjArr.length] = regObj;
setVisibility(objectIdStr, false);
}
else if (callbackFn) {
callbackFn({success:false, id:objectIdStr});
}
},
getObjectById: function(objectIdStr) {
if (ua.w3) {
return getObjectById(objectIdStr);
}
},
embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
var callbackObj = {success:false, id:replaceElemIdStr};
if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
setVisibility(replaceElemIdStr, false);
addDomLoadEvent(function() {
widthStr += ""; // auto-convert to string
heightStr += "";
var att = {};
if (attObj && typeof attObj === OBJECT) {
for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
att[i] = attObj[i];
}
}
att.data = swfUrlStr;
att.width = widthStr;
att.height = heightStr;
var par = {};
if (parObj && typeof parObj === OBJECT) {
for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
par[j] = parObj[j];
}
}
if (flashvarsObj && typeof flashvarsObj === OBJECT) {
for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
if (typeof par.flashvars != UNDEF) {
par.flashvars += "&" + k + "=" + flashvarsObj[k];
}
else {
par.flashvars = k + "=" + flashvarsObj[k];
}
}
}
if (hasPlayerVersion(swfVersionStr)) { // create SWF
var obj = createSWF(att, par, replaceElemIdStr);
if (att.id == replaceElemIdStr) {
setVisibility(replaceElemIdStr, true);
}
callbackObj.success = true;
callbackObj.ref = obj;
}
else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
att.data = xiSwfUrlStr;
showExpressInstall(att, par, replaceElemIdStr, callbackFn);
return;
}
else { // show alternative content
setVisibility(replaceElemIdStr, true);
}
if (callbackFn) { callbackFn(callbackObj); }
});
}
else if (callbackFn) { callbackFn(callbackObj); }
},
switchOffAutoHideShow: function() {
autoHideShow = false;
},
ua: ua,
getFlashPlayerVersion: function() {
return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
},
hasFlashPlayerVersion: hasPlayerVersion,
createSWF: function(attObj, parObj, replaceElemIdStr) {
if (ua.w3) {
return createSWF(attObj, parObj, replaceElemIdStr);
}
else {
return undefined;
}
},
showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
if (ua.w3 && canExpressInstall()) {
showExpressInstall(att, par, replaceElemIdStr, callbackFn);
}
},
removeSWF: function(objElemIdStr) {
if (ua.w3) {
removeSWF(objElemIdStr);
}
},
createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
if (ua.w3) {
createCSS(selStr, declStr, mediaStr, newStyleBoolean);
}
},
addDomLoadEvent: addDomLoadEvent,
addLoadEvent: addLoadEvent,
getQueryParamValue: function(param) {
var q = doc.location.search || doc.location.hash;
if (q) {
if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
if (param == null) {
return urlEncodeIfNecessary(q);
}
var pairs = q.split("&");
for (var i = 0; i < pairs.length; i++) {
if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
}
}
}
return "";
},
// For internal usage only
expressInstallCallback: function() {
if (isExpressInstallActive) {
var obj = getElementById(EXPRESS_INSTALL_ID);
if (obj && storedAltContent) {
obj.parentNode.replaceChild(storedAltContent, obj);
if (storedAltContentId) {
setVisibility(storedAltContentId, true);
if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
}
if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
}
isExpressInstallActive = false;
}
}
};
}();
var AudioPlayer = function () {
var instances = [];
var groups = {};
var activePlayers = {};
var playerURL = "";
var defaultOptions = {};
var currentVolume = -1;
var requiredFlashVersion = "9";
function getPlayer(playerID) {
if (document.all && !window[playerID]) {
for (var i = 0; i < document.forms.length; i++) {
if (document.forms[i][playerID]) {
return document.forms[i][playerID];
break;
}
}
}
return document.all ? window[playerID] : document[playerID];
}
function addListener (playerID, type, func) {
getPlayer(playerID).addListener(type, func);
}
return {
setup: function (url, options) {
playerURL = url;
defaultOptions = options;
if (audioplayer_swfobject.hasFlashPlayerVersion(requiredFlashVersion)) {
audioplayer_swfobject.switchOffAutoHideShow();
audioplayer_swfobject.createCSS("p.audioplayer_container span", "visibility:hidden;height:24px;overflow:hidden;padding:0;border:none;");
}
},
getPlayer: function (playerID) {
return getPlayer(playerID);
},
addListener: function (playerID, type, func) {
addListener(playerID, type, func);
},
embed: function (elementID, options) {
var instanceOptions = {};
var key;
var flashParams = {};
var flashVars = {};
var flashAttributes = {};
// Merge default options and instance options
for (key in defaultOptions) {
instanceOptions[key] = defaultOptions[key];
}
for (key in options) {
instanceOptions[key] = options[key];
}
if (instanceOptions.transparentpagebg == "yes") {
flashParams.bgcolor = "#FFFFFF";
flashParams.wmode = "transparent";
} else {
if (instanceOptions.pagebg) {
flashParams.bgcolor = "#" + instanceOptions.pagebg;
}
flashParams.wmode = "opaque";
}
flashParams.menu = "false";
for (key in instanceOptions) {
if (key == "pagebg" || key == "width" || key == "transparentpagebg") {
continue;
}
flashVars[key] = instanceOptions[key];
}
flashAttributes.name = elementID;
flashAttributes.style = "outline: none";
flashVars.playerID = elementID;
audioplayer_swfobject.embedSWF(playerURL, elementID, instanceOptions.width.toString(), "24", requiredFlashVersion, false, flashVars, flashParams, flashAttributes);
instances.push(elementID);
if (options.group) {
groups[elementID] = options.group;
}
},
syncVolumes: function (playerID, volume) {
if (groups[playerID]) return;
currentVolume = volume;
for (var i = 0; i < instances.length; i++) {
if (!groups[instances[i]] && instances[i] != playerID) {
getPlayer(instances[i]).setVolume(currentVolume);
}
}
},
activate: function (playerID, info) {
for (var activePlayerID in activePlayers) {
if (activePlayerID == playerID) {
continue;
}
if (groups[playerID] != groups[activePlayerID]) {
this.close(activePlayerID);
continue;
}
if (!(groups[playerID] || groups[activePlayerID])) {
this.close(activePlayerID);
}
}
activePlayers[playerID] = 1;
},
load: function (playerID, soundFile, titles, artists) {
getPlayer(playerID).load(soundFile, titles, artists);
},
close: function (playerID) {
getPlayer(playerID).close();
if (playerID in activePlayers) {
delete activePlayers[playerID];
}
},
open: function (playerID, index) {
if (index == undefined) {
index = 1;
}
getPlayer(playerID).open(index == undefined ? 0 : index-1);
},
getVolume: function (playerID) {
return currentVolume;
}
}
}();
;
/**
* @file
* Adds some show/hide to the admin form to make the UXP easier.
*/
(function($){
Drupal.behaviors.video = {
attach: function (context, settings) {
//lets see if we have any jmedia movies
if($.fn.media) {
$('.jmedia').media();
}
if(settings.video) {
$.fn.media.defaults.flvPlayer = settings.video.flvplayer;
}
//lets setup our colorbox videos
$('.video-box').each(function() {
var url = $(this).attr('href');
var data = $(this).metadata();
var width = data.width;
var height= data.height;
var player = settings.video.player; //player can be either jwplayer or flowplayer.
$(this).colorbox({
html: '',
onComplete:function() {
if(player == 'flowplayer') {
flowplayer("video-overlay", settings.video.flvplayer, {
clip: {
autoPlay: settings.video.autoplay,
autoBuffering: settings.video.autobuffer
}
});
} else {
$('#video-overlay').media({
flashvars: {
autostart: settings.video.autoplay
},
width:width,
height:height
});
}
}
});
});
}
};
// On change of the thumbnails when edit.
Drupal.behaviors.videoEdit = {
attach : function(context, settings) {
function setThumbnail(widget, type) {
var thumbnails = widget.find('.video-thumbnails input');
var defaultthumbnail = widget.find('.video-use-default-video-thumb');
var largeimage = widget.find('.video-preview img');
var activeThumbnail = thumbnails.filter(':checked');
if (activeThumbnail.length > 0 && type != 'default') {
var smallimage = activeThumbnail.next('label.option').find('img');
largeimage.attr('src', smallimage.attr('src'));
defaultthumbnail.attr('checked', false);
}
else if(defaultthumbnail.is(':checked')) {
thumbnails.attr('checked', false);
largeimage.attr('src', defaultthumbnail.data('defaultimage'));
}
else {
// try to select the first thumbnail.
if (thumbnails.length > 0) {
thumbnails.first().attr('checked', 'checked');
setThumbnail(widget, 'thumb');
}
}
}
$('.video-thumbnails input', context).change(function() {
setThumbnail($(this).parents('.video-widget'), 'thumb');
});
$('.video-use-default-video-thumb', context).change(function() {
setThumbnail($(this).parents('.video-widget'), 'default');
});
$('.video-widget', context).each(function() {
setThumbnail($(this), 'both');
});
}
}
})(jQuery);
;
/**
* @file better_exposed_filters.js
*
* Provides some client-side functionality for the Better Exposed Filters module
*/
(function ($) {
Drupal.behaviors.betterExposedFilters = {
attach: function(context) {
// Add highlight class to checked checkboxes for better theming
$('.bef-tree input[type=checkbox], .bef-checkboxes input[type=checkbox]')
// Highlight newly selected checkboxes
.change(function() {
_bef_highlight(this, context);
})
.filter(':checked').closest('.form-item', context).addClass('highlight')
;
}
};
Drupal.behaviors.betterExposedFiltersSelectAllNone = {
attach: function(context) {
/*
* Add Select all/none links to specified checkboxes
*/
var selected = $('.form-checkboxes.bef-select-all-none:not(.bef-processed)');
if (selected.length) {
var selAll = Drupal.t('Select All');
var selNone = Drupal.t('Select None');
// Set up a prototype link and event handlers
var link = $(''+ selAll +'')
link.click(function(event) {
// Don't actually follow the link...
event.preventDefault();
event.stopPropagation();
if (selAll == $(this).text()) {
// Select all the checkboxes
$(this)
.html(selNone)
.siblings('.bef-checkboxes, .bef-tree')
.find('.form-item input:checkbox').each(function() {
$(this).attr('checked', true);
_bef_highlight(this, context);
})
.end()
// attr() doesn't trigger a change event, so we do it ourselves. But just on
// one checkbox otherwise we have many spinning cursors
.find('input[type=checkbox]:first').change()
;
}
else {
// Unselect all the checkboxes
$(this)
.html(selAll)
.siblings('.bef-checkboxes, .bef-tree')
.find('.form-item input:checkbox').each(function() {
$(this).attr('checked', false);
_bef_highlight(this, context);
})
.end()
// attr() doesn't trigger a change event, so we do it ourselves. But just on
// one checkbox otherwise we have many spinning cursors
.find('input[type=checkbox]:first').change()
;
}
});
// Add link to the page for each set of checkboxes.
selected
.addClass('bef-processed')
.each(function(index) {
// Clone the link prototype and insert into the DOM
var newLink = link.clone(true);
newLink.insertBefore($('.bef-checkboxes, .bef-tree', this));
// If all checkboxes are already checked by default then switch to Select None
if ($('input:checkbox:checked', this).length == $('input:checkbox', this).length) {
newLink.click();
}
})
;
}
// Check for and initialize datepickers
var befSettings = Drupal.settings.better_exposed_filters;
if (befSettings && befSettings.datepicker && befSettings.datepicker_options && $.fn.datepicker) {
var opt = [];
$.each(befSettings.datepicker_options, function(key, val) {
if (key && val) {
opt[key] = JSON.parse(val);
}
});
$('.bef-datepicker').datepicker(opt);
}
} // attach: function() {
}; // Drupal.behaviors.better_exposed_filters = {
Drupal.behaviors.betterExposedFiltersAllNoneNested = {
attach:function (context, settings) {
$('.form-checkboxes.bef-select-all-none-nested li').has('ul').once('bef-all-none-nested', function () {
$(this)
// To respect term depth, check/uncheck child term checkboxes.
.find('input.form-checkboxes:first')
.click(function() {
var checkedParent = $(this).attr('checked');
if (!checkedParent) {
// Uncheck all children if parent is unchecked.
$(this).parents('li:first').find('ul input.form-checkboxes').removeAttr('checked');
}
else {
// Check all children if parent is checked.
$(this).parents('li:first').find('ul input.form-checkboxes').attr('checked', $(this).attr('checked'));
}
})
.end()
// When a child term is checked or unchecked, set the parent term's
// status.
.find('ul input.form-checkboxes')
.click(function() {
var checked = $(this).attr('checked');
// Determine the number of unchecked sibling checkboxes.
var ct = $(this).parents('ul:first').find('input.form-checkboxes:not(:checked)').size();
// If the child term is unchecked, uncheck the parent.
if (!checked) {
// Uncheck parent if any of the childres is unchecked.
$(this).parents('li:first').parents('li:first').find('input.form-checkboxes:first').removeAttr('checked');
}
// If all sibling terms are checked, check the parent.
if (!ct) {
// Check the parent if all the children are checked.
$(this).parents('li:first').parents('li:first').find('input.form-checkboxes:first').attr('checked', checked);
}
});
});
}
};
Drupal.behaviors.better_exposed_filters_slider = {
attach: function(context, settings) {
var befSettings = settings.better_exposed_filters;
if (befSettings && befSettings.slider && befSettings.slider_options) {
$.each(befSettings.slider_options, function(i, sliderOptions) {
var containing_parent = "#" + sliderOptions.viewId + " #edit-" + sliderOptions.id + "-wrapper .views-widget";
var $filter = $(containing_parent);
// If the filter is placed in a secondary fieldset, we may not have
// the usual wrapper element.
if (!$filter.length) {
containing_parent = "#" + sliderOptions.viewId + " .bef-slider-wrapper";
$filter = $(containing_parent);
}
// Only make one slider per filter.
$filter.once('slider-filter', function() {
var $input = $(this).find('input[type=text]');
// This is a "between" or "not between" filter with two values.
if ($input.length == 2) {
var $min = $input.parent().find('input#edit-' + sliderOptions.id + '-min'),
$max = $input.parent().find('input#edit-' + sliderOptions.id + '-max'),
default_min,
default_max;
if (!$min.length || !$max.length) {
return;
}
// Get the default values.
// We use slider min & max if there are no defaults.
default_min = parseFloat(($min.val() == '') ? sliderOptions.min : $min.val(), 10);
default_max = parseFloat(($max.val() == '') ? sliderOptions.max : $max.val(), 10);
// Set the element value in case we are using the slider min & max.
$min.val(default_min);
$max.val(default_max);
$min.parents(containing_parent).after(
$('').slider({
range: true,
min: parseFloat(sliderOptions.min, 10),
max: parseFloat(sliderOptions.max, 10),
step: parseFloat(sliderOptions.step, 10),
animate: sliderOptions.animate ? sliderOptions.animate : false,
orientation: sliderOptions.orientation,
values: [default_min, default_max],
// Update the textfields as the sliders are moved
slide: function (event, ui) {
$min.val(ui.values[0]);
$max.val(ui.values[1]);
},
// This fires when the value is set programmatically or the
// stop event fires.
// This takes care of the case that a user enters a value
// into the text field that is not a valid step of the slider.
// In that case the slider will go to the nearest step and
// this change event will update the text area.
change: function (event, ui) {
$min.val(ui.values[0]);
$max.val(ui.values[1]);
},
// Attach stop listeners.
stop: function(event, ui) {
// Click the auto submit button.
$(this).parents('form').find('.ctools-auto-submit-click').click();
}
})
);
// Update the slider when the fields are updated.
$min.blur(function() {
befUpdateSlider($(this), 0, sliderOptions);
});
$max.blur(function() {
befUpdateSlider($(this), 1, sliderOptions);
});
}
// This is single value filter.
else if ($input.length == 1) {
if ($input.attr('id') != 'edit-' + sliderOptions.id) {
return;
}
// Get the default value. We use slider min if there is no default.
var default_value = parseFloat(($input.val() == '') ? sliderOptions.min : $input.val(), 10);
// Set the element value in case we are using the slider min.
$input.val(default_value);
$input.parents(containing_parent).after(
$('').slider({
min: parseFloat(sliderOptions.min, 10),
max: parseFloat(sliderOptions.max, 10),
step: parseFloat(sliderOptions.step, 10),
animate: sliderOptions.animate ? sliderOptions.animate : false,
orientation: sliderOptions.orientation,
value: default_value,
// Update the textfields as the sliders are moved.
slide: function (event, ui) {
$input.val(ui.value);
},
// This fires when the value is set programmatically or the
// stop event fires.
// This takes care of the case that a user enters a value
// into the text field that is not a valid step of the slider.
// In that case the slider will go to the nearest step and
// this change event will update the text area.
change: function (event, ui) {
$input.val(ui.value);
},
// Attach stop listeners.
stop: function(event, ui) {
// Click the auto submit button.
$(this).parents('form').find('.ctools-auto-submit-click').click();
}
})
);
// Update the slider when the field is updated.
$input.blur(function() {
befUpdateSlider($(this), null, sliderOptions);
});
}
else {
return;
}
})
});
}
}
};
// This is only needed to provide ajax functionality
Drupal.behaviors.better_exposed_filters_select_as_links = {
attach: function(context, settings) {
$('.bef-select-as-links', context).once(function() {
var $element = $(this);
// Check if ajax submission is enabled. If it's not enabled then we
// don't need to attach our custom submission handling, because the
// links are already properly built.
// First check if any ajax views are contained in the current page.
if (typeof settings.views == 'undefined' || typeof settings.views.ajaxViews == 'undefined') {
return;
}
// Now check that the view for which the current filter block is used,
// is part of the configured ajax views.
var $uses_ajax = false;
$.each(settings.views.ajaxViews, function(i, item) {
var $view_name = item.view_name.replace(/_/g, '-');
var $view_display_id = item.view_display_id.replace(/_/g, '-');
var $id = 'views-exposed-form-' + $view_name + '-' + $view_display_id;
var $form_id = $element.parents('form').attr('id');
if ($form_id == $id) {
$uses_ajax = true;
return;
}
});
// If no ajax is used for form submission, we quit here.
if (!$uses_ajax) {
return;
}
// Attach selection toggle and form submit on click to each link.
$(this).find('a').click(function(event) {
var $wrapper = $(this).parents('.bef-select-as-links');
var $options = $wrapper.find('select option');
// We have to prevent the page load triggered by the links.
event.preventDefault();
event.stopPropagation();
// Un select old select value.
$wrapper.find('select option').removeAttr('selected');
// Set the corresponding option inside the select element as selected.
var link_text = $(this).text();
$selected = $options.filter(function() {
return $(this).text() == link_text;
});
$selected.attr('selected', 'selected');
$wrapper.find('.bef-new-value').val($selected.val());
$wrapper.find('a').removeClass('active');
$(this).addClass('active');
// Submit the form.
$wrapper.parents('form').find('.views-submit-button *[type=submit]').click();
});
});
}
};
Drupal.behaviors.betterExposedFiltersRequiredFilter = {
attach: function(context, settings) {
// Required checkboxes should re-check all inputs if a user un-checks
// them all.
$('.bef-select-as-checkboxes', context).once('bef-required-filter').ajaxComplete(function (e, xhr, s) {
var $element = $(this);
if (typeof settings.views == 'undefined' || typeof settings.views.ajaxViews == 'undefined') {
return;
}
// Now check that the view for which the current filter block is used,
// is part of the configured ajax views.
var $view_name;
var $view_display_id;
var $uses_ajax = false;
$.each(settings.views.ajaxViews, function(i, item) {
$view_name = item.view_name;
$view_display_id = item.view_display_id;
var $id = 'views-exposed-form-' + $view_name.replace(/_/g, '-') + '-' + $view_display_id.replace(/_/g, '-');
var $form_id = $element.parents('form').attr('id');
if ($form_id == $id) {
$uses_ajax = true;
return false;
}
});
//Check if we have any filters at all because of Views Selective Filter
if($('input', this).length > 0) {
var $filter_name = $('input', this).attr('name').slice(0, -2);
if (Drupal.settings.better_exposed_filters.views[$view_name].displays[$view_display_id].filters[$filter_name].required && $('input:checked', this).length == 0) {
$('input', this).prop('checked', true);
}
}
});
}
}
/*
* Helper functions
*/
/**
* Adds/Removes the highlight class from the form-item div as appropriate
*/
function _bef_highlight(elem, context) {
$elem = $(elem, context);
$elem.attr('checked')
? $elem.closest('.form-item', context).addClass('highlight')
: $elem.closest('.form-item', context).removeClass('highlight');
}
/**
* Update a slider when a related input element is changed.
*
* We don't need to check whether the new value is valid based on slider min,
* max, and step because the slider will do that automatically and then we
* update the textfield on the slider's change event.
*
* We still have to make sure that the min & max values of a range slider
* don't pass each other though, however once this jQuery UI bug is fixed we
* won't have to. - http://bugs.jqueryui.com/ticket/3762
*
* @param $el
* A jQuery object of the updated element.
* @param valIndex
* The index of the value for a range slider or null for a non-range slider.
* @param sliderOptions
* The options for the current slider.
*/
function befUpdateSlider($el, valIndex, sliderOptions) {
var val = parseFloat($el.val(), 10),
currentMin = $el.parents('div.views-widget').next('.bef-slider').slider('values', 0),
currentMax = $el.parents('div.views-widget').next('.bef-slider').slider('values', 1);
// If we have a range slider.
if (valIndex != null) {
// Make sure the min is not more than the current max value.
if (valIndex == 0 && val > currentMax) {
val = currentMax;
}
// Make sure the max is not more than the current max value.
if (valIndex == 1 && val < currentMin) {
val = currentMin;
}
// If the number is invalid, go back to the last value.
if (isNaN(val)) {
val = $el.parents('div.views-widget').next('.bef-slider').slider('values', valIndex);
}
}
else {
// If the number is invalid, go back to the last value.
if (isNaN(val)) {
val = $el.parents('div.views-widget').next('.bef-slider').slider('value');
}
}
// Make sure we are a number again.
val = parseFloat(val, 10);
// Set the slider to the new value.
// The slider's change event will then update the textfield again so that
// they both have the same value.
if (valIndex != null) {
$el.parents('div.views-widget').next('.bef-slider').slider('values', valIndex, val);
}
else {
$el.parents('div.views-widget').next('.bef-slider').slider('value', val);
}
}
}) (jQuery);
;
// Trick to make exposed block work after refresh (https://drupal.org/node/2182885).
jQuery.fn.attachBehaviors = function () { Drupal.attachBehaviors(); };
;
(function($){
/**
* To make a form auto submit, all you have to do is 3 things:
*
* ctools_add_js('auto-submit');
*
* On gadgets you want to auto-submit when changed, add the ctools-auto-submit
* class. With FAPI, add:
* @code
* '#attributes' => array('class' => array('ctools-auto-submit')),
* @endcode
*
* If you want to have auto-submit for every form element,
* add the ctools-auto-submit-full-form to the form. With FAPI, add:
* @code
* '#attributes' => array('class' => array('ctools-auto-submit-full-form')),
* @endcode
*
* If you want to exclude a field from the ctool-auto-submit-full-form auto submission,
* add the class ctools-auto-submit-exclude to the form element. With FAPI, add:
* @code
* '#attributes' => array('class' => array('ctools-auto-submit-exclude')),
* @endcode
*
* Finally, you have to identify which button you want clicked for autosubmit.
* The behavior of this button will be honored if it's ajaxy or not:
* @code
* '#attributes' => array('class' => array('ctools-use-ajax', 'ctools-auto-submit-click')),
* @endcode
*
* Currently only 'select', 'radio', 'checkbox' and 'textfield' types are supported. We probably
* could use additional support for HTML5 input types.
*/
Drupal.behaviors.CToolsAutoSubmit = {
attach: function(context) {
// 'this' references the form element
function triggerSubmit (e) {
if ($.contains(document.body, this)) {
var $this = $(this);
if (!$this.hasClass('ctools-ajaxing')) {
$this.find('.ctools-auto-submit-click').click();
}
}
}
// the change event bubbles so we only need to bind it to the outer form
$('form.ctools-auto-submit-full-form', context)
.add('.ctools-auto-submit', context)
.filter('form, select, input:not(:text, :submit)')
.once('ctools-auto-submit')
.change(function (e) {
// don't trigger on text change for full-form
if ($(e.target).is(':not(:text, :submit, .ctools-auto-submit-exclude)')) {
triggerSubmit.call(e.target.form);
}
});
// e.keyCode: key
var discardKeyCode = [
16, // shift
17, // ctrl
18, // alt
20, // caps lock
33, // page up
34, // page down
35, // end
36, // home
37, // left arrow
38, // up arrow
39, // right arrow
40, // down arrow
9, // tab
13, // enter
27 // esc
];
// Don't wait for change event on textfields
$('.ctools-auto-submit-full-form input:text, input:text.ctools-auto-submit', context)
.filter(':not(.ctools-auto-submit-exclude)')
.once('ctools-auto-submit', function () {
// each textinput element has his own timeout
var timeoutID = 0;
$(this)
.bind('keydown keyup', function (e) {
if ($.inArray(e.keyCode, discardKeyCode) === -1) {
timeoutID && clearTimeout(timeoutID);
}
})
.keyup(function(e) {
if ($.inArray(e.keyCode, discardKeyCode) === -1) {
timeoutID = setTimeout($.proxy(triggerSubmit, this.form), 500);
}
})
.bind('change', function (e) {
if ($.inArray(e.keyCode, discardKeyCode) === -1) {
timeoutID = setTimeout($.proxy(triggerSubmit, this.form), 500);
}
});
});
}
}
})(jQuery);
;
Drupal.TBMegaMenu = Drupal.TBMegaMenu || {};
(function ($) {
Drupal.TBMegaMenu.oldWindowWidth = 0;
Drupal.TBMegaMenu.displayedMenuMobile = false;
Drupal.TBMegaMenu.supportedScreens = [980];
Drupal.TBMegaMenu.menuResponsive = function () {
var windowWidth = window.innerWidth ? window.innerWidth : $(window).width();
var navCollapse = $('.tb-megamenu').children('.nav-collapse');
if (windowWidth < Drupal.TBMegaMenu.supportedScreens[0]) {
navCollapse.addClass('collapse');
if (Drupal.TBMegaMenu.displayedMenuMobile) {
navCollapse.css({height: 'auto', overflow: 'visible'});
} else {
navCollapse.css({height: 0, overflow: 'hidden'});
}
} else {
// If width of window is greater than 980 (supported screen).
navCollapse.removeClass('collapse');
if (navCollapse.height() <= 0) {
navCollapse.css({height: 'auto', overflow: 'visible'});
}
}
};
Drupal.behaviors.tbMegaMenuAction = {
attach: function(context) {
$('.tb-megamenu-button', context).once('menuIstance', function () {
var This = this;
$(This).click(function() {
if(parseInt($(this).parent().children('.nav-collapse').height())) {
$(this).parent().children('.nav-collapse').css({height: 0, overflow: 'hidden'});
Drupal.TBMegaMenu.displayedMenuMobile = false;
}
else {
$(this).parent().children('.nav-collapse').css({height: 'auto', overflow: 'visible'});
Drupal.TBMegaMenu.displayedMenuMobile = true;
}
});
});
// var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion);
var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion) && !(/Windows NT(.*)Chrome/gi).test(navigator.appVersion);
if(!isTouch){
$(document).ready(function($){
var mm_duration = 0;
$('.tb-megamenu').each (function(){
if ($(this).data('duration')) {
mm_duration = $(this).data('duration');
}
});
var mm_timeout = mm_duration ? 100 + mm_duration : 500;
$('.nav > li, li.mega').hover(function(event) {
var $this = $(this);
if ($this.hasClass ('mega')) {
$this.addClass ('animating');
clearTimeout ($this.data('animatingTimeout'));
$this.data('animatingTimeout', setTimeout(function(){$this.removeClass ('animating')}, mm_timeout));
clearTimeout ($this.data('hoverTimeout'));
$this.data('hoverTimeout', setTimeout(function(){$this.addClass ('open')}, 100));
} else {
clearTimeout ($this.data('hoverTimeout'));
$this.data('hoverTimeout',
setTimeout(function(){$this.addClass ('open')}, 100));
}
},
function(event) {
var $this = $(this);
if ($this.hasClass ('mega')) {
$this.addClass ('animating');
clearTimeout ($this.data('animatingTimeout'));
$this.data('animatingTimeout',
setTimeout(function(){$this.removeClass ('animating')}, mm_timeout));
clearTimeout ($this.data('hoverTimeout'));
$this.data('hoverTimeout', setTimeout(function(){$this.removeClass ('open')}, 100));
} else {
clearTimeout ($this.data('hoverTimeout'));
$this.data('hoverTimeout',
setTimeout(function(){$this.removeClass ('open')}, 100));
}
});
});
}
$(window).resize(function() {
var windowWidth = window.innerWidth ? window.innerWidth : $(window).width();
if(windowWidth != Drupal.TBMegaMenu.oldWindowWidth){
Drupal.TBMegaMenu.oldWindowWidth = windowWidth;
Drupal.TBMegaMenu.menuResponsive();
}
});
},
}
})(jQuery);
;
Drupal.TBMegaMenu = Drupal.TBMegaMenu || {};
(function ($) {
Drupal.TBMegaMenu.createTouchMenu = function(items) {
items.children('a').each( function() {
var $item = $(this);
var tbitem = $(this).parent();
$item.click( function(event){
if ($item.hasClass('tb-megamenu-clicked')) {
var $uri = $item.attr('href');
window.location.href = $uri;
}
else {
event.preventDefault();
$item.addClass('tb-megamenu-clicked');
if(!tbitem.hasClass('open')){
tbitem.addClass('open');
}
}
}).closest('li').mouseleave( function(){
$item.removeClass('tb-megamenu-clicked');
tbitem.removeClass('open');
});
});
/*
items.children('a').children('span.caret').each( function() {
var $item = $(this).parent();
$item.click(function(event){
tbitem = $item.parent();
if ($item.hasClass('tb-megamenu-clicked')) {
Drupal.TBMegaMenu.eventStopPropagation(event);
if(tbitem.hasClass('open')){
tbitem.removeClass('open');
$item.removeClass('tb-megamenu-clicked');
}
}
else {
Drupal.TBMegaMenu.eventStopPropagation(event);
$item.addClass('tb-megamenu-clicked');
if(!tbitem.hasClass('open')){
tbitem.addClass('open');
$item.removeClass('tb-megamenu-clicked');
}
}
});
});
*/
}
Drupal.TBMegaMenu.eventStopPropagation = function(event) {
if (event.stopPropagation) {
event.stopPropagation();
}
else if (window.event) {
window.event.cancelBubble = true;
}
}
Drupal.behaviors.tbMegaMenuTouchAction = {
attach: function(context) {
// var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion);
var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion) && !(/Windows NT(.*)Chrome/gi).test(navigator.appVersion);
if(isTouch){
$('html').addClass('touch');
Drupal.TBMegaMenu.createTouchMenu($('.tb-megamenu ul.nav li.mega').has('.dropdown-menu'));
}
}
}
})(jQuery);
;
(function ($) {
/**
* Toggle the visibility of a fieldset using smooth animations.
*/
Drupal.toggleFieldset = function (fieldset) {
var $fieldset = $(fieldset);
if ($fieldset.is('.collapsed')) {
var $content = $('> .fieldset-wrapper', fieldset).hide();
$fieldset
.removeClass('collapsed')
.trigger({ type: 'collapsed', value: false })
.find('> legend span.fieldset-legend-prefix').html(Drupal.t('Hide'));
$content.slideDown({
duration: 'fast',
easing: 'linear',
complete: function () {
Drupal.collapseScrollIntoView(fieldset);
fieldset.animating = false;
},
step: function () {
// Scroll the fieldset into view.
Drupal.collapseScrollIntoView(fieldset);
}
});
}
else {
$fieldset.trigger({ type: 'collapsed', value: true });
$('> .fieldset-wrapper', fieldset).slideUp('fast', function () {
$fieldset
.addClass('collapsed')
.find('> legend span.fieldset-legend-prefix').html(Drupal.t('Show'));
fieldset.animating = false;
});
}
};
/**
* Scroll a given fieldset into view as much as possible.
*/
Drupal.collapseScrollIntoView = function (node) {
var h = document.documentElement.clientHeight || document.body.clientHeight || 0;
var offset = document.documentElement.scrollTop || document.body.scrollTop || 0;
var posY = $(node).offset().top;
var fudge = 55;
if (posY + node.offsetHeight + fudge > h + offset) {
if (node.offsetHeight > h) {
window.scrollTo(0, posY);
}
else {
window.scrollTo(0, posY + node.offsetHeight - h + fudge);
}
}
};
Drupal.behaviors.collapse = {
attach: function (context, settings) {
$('fieldset.collapsible', context).once('collapse', function () {
var $fieldset = $(this);
// Expand fieldset if there are errors inside, or if it contains an
// element that is targeted by the URI fragment identifier.
var anchor = location.hash && location.hash != '#' ? ', ' + location.hash : '';
if ($fieldset.find('.error' + anchor).length) {
$fieldset.removeClass('collapsed');
}
var summary = $('');
$fieldset.
bind('summaryUpdated', function () {
var text = $.trim($fieldset.drupalGetSummary());
summary.html(text ? ' (' + text + ')' : '');
})
.trigger('summaryUpdated');
// Turn the legend into a clickable link, but retain span.fieldset-legend
// for CSS positioning.
var $legend = $('> legend .fieldset-legend', this);
$('')
.append($fieldset.hasClass('collapsed') ? Drupal.t('Show') : Drupal.t('Hide'))
.prependTo($legend)
.after(' ');
// .wrapInner() does not retain bound events.
var $link = $('')
.prepend($legend.contents())
.appendTo($legend)
.click(function () {
var fieldset = $fieldset.get(0);
// Don't animate multiple times.
if (!fieldset.animating) {
fieldset.animating = true;
Drupal.toggleFieldset(fieldset);
}
return false;
});
$legend.append(summary);
});
}
};
})(jQuery);
;
(function ($) {
Drupal.behaviors.lang_dropdown = {
attach: function (context, settings) {
var settings = settings || Drupal.settings;
if (settings.lang_dropdown) {
var flags, msddSettings;
for (key in settings.lang_dropdown) {
msddSettings = settings.lang_dropdown[key].jsWidget;
flags = msddSettings.languageicons;
if (flags) {
$.each(flags, function(index, value) {
if (msddSettings.widget == "msdropdown") {
$('select#lang-dropdown-select-' + key + ' option[value="' + index + '"]').attr('data-image', value);
}
else if (msddSettings.widget == "ddslick" && Boolean(msddSettings.showSelectedHTML)) {
$('select#lang-dropdown-select-' + key + ' option[value="' + index + '"]').attr('data-imagesrc', value);
}
});
}
if (msddSettings.widget == "msdropdown") {
try {
$('select#lang-dropdown-select-' + key).msDropDown({
visibleRows: msddSettings.visibleRows,
roundedCorner: Boolean(msddSettings.roundedCorner),
animStyle: msddSettings.animStyle,
event: msddSettings.event,
mainCSS: msddSettings.mainCSS
});
}
catch (e) {
if (console) { console.log(e); }
}
}
else if (msddSettings.widget == "chosen") {
$('select#lang-dropdown-select-' + key).chosen({
disable_search: msddSettings.disable_search,
no_results_text: msddSettings.no_results_text
});
}
else if (msddSettings.widget == "ddslick") {
$.data(document.body, 'ddslick'+key+'flag', 0);
$('select#lang-dropdown-select-' + key).ddslick({
width: msddSettings.width,
height: (msddSettings.height == 0) ? null : msddSettings.height,
showSelectedHTML: Boolean(msddSettings.showSelectedHTML),
imagePosition: msddSettings.imagePosition,
onSelected: function(data) {
var i = $.data(document.body, 'ddslick'+key+'flag');
if (i) {
$.data(document.body, 'ddslick'+key+'flag', 0);
var lang = data.selectedData.value;
var href = $('#lang-dropdown-select-'+key).parents('form').find('input[name="' + lang + '"]').val();
window.location.href = href;
}
$.data(document.body, 'ddslick'+key+'flag', 1);
}
});
}
}
}
$('select.lang-dropdown-select-element').change(function() {
var lang = this.options[this.selectedIndex].value;
var href = $(this).parents('form').find('input[name="' + lang + '"]').val();
window.location.href = href;
});
$('form.lang-dropdown-form').after('');
}
};
})(jQuery);
;