
(function(){var e;var d=function(){};var b=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"];var c=b.length;var a=(window.console=window.console||{});while(c--){e=b[c];if(!a[e]){a[e]=d}}}());
;ZhongFramework.Modernizr=function(a,b,c){function u(a){i.cssText=a}function v(a,b){return u(prefixes.join(a+";")+(b||""))}function w(a,b){return typeof a===b}function x(a,b){return!!~(""+a).indexOf(b)}function y(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:w(f,"function")?f.bind(d||b):f}return!1}var d="2.7.1",e={},f=b.documentElement,g="modernizr",h=b.createElement(g),i=h.style,j,k={}.toString,l={},m={},n={},o=[],p=o.slice,q,r=function(a,c,d,e){var h,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:g+(d+1),l.appendChild(j);return h=["&#173;",'<style id="s',g,'">',a,"</style>"].join(""),l.id=g,(m?l:n).innerHTML+=h,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=f.style.overflow,f.style.overflow="hidden",f.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),f.style.overflow=k),!!i},s={}.hasOwnProperty,t;!w(s,"undefined")&&!w(s.call,"undefined")?t=function(a,b){return s.call(a,b)}:t=function(a,b){return b in a&&w(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=p.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(p.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(p.call(arguments)))};return e}),l.fontface=function(){var a;return r('@font-face {font-family:"font";src:url("https://")}',function(c,d){var e=b.getElementById("smodernizr"),f=e.sheet||e.styleSheet,g=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"";a=/src/i.test(g)&&g.indexOf(d.split(" ")[0])===0}),a};for(var z in l)t(l,z)&&(q=z.toLowerCase(),e[q]=l[z](),o.push((e[q]?"":"no-")+q));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)t(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof enableClasses!="undefined"&&enableClasses&&(f.className+=" "+(b?"":"no-")+a),e[a]=b}return e},u(""),h=j=null,e._version=d,e.testStyles=r,e}(this,this.document);
if(!!navigator.userAgent.toLowerCase().match(/(android (2.0|2.1))|(windows phone os 7)/)){
ZhongFramework.Modernizr.fontface=false;
}
jQuery.fn.addTransition = function(duration, property, classAfterTransition){
var transitionDurationInt = 800;
if(typeof duration !== "undefined"){
if(duration==='fast') {transitionDurationInt=400;}
else if(duration==='slow') {transitionDurationInt=1400;}
}
else {duration='medium';}
if(typeof property === "undefined") {property = 'all';}
this.addClass('transition_'+duration+'-'+property);
(function($this){
setTimeout(function(){
$this.removeClass('transition_'+duration+'-'+property);
if(typeof classAfterTransition !== "undefined"){
$this.addClass(classAfterTransition);
}
},transitionDurationInt);
})(this);			
return this;
};
jQuery.fn.ctrlARIA = function(behaviour, parameters){
if(behaviour==='alive'){
this.attr({'aria-live':'assertive','aria-relevant':'all','aria-atomic':'true'});
}
else if(behaviour==='off'){
this.attr({'aria-live':'off','aria-relevant':'','aria-atomic':''});
}
else if(behaviour==='reset'){
(function(thisVar){
setTimeout(function(){ 
thisVar.attr({'aria-live':'','aria-relevant':'','aria-atomic':''});
},0);
})(this);
return this; 
}
else if(behaviour==='hidden'){
if(parameters!=='true') this.attr('aria-hidden','false');
else this.attr('aria-hidden','true');
}
else{ 
if(parameters!=='true') this.attr('aria-busy','false');
else this.attr('aria-busy','true');
}
this[0].offsetWidth; 
return this;
};
(function($){
'use strict';
var $body = $(document.body);
var bodyInitialClass = document.body.className;
var htmlInitialClass = document.getElementsByTagName('html')[0].className;
var $window = $(window);
var $document = $(document);
var $accessibilityPanel = $(document.getElementById('accessibility-panel'));
var $layoutWidthRailElements = $('.layout-width-rail');
var fontSizeDifference = 10; 
var tooltipPositionX; 
var tooltipPositionY;
var isAccessibilityPanelToggling = false;
var isAccessibilityPanelClosed = true;
var initialClientWidth = $window.width();
var zhongFramework = new ZhongFramework();
function throwError(errorMessage){
try{ throw new Error(errorMessage); }
catch(e){ console.error(e.stack); }
}
function DOMhasClass(el,className){
if(!el){throwError('Element undefined'); return; }
return el.className.indexOf(className) > -1;
}
function domRemoveClass(el,className){
if(!el){throwError('Element undefined'); return; }
el.className = el.className.replace(new RegExp('[ ]?'+className,'g'),'');
return el;
}
function domAddClass(el,className){
if(!el){throwError('Element undefined'); return; }
el.className += ' '+className;
return el;
}
function domRemove(el){
if(!el){throwError('Element undefined'); return; }
return el.parentNode.removeChild(el);
}
function domAppendChild(el,tagName,HTMLcontent){
if(!el){throwError('Element undefined'); return; }
var newEl = document.createElement(tagName);
if(typeof HTMLcontent !== 'undefined'){
newEl.innerHTML = HTMLcontent;
}
el.appendChild(newEl);
return newEl;
}
function includeScript(scriptSource){
scriptSource = scriptSource.replace(/^\s+|\s+$/g,""); 
var newScript = document.createElement('script'); newScript.type = 'text/javascript'; newScript.async = true;
newScript.text = scriptSource;
var parentTag = document.getElementsByTagName('script')[0]; parentTag.parentNode.insertBefore(newScript,parentTag);
}
function includeScriptSrc(srcSource){
var newScript = document.createElement('script'); newScript.type = 'text/javascript'; newScript.async = true;
newScript.src = srcSource;
var parentTag = document.getElementsByTagName('script')[0]; parentTag.parentNode.insertBefore(newScript,parentTag);
}
function expandableMenuHandler($menuContainer,parentClassName){
var $menuParentElements = $menuContainer.find(parentClassName);
var $menuFirstLeveLinks = $menuParentElements.find('a').filter(function(){ return $(this).parents('ul').length===1; });
$menuParentElements.children('ul').slideUp(0);
var $clickedParentItem;
$menuParentElements.children('a').click(function(e){
$clickedParentItem = $(this);
if( $clickedParentItem.siblings('ul').eq(0).hasClass('zhong-framework_menu-expanded') ){
window.location = $clickedParentItem.attr('href');
}
else{
e.preventDefault();
if( $menuFirstLeveLinks.filter($clickedParentItem).size() ){
$('.zhong-framework_menu-expanded').slideUp(400).removeClass('zhong-framework_menu-expanded');
}
$clickedParentItem.siblings('ul').eq(0)
.ctrlARIA('alive')
.slideDown(400).addClass('zhong-framework_menu-expanded')
.ctrlARIA('reset');
}
});
}
function forceElementFocus($el){
$el.attr('tabindex', -1).on('blur focusout',function(){ $(this).removeAttr('tabindex'); }).focus();
}
function setLayoutWidthMode(layoutwidthmode){
if(zhongFramework.customLayoutWidth!=='inherit' && layoutwidthmode!=='custom'){
var layoutWidthRailElementStyle;
for(var i=0;i<$layoutWidthRailElements.length;i++){
layoutWidthRailElementStyle = $layoutWidthRailElements.eq(i).attr('style');
if(typeof layoutWidthRailElementStyle !== 'undefined'){
layoutWidthRailElementStyle = layoutWidthRailElementStyle.replace(new RegExp('width:(.....|....|...|..|.)(px|em|%);?','i'),'');
$layoutWidthRailElements.eq(i).attr('style',layoutWidthRailElementStyle);
}
}
zhongFramework.customLayoutWidth='inherit';
}
if(zhongFramework.layoutMode==='default-layout'){
$body
.addTransition('fast','all_deep')
.removeClass("full-layout-width fixed-layout-width liquid-layout-width custom-layout-width")
.addClass(layoutwidthmode+"-layout-width");
}
else{
$body
.addTransition('fast','all_deep')
.removeClass("full-layout-width fixed-layout-width liquid-layout-width custom-layout-width")
.addClass("full-layout-width");
}
zhongFramework.layoutWidthMode=layoutwidthmode;
saveUserSettings(); 
}
function hideAccessibilityPanel(){
if(isAccessibilityPanelToggling){ return; }
isAccessibilityPanelToggling = true;
$('#show-accessibility-panel-button')
.attr("title", zhongFramework.accessPanelTitle_closed)
.find('.top-bar-tool-text')
.text(zhongFramework.accessPanelText_closed);
$body
.removeClass("accessibility-panel-visible")
.addClass("accessibility-panel-hidden");
$accessibilityPanel
.slideUp("slow")
.queue(function(){
isAccessibilityPanelToggling = false;
$(this).addClass('removed')
.dequeue();
});
isAccessibilityPanelClosed = true;
}
function toggleAccessibilityPanelVisibility(){
if(isAccessibilityPanelToggling){ return; }
if(isAccessibilityPanelClosed){
isAccessibilityPanelToggling = true;
$('#show-accessibility-panel-button')
.attr("title", zhongFramework.accessPanelTitle_open)
.find('.top-bar-tool-text')
.text(zhongFramework.accessPanelText_open);
$body
.removeClass("accessibility-panel-hidden")
.addClass("accessibility-panel-visible");
$accessibilityPanel
.removeClass('removed')
.slideDown("slow")
.queue(function(){
isAccessibilityPanelToggling = false;
$(this).dequeue();
});
isAccessibilityPanelClosed = false;
}
else{ hideAccessibilityPanel(); }
}
function nightModeTransitionHandler(){
$('#night-mode-switcher').click(function(e){
e.preventDefault();
if(zhongFramework.graphicMode==='night-mode'){
$('#night-mode-switcher')
.attr('title',zhongFramework.nightModeLinkTitle)
.find('.top-bar-tool-text').text(zhongFramework.nightModeLinkText)
.parent().find('.top-bar-tool-text-hidden').text(zhongFramework.nightModeLinkTitle)
.parent().parent().find('.zhongframework-icon-day-mode').attr('class','zhongframework-icon zhongframework-icon-night-mode');
$body
.addTransition('fast','all_deep')
.addClass('default-graphic-mode')
.removeClass('night-mode');
zhongFramework.graphicMode='default-graphic-mode';
}
else{
$('#night-mode-switcher')
.attr('title',zhongFramework.dayModeLinkTitle)
.find('.top-bar-tool-text').text(zhongFramework.dayModeLinkText)
.parent().find('.top-bar-tool-text-hidden').text(zhongFramework.dayModeLinkTitle)
.parent().parent().find('.zhongframework-icon-night-mode').attr('class','zhongframework-icon zhongframework-icon-day-mode');
$body
.addTransition('fast','all_deep')
.addClass('night-mode')
.removeClass('default-graphic-mode');
zhongFramework.graphicMode='night-mode';
}
saveUserSettings(); 
});
}
function biggerFontSize(bigger){
if(bigger){
zhongFramework.currentFontSize = zhongFramework.currentFontSize + fontSizeDifference;
if(zhongFramework.currentFontSize > 400){zhongFramework.currentFontSize = 400;} 
}
else{
zhongFramework.currentFontSize = zhongFramework.currentFontSize - fontSizeDifference;
if(zhongFramework.currentFontSize < 40){zhongFramework.currentFontSize = 40;} 
}
setFontSize(zhongFramework.currentFontSize);
}
function revertFontSize(){
zhongFramework.currentFontSize = zhongFramework.defaultFontSize;
setFontSize(zhongFramework.defaultFontSize);
}
function setFontSize(newFontSize){
$body.css('font-size',newFontSize+'%');
saveUserSettings(); 
}
function saveUserSettings(){
var date = new Date();
date.setTime(date.getTime()+zhongFramework.cookieDaysExpire);
document.cookie = "zhongFrameworkGraphicMode="+zhongFramework.graphicMode+"; expires="+date.toGMTString()+"; path=/";
document.cookie = "zhongFrameworkFontSize="+zhongFramework.currentFontSize+"; expires="+date.toGMTString()+"; path=/";
document.cookie = "zhongFrameworkLayoutWidth="+zhongFramework.layoutWidthMode+"; expires="+date.toGMTString()+"; path=/";
document.cookie = "zhongFrameworkCustomLayoutWidth="+zhongFramework.customLayoutWidth+"; expires="+date.toGMTString()+"; path=/";
}
function defaultLayoutModifications(){
if(bodyInitialClass.indexOf('parent-cms-Joomla3') > -1){
$('#search-module-outer').find('button')
.removeClass('btn-primary').removeClass('btn').removeClass('button');
$('#login-module').find('button')
.removeClass('btn-primary').removeClass('btn').removeClass('button');
}
}
function scrollToTopAnimationHandler(){
$('#goto-top').click(function(e){
e.preventDefault();
$('html, body').animate({scrollTop:1},600,function(){
forceElementFocus($('#page-top'));
});
});
}
function socialButtonsModuleHandler(){
if(zhongFramework.enableSocialButtonsModuleExpandable){
var DOMactivationButtonHost = null;
if(bodyInitialClass.indexOf('social-buttons-activation-button-position_logo') > -1){
if(!document.getElementById('logo-wrap')){ return; } 
else{ DOMactivationButtonHost = document.getElementById('logo-wrap'); } 
}
else if(bodyInitialClass.indexOf('social-buttons-activation-button-position_title') > -1){
if(!document.getElementById('title')){ return; }
else{ DOMactivationButtonHost = document.getElementById('title'); }
}
else if(bodyInitialClass.indexOf('social-buttons-activation-button-position_website-banner') > -1){
if(!document.getElementById('website-banner')){ return; }
else{ DOMactivationButtonHost = document.getElementById('website-banner'); }
}
//(Note: move it only if the host is not the website-banner. This is done to preserve the tabindex order)
if(DOMactivationButtonHost.id !== 'website-banner'){
DOMactivationButtonHost.appendChild((function(){
var socialButtonsActivationButton = document.getElementById('social-buttons-activation-button');
socialButtonsActivationButton.parentNode.removeChild(socialButtonsActivationButton);
return socialButtonsActivationButton;
})());
}
var domSharePanel = document.getElementById('social-buttons-container-outer');
var DOMsocialButtonsCloseButton = document.getElementById('social-buttons-close-button');
var domSocialActivationButton = document.getElementById('social-buttons-activation-button');
domRemoveClass(DOMsocialButtonsCloseButton,'removed');
domRemoveClass(domSocialActivationButton,'removed');
var showSharePanelContainer = function(){
domRemoveClass(domSharePanel,'removed');
domSharePanel.offsetWidth; 
domAddClass(domSharePanel,'active');
domRemoveClass(domSocialActivationButton,'active');
setTimeout(function(){
domAddClass(domSocialActivationButton,'visually-hidden');
},500);
};
var hideSocialButtonsContainer = function(){
domRemoveClass(domSharePanel,'active');
setTimeout(function(){
domAddClass(domSharePanel,'removed');
},500);
domRemoveClass(domSocialActivationButton,'visually-hidden');
domSocialActivationButton.offsetWidth; 
domAddClass(domSocialActivationButton,'active');
};
var focusOutOfSocialButtonsContainer = function(){
if( !$(domSharePanel).find(document.activeElement).size() ){
$('*').unbind('focus',focusOutOfSocialButtonsContainer); 
hideSocialButtonsContainer();
}
};
var socialActivationButtonFirstTimeClicked = false;
$('#social-buttons-activation-button').click(function(){
if(!socialActivationButtonFirstTimeClicked){
zhongFramework.initializeSocialButtons();
socialActivationButtonFirstTimeClicked=true;
}
showSharePanelContainer();
$('*').bind('focus',focusOutOfSocialButtonsContainer);
});
$('#social-buttons-close-button').click(function(){
hideSocialButtonsContainer();
$('*').unbind('focus',focusOutOfSocialButtonsContainer); 
});
}
}
function sameHeightCustomModulesHandler(){
if(zhongFramework.sameHeightCustomModules && initialClientWidth>719){
$('.custom-modules-container').each(function(){
var customModulesInTheRow = $(this).find('.custom-module-inner');
if(customModulesInTheRow.length===1){return;}
var maxHeightCustomModule = customModulesInTheRow.eq(0).outerHeight();
for(var i=1;i<customModulesInTheRow.length;i++){ 
if(maxHeightCustomModule < customModulesInTheRow.eq(i).outerHeight()){
maxHeightCustomModule = customModulesInTheRow.eq(i).outerHeight();
}
}
customModulesInTheRow.css('min-height',maxHeightCustomModule+'px');
customModulesInTheRow.find('[class*=custom-module-style_]').css('min-height',maxHeightCustomModule+'px');
customModulesInTheRow.find('[class*=custom-module-style_] [class*=custom-module-style_]').css('min-height','0');
});
}
}
function keyboardAccessibleMenu(menuID){
var $menuID = $(menuID);
var floatingMenuLinks = $menuID.find("a");
floatingMenuLinks.bind('focus',function(){
var $this = $(this);
var $thisParent = $this.parent();
if($thisParent.next("li").children("ul").size()){
$thisParent.next("li").children("ul").removeClass('visible-floating-menu');
}
if($thisParent.prev("li").children("ul").size()){
$thisParent.prev("li").children("ul").removeClass('visible-floating-menu');
}
if($thisParent.children("ul").size()){
$thisParent.children("ul").addClass('visible-floating-menu');
}
});
floatingMenuLinks.bind('blur',function(){
setTimeout(function(){
if( !$menuID.find(document.activeElement).size() ){
$menuID.find('.visible-floating-menu').removeClass('visible-floating-menu');
}
},0);
});
}
function userLayoutWidthResizeHandler(){
if(htmlInitialClass.indexOf('ie7') > -1){ $('#layout-width-resize-tool-container').remove(); return; }
if(zhongFramework.isPortable){ $('#layout-width-resize-tool-container').remove(); return; }
if(htmlInitialClass.indexOf('ie8') > -1){
$('.layout-width-resize-handle').css('opacity','0');
$('.layout-width-resize-handle').hover(
function(){$(this).css('opacity','0.7');},
function(){$(this).css('opacity','0');});
}
var currentLayoutWidth, currentPointerPosition, bodyStyleAttribute, resizeHandleDirection, customLayoutWidthPx;
var disableSelectionByCSS = '-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;';
$('.layout-width-resize-trigger')
.mousedown(function(e){
currentPointerPosition=e.pageX;
currentLayoutWidth=$layoutWidthRailElements.eq(0).width();
$body
.addClass('custom-layout-width')
.removeClass('full-layout-width').removeClass('liquid-layout-width').removeClass('fixed-layout-width');
$layoutWidthRailElements.css('width',currentLayoutWidth+'px');
if($(this).is('#layout-width-resize-handle_left') || $(this).is('#layout-width-resize-icon'))
{resizeHandleDirection=1;}
else
{resizeHandleDirection=-1;}
$body.attr('unselectable','on').attr('onselectstart','return false;').attr('onmousedown','return false;');
bodyStyleAttribute = document.getElementsByTagName('body')[0].getAttribute('style');
document.getElementsByTagName('body')[0].setAttribute('style',bodyStyleAttribute+disableSelectionByCSS);
$body
.bind("mousemove",function(e){
customLayoutWidthPx = currentLayoutWidth+((currentPointerPosition-e.pageX)*2*resizeHandleDirection);
$layoutWidthRailElements.css('width',customLayoutWidthPx);
})
.mouseup(function(){
$body.unbind("mousemove").unbind("mouseup");
zhongFramework.customLayoutWidth=customLayoutWidthPx;
zhongFramework.layoutWidthMode='custom';
bodyStyleAttribute = document.getElementsByTagName('body')[0].getAttribute('style');
bodyStyleAttribute = bodyStyleAttribute.replace(disableSelectionByCSS,'');
document.getElementsByTagName('body')[0].setAttribute('style',bodyStyleAttribute);
$body.removeAttr('unselectable').removeAttr('onselectstart').removeAttr('onmousedown');
saveUserSettings(); 
});
});
}
function stickySideColumnsHandler(){
if(!zhongFramework.enableStickyLeftColumn && !zhongFramework.enableStickyRightColumn){ return; }
//(many portable devices are buggy with position:fixed, moreover, ipad doesn't refresh the layout correctly while scrolling)
if(zhongFramework.isPortable){ return; }
if(initialClientWidth<719){ return; }
if(htmlInitialClass.indexOf('ie7') > -1){ return; }
function stickyColumnScrollingHandler($sideColumn,$dockContainer){
if($sideColumn.innerHeight() > $dockContainer.innerHeight()){ return; }
if($window.width() < 720){ return; }
var isSideColumnSticky=false;
var sideColumnOriginalTopOffset = $sideColumn.offset().top; 
//Some cache variables:
var windowScollTop,currentLeftColumnHeight,outerColumnContainerBottom,sideColumnBottom;
if( $window.height() > $sideColumn.innerHeight() ){
$window.scroll(function(){
windowScollTop = $window.scrollTop();
if(isSideColumnSticky){
if(windowScollTop < sideColumnOriginalTopOffset){
$sideColumn
.removeClass('sticky-side-column')
.css({ 'width' : '' });
sideColumnOriginalTopOffset=$sideColumn.offset().top;
isSideColumnSticky=false;
}
outerColumnContainerBottom = $dockContainer.offset().top+$dockContainer.innerHeight();
sideColumnBottom = windowScollTop+$sideColumn.innerHeight();
if(outerColumnContainerBottom < sideColumnBottom){
$sideColumn.css('top',(outerColumnContainerBottom-sideColumnBottom)+'px');
}
else{
$sideColumn.css('top','0');
}
return;
}
if(windowScollTop < $sideColumn.offset().top){ return; }
if( $window.height() < $sideColumn.innerHeight() ){ return; }
$sideColumn
.css({ 'width':$sideColumn.innerWidth()+'px' })
.addClass('sticky-side-column');
isSideColumnSticky=true;
});
}
} 
//Activate the handler:
if(zhongFramework.enableStickyLeftColumn && $('#left-column-inner').size())
{ stickyColumnScrollingHandler($('#left-column-inner'),$('#main-content-container')); }
if(zhongFramework.enableStickyRightColumn && $('#right-column-inner').size())
{ stickyColumnScrollingHandler($('#right-column-inner'),$('#main-content-container')); }
}
function javascriptTooltipsHandler(){
if(zhongFramework.isPortable){ return; }
if(zhongFramework.layoutMode==='default-layout' && zhongFramework.tooltipsEnabled==='never'){ return; }
if(zhongFramework.layoutMode==='high-contrast' && zhongFramework.tooltipsEnabledHighContrast==='never'){ return; }
var javascriptTooltipsTrigger = '.show-tooltip';
if(zhongFramework.layoutMode==='default-layout' && zhongFramework.tooltipsEnabled==='on-title'){
javascriptTooltipsTrigger = '[title]';
}
if(zhongFramework.layoutMode==='high-contrast' && zhongFramework.tooltipsEnabledHighContrast==='on-title'){
javascriptTooltipsTrigger = '[title]';
}
var tooltipElement, tooltipFather, tooltipImgElement, tooltipImgFather;
var tooltipElementOuterWidth, tooltipElementOuterHeight, tooltipFatherOuterWidth, tooltipFatherOuterHeight;
var tooltipImgElementOuterWidth, tooltipImgElementOuterHeight, tooltipImgFatherOuterWidth, tooltipImgFatherOuterHeight;
var tooltipCreatedFlag = false; 
$(javascriptTooltipsTrigger).hover(function(){
if($(this).attr('title')==='' || tooltipCreatedFlag){ return; }
tooltipCreatedFlag=true;
tooltipFather = $(this);
tooltipElement = $('<span class="tooltip-title" aria-live="off">'+tooltipFather.attr('title')+'</span>');
$body.append(tooltipElement);
tooltipFather.attr('title',''); 
tooltipElement.fadeIn(460); 
tooltipElementOuterWidth = tooltipElement.outerWidth();
tooltipElementOuterHeight = tooltipElement.outerHeight();
tooltipElement.css('min-width',tooltipElementOuterWidth+'px'); 
if(htmlInitialClass.indexOf('ie8') > -1){//Fix for the min-width/box-sizing bug in IE8
tooltipElement.css('min-width','0px');
}
if(zhongFramework.layoutMode!=='high-contrast'){
tooltipFather.mousemove(function(e){
tooltipPositionX=e.pageX+14 - $window.scrollLeft(); 
tooltipPositionY=e.pageY+16 - $window.scrollTop(); 
//Fix the position of the tooltip if it goes outside of the window boundaries
if( tooltipPositionX+tooltipElementOuterWidth > $window.width()-14 )
{ tooltipPositionX = $window.width()-tooltipElementOuterWidth-14; }
if( tooltipPositionY+tooltipElementOuterHeight > $document.height()-16 )
{ tooltipPositionY = $document.height()-tooltipElementOuterHeight-16; }
tooltipElement
.css('left',tooltipPositionX)
.css('top',tooltipPositionY);
});
}
else{
tooltipElement
.addClass('bottom-screen-positioning'); 
this.offsetWidth; 
tooltipElement
.css({
'margin-left' : '-'+tooltipElementOuterWidth/2+'px',
'bottom' : '1em'
});
}
},function(){
if(!tooltipElement){ return; } 
if(!($(this).attr('title'))){ 
$(this).attr('title',tooltipElement.text()); 
}
tooltipElement.remove(); 
tooltipCreatedFlag=false;
});
if(zhongFramework.tooltipsEnabledOnKeyboardFocus){
$(javascriptTooltipsTrigger).focusin(function(){
if($(this).attr('title')==='' || tooltipCreatedFlag){ return; }
tooltipCreatedFlag=true;
tooltipFather = $(this);
tooltipElement = $('<span class="tooltip-title with-top-arrow" aria-live="off">'+tooltipFather.attr('title')+'</span>');
$body.append(tooltipElement);
tooltipElement.fadeIn(460);
tooltipElementOuterWidth = tooltipElement.outerWidth();
tooltipElementOuterHeight = tooltipElement.outerHeight();
tooltipFatherOuterWidth = tooltipFather.outerWidth();
tooltipFatherOuterHeight = tooltipFather.outerHeight();
tooltipElement.css('min-width',tooltipElementOuterWidth+'px');
if(htmlInitialClass.indexOf('ie8') > -1){//Fix for the min-width/box-sizing bug in IE8
tooltipElement.css('min-width','0px');
}
tooltipPositionX=tooltipFather.offset().left+tooltipFatherOuterWidth/2-tooltipElementOuterWidth/2 - $window.scrollLeft();
tooltipPositionY=tooltipFather.offset().top+tooltipFatherOuterHeight+9 - $window.scrollTop(); 
//If the tooltip goes out of the boundaries, then also remove the arrow indicator ('width-arrow' class)
if( tooltipPositionX+tooltipElementOuterWidth > $window.width()-14 )
{ tooltipPositionX = $window.width()-tooltipElementOuterWidth-14; tooltipElement.removeClass('with-top-arrow'); }
if( tooltipPositionY+tooltipElementOuterHeight > $document.height()-16 )
{ tooltipPositionY = $document.height()-tooltipElementOuterHeight-16; tooltipElement.removeClass('with-top-arrow'); }
if( tooltipPositionX < 0 )
{ tooltipPositionX = 0; tooltipElement.removeClass('with-top-arrow'); }
tooltipElement
.css('left',tooltipPositionX)
.css('top',tooltipPositionY);
});
$(javascriptTooltipsTrigger).focusout(function(){
if(!tooltipElement){ return; }
tooltipElement.remove();
tooltipCreatedFlag=false;
});
}
if(zhongFramework.layoutMode === 'high-contrast' && zhongFramework.tooltipsEnabledOnAltHighContrast){
$('img').hover(function(){
var imageAlt = $(this).attr('alt');
if(imageAlt==='' || typeof imageAlt==='undefined' || imageAlt===false){ return; } 
//If there isn't any tooltip active, then create one!
else{
tooltipImgFather = $(this);
tooltipImgElement = $('<span class="tooltip-title with-bottom-arrow" aria-live="off"><strong>'+tooltipImgFather.attr('alt')+'</strong></span>');
$body.append(tooltipImgElement);
tooltipImgElement.fadeIn(460);
tooltipImgElementOuterWidth = tooltipImgElement.outerWidth();
tooltipImgElementOuterHeight = tooltipImgElement.outerHeight();
tooltipImgFatherOuterWidth = tooltipImgFather.outerWidth();
tooltipImgFatherOuterHeight = tooltipImgFather.outerHeight();
tooltipImgElement.css('min-width',tooltipImgElementOuterWidth+'px');
if(htmlInitialClass.indexOf('ie8') > -1){//Fix for the min-width/box-sizing bug in IE8
tooltipImgElement.css('min-width','0px');
}
tooltipImgFather.mousemove(function(e){
tooltipPositionX=tooltipImgFather.offset().left+tooltipImgFather.outerWidth()/2-tooltipImgElementOuterWidth/2 - $window.scrollLeft();
tooltipPositionY=tooltipImgFather.offset().top-tooltipImgElementOuterHeight-9 - $window.scrollTop();
if( tooltipPositionX+tooltipImgElementOuterWidth > $window.width()-14 )
{ tooltipPositionX = $window.width()-tooltipImgElementOuterWidth-14; tooltipImgElement.removeClass('with-bottom-arrow'); }
if( tooltipPositionY+tooltipImgElementOuterHeight > $document.height()-16 )
{ tooltipPositionY = $document.height()-tooltipImgElementOuterHeight-16; tooltipImgElement.removeClass('with-bottom-arrow'); }
if( tooltipPositionX < 0 )
{ tooltipPositionX = 0; tooltipImgElement.removeClass('with-bottom-arrow'); }
tooltipImgElement
.css('left',tooltipPositionX)
.css('top',tooltipPositionY);
});
}
},
function(){
if(!tooltipImgElement){ return; }
tooltipImgElement.remove();
});
}
}//~END javascriptTooltipsHandler()
function fontFaceFallback(){
if(!ZhongFramework.Modernizr.fontface){
if(!window.getComputedStyle){ return; }
includeScriptHead('',zhongFramework.cufonLib);
var zhongFrameworkIcons = $('.zhongframework-icon');
zhongFrameworkIcons.each(function(){
this.innerHTML = window.getComputedStyle(this, ':before').getPropertyValue('content');
});
var checkCufon = setInterval(function(){
if(typeof Cufon !== 'undefined'){ 
//Include the cufon icons JS
includeScriptHead('',zhongFramework.cufonZhongFrameworkIcons);
Cufon.replace('.zhongframework-icon');
Cufon.CSS.ready(function() {
zhongFrameworkIcons.each(function(){
this.className = this.className.replace(/zhongframework-icon-[^ ]*/g,'');
});
});
clearInterval(checkCufon);
}
},40);
}
}//~END fontFaceFallback
function internalAnchorsFocusHandler(){
var internalAnchors = $('.internal-anchor');
internalAnchors.click(function(){
var focusedElement = $(this.href.substring(this.href.indexOf("#")));
focusedElement.addTransition().addClass('focused-element-highlight-effect');
forceElementFocus(focusedElement);
(function(focusedElement){
setTimeout(function(){
focusedElement.addTransition().removeClass('focused-element-highlight-effect');
},400);
})(focusedElement);
});
}
$document.ready(function(){
if(htmlInitialClass.indexOf('ie7') > -1){
bodyInitialClass = bodyInitialClass.replace(/main-menu-alignment_[^ ]+/g,'main-menu-alignment_default');
bodyInitialClass = bodyInitialClass.replace(/main-menu-style_[^ ]+/g,'main-menu-style_horizontal-floating');
bodyInitialClass = bodyInitialClass.replace(/side-menu-style_[^ ]+/g,'side-menu-style_standard');
bodyInitialClass = bodyInitialClass.replace(/presentation-align-[^ ]+/g,'presentation-align-left');
bodyInitialClass = bodyInitialClass.replace(/presentation-align-[^ ]+/g,'presentation-align-left');
bodyInitialClass = bodyInitialClass.replace(/full-width-logo_[^ ]+/g,'full-width-logo_false');
document.body.className = bodyInitialClass;
}
internalAnchorsFocusHandler();
if( zhongFramework.layoutMode==='default-layout' ){
$body.addClass('accessibility-panel-hidden');
$accessibilityPanel.addClass('removed');
defaultLayoutModifications();
if(zhongFramework.isPortable && bodyInitialClass.indexOf('fixed-top-bar') > -1){
$body.removeClass('fixed-top-bar');
}
$('#show-accessibility-panel-button').click(function(){
toggleAccessibilityPanelVisibility();
});
$('#liquid-width-button').click(function(){ setLayoutWidthMode('liquid'); });
$('#fixed-width-button').click(function(){ setLayoutWidthMode('fixed'); });
$('#full-width-button').click(function(){ setLayoutWidthMode('full'); });
$document.keydown(function(e){
if (e.keyCode === 27 && !isAccessibilityPanelClosed){
hideAccessibilityPanel();
}
});
$accessibilityPanel.find('a,button').bind("blur",function(){
setTimeout(function(){
if( !$accessibilityPanel.find(document.activeElement).size() ){
hideAccessibilityPanel();
}
},0);
});
if(zhongFramework.topMenuFloating){ 
keyboardAccessibleMenu('#main-menu-container');
}
if(zhongFramework.sideMenuFloating){ 
keyboardAccessibleMenu('#main-body .menu-container');
}
if( bodyInitialClass.indexOf('side-menu-style_expandable') > -1 ){
expandableMenuHandler($('#main-body').find('.menu-container'), '.parent');
}
userLayoutWidthResizeHandler();
} 
if( zhongFramework.layoutMode==='full-access' ){
$('a[target="_blank"]')
.append('<span class="opens-new-window-link" title="'+zhongFramework.newWindowLinkText+'"> ( '+zhongFramework.newWindowLinkText+' )</span>');
//(Select all <a> elements that have 'href' starting with 'http://' && 'href' NOT CONTAINING 'site base url')
$('a[href^="http://"]:not(a[href*="'+zhongFramework.http_host+'"])')
.append('<span class="external-link" title="'+zhongFramework.externalLinkText+'"> ( '+zhongFramework.externalLinkText+' )</span>');
setTimeout(function(){
$('#layout-switcher-module').ctrlARIA('off').css('bottom','0');
},800);
} 
if( zhongFramework.layoutMode==='high-contrast' || zhongFramework.layoutMode==='full-access' ){
var collapsableModeButtonBeforeText = '';
var collapsableModeButtonAfterText = '';
if(bodyInitialClass.indexOf('high-contrast_menus-navigation-mode_collapsable') > -1){
collapsableModeButtonBeforeText = '<button class="collapsable-sub-menus-button text-hidden show-tooltip" title="';
collapsableModeButtonAfterText = '"></button>';
}
if(bodyInitialClass.indexOf('full-access_menus-navigation-mode_collapsable') > -1){
collapsableModeButtonBeforeText = '<button class="collapsable-sub-menus-button">';
collapsableModeButtonAfterText = '</button>';
}
if(collapsableModeButtonBeforeText!==''){
$('.menu-container .parent:not(.active)>ul')
.addClass('removed')
.parent().children('a')
.after(collapsableModeButtonBeforeText+zhongFramework.expandSubmenuTitle+collapsableModeButtonAfterText);
$('.menu-container .parent.active>ul')
.parent().children('a')
.after(collapsableModeButtonBeforeText+zhongFramework.hideSubmenuTitle+collapsableModeButtonAfterText)
.siblings('.collapsable-sub-menus-button').addClass('active');
$('.collapsable-sub-menus-button').click(function(){
var $this = $(this);
if($this.hasClass('active')){
$this.removeClass('active')
.parent().children('ul').addClass('removed');
if(zhongFramework.layoutMode==='high-contrast') $this.attr('title',zhongFramework.expandSubmenuTitle);
else $this.html(zhongFramework.expandSubmenuTitle);
}
else{
$this.addClass('active')
.siblings('ul').ctrlARIA('alive').removeClass('removed').ctrlARIA('reset');
if(zhongFramework.layoutMode==='high-contrast') $this.attr('title',zhongFramework.hideSubmenuTitle);
else $this.html(zhongFramework.hideSubmenuTitle);
}
});
}
} 
if( zhongFramework.layoutMode==='mobile-layout' ){
defaultLayoutModifications();
$('#night-mode-switcher').attr('role','button');
if( bodyInitialClass.indexOf('mobile_menus-navigation-mode_expandible') > -1 ){
expandableMenuHandler($('.menu-container'), '.parent');
}
if( zhongFramework.enableMobileMainMenuActivationButton || zhongFramework.enableMobileSideMenuActivationButton ){
var mobileMenuActivationButtonConstructor = function(menuID){
var showMenuButton =
'<div id="mobile-'+menuID+'-activation-button" class="mobile-menu-activation-button"><div></div></div>';
$('#'+menuID)
.addClass('visually-hidden')
.after(showMenuButton);
$('#mobile-'+menuID+'-activation-button').click(function(){
$(this).slideUp(function(){ this.remove(); });
$('#'+menuID)
.removeClass('visually-hidden')
.slideUp(0)
.slideDown(800);
setTimeout(function(){
$('#'+menuID).removeClass('transition-medium_all');
},800);
});
$('#'+menuID+' a').focus(function(){
if(!mobileMenusCollapsed[menuID]){ return; }
$('#mobile-'+menuID+'-activation-button').click();
mobileMenusCollapsed[menuID] = false;
});
};
var mobileMenusCollapsed = [];
if(zhongFramework.enableMobileMainMenuActivationButton){
mobileMenusCollapsed['main-menu-container'] = true;
mobileMenuActivationButtonConstructor('main-menu-container');
}
if(zhongFramework.enableMobileSideMenuActivationButton){
mobileMenusCollapsed['side-menu'] = true;
mobileMenuActivationButtonConstructor('side-menu');
}
}
var tobBarModulesActivationHandler = function($topBarActivatorButton, $topBarModule){
$topBarModule.slideToggle('slow');
if($topBarActivatorButton.hasClass('active')){
$topBarActivatorButton.removeClass('active');
}
else{
$topBarActivatorButton.addClass('active');
forceElementFocus($topBarModule);
}
};
$('#mobile-top-bar-tool_fontsize-button').click(
function(e){
e.preventDefault();
tobBarModulesActivationHandler( $(this), $('#mobile-top-bar_module-container_fontsize') );
});
$('#mobile-top-bar-tool_login-button').click(
function(e){
e.preventDefault();
tobBarModulesActivationHandler($(this), $('#mobile-top-bar_module-container_login') );
});
$('#mobile-top-bar-tool_search-button').click(
function(e){
e.preventDefault();
tobBarModulesActivationHandler($(this), $('#mobile-top-bar_module-container_search') );
});
$('#mobile-top-bar-tool_language-button').click(
function(e){
e.preventDefault();
tobBarModulesActivationHandler($(this), $('#mobile-top-bar_module-container_language') );
});
} 
if( zhongFramework.layoutMode==='default-layout' || zhongFramework.layoutMode==='mobile-layout' ){
$('#night-mode-switcher').attr('role','button');
$('#larger-font-button').click(function(){ biggerFontSize(true); });
$('#reset-font-button').click(function(){ revertFontSize(); });
$('#smaller-font-button').click(function(){ biggerFontSize(false); });
nightModeTransitionHandler();
scrollToTopAnimationHandler();
socialButtonsModuleHandler();
fontFaceFallback();
}
if( zhongFramework.layoutMode==='default-layout' || zhongFramework.layoutMode==='high-contrast' ){
javascriptTooltipsHandler();
}
}); /* ~~~ END "document.ready" ~~~ */
$window.load(function(){
if( zhongFramework.layoutMode==='default-layout' ){
sameHeightCustomModulesHandler();
stickySideColumnsHandler();
}
if( zhongFramework.layoutMode==='default-layout' || zhongFramework.layoutMode==='mobile-layout' ){
$(document.getElementById('main-body')).find('.accordion-block')
.wrapInner('<div class="accordion-block-inner"></div>')
.addClass('collapsed')
.append('<button class="accordion-block-readMore" aria-hidden="true"></button>')
.css('height',function(){
return $(this).find('.accordion-block-inner').height()/100*20+$(this).find('.accordion-block-readMore').innerHeight()+6;
})
.find('.accordion-block-readMore').click(function(){
var $accordionBlockOuter = $(this).parent();
if($accordionBlockOuter.hasClass('collapsed')){
$accordionBlockOuter
.removeClass('collapsed')
.addTransition('fast')
.css('height',function(){ 
return $accordionBlockOuter.find('.accordion-block-inner').height()+$accordionBlockOuter.find('.accordion-block-readMore').innerHeight()+6;
});
}
else{
$accordionBlockOuter
.addClass('collapsed')
.addTransition('fast')
.css('height',function(){ 
return $accordionBlockOuter.find('.accordion-block-inner').height()/100*20+$accordionBlockOuter.find('.accordion-block-readMore').innerHeight()+6;
});
}
}); 
}
if(zhongFramework.enableSocialButtonsModule){
if(!zhongFramework.enableSocialButtonsModuleExpandable || 
zhongFramework.layoutMode==='high-contrast' ||
zhongFramework.layoutMode==='full-access'){ zhongFramework.initializeSocialButtons(); }
}
setTimeout(function(){
//Do the scrolling only if portable
if($window.scrollTop()===0 && zhongFramework.isPortable){
window.scrollTo(0,1);
}
},1);
}); /* ~~~ END "window load" ~~~ */
})(jQuery); 
