(function(){ var addEventsBackup = window.addEvents; window.addEvent('domready', function(){window.addEvents = addEventsBackup;}); }()) window.addEvent('domready', function() { if ($('filter-button') != undefined ) { $('filter-button').setStyle('display', 'none'); } $$('input[type=checkbox]').each(function(el) { if (el.get('name') == 'requiredfields') { el.addEvent('click', function(ev) { $('filter-form').submit(); }); } }); }); /* Slimbox fix, needed to remove the rel-attribute to avoid duplicate images in gallery on product pages */ window.addEvent('domready', function() { $$('.prodImg').each(function(el) { $$([el.getElement('a'), $$('.imgZoom a')]).addEvent('click', function(ev){ var url = this.get('href'); $$('.box_prodImg > a').filter(function(el){ return el.get('href') === url; }).fireEvent('click', ev); ev.stop(); }); }); }); window.addEvent('domready', function(){ /* Social Media Icons */ $$('.social_media_teaser_item > a').each(function(el){el.confirmLinkClick('You are leaving the website...')}); /* Different TR Colors */ if ( $$('.c_table tr:odd').length > 0 ){ $$('.c_table tr:odd').addClass('even');} if ( $$('.n_table tr:odd').length > 0 ){ $$('.n_table tr:odd').addClass('even');} if (Browser.Engine.trident && Browser.version == 7) { var conImg = $$('.lightbox_image'); if (conImg === null) return; conImg.each(function(el) { lgtImg = el.getElement('img'); var sizeY = lgtImg.getStyle('height'); el.setStyle('height', sizeY); }.bind(this)); } }); String.implement({//simple regex doesn't work in ie. entityDecode: function(){ var replacements = new Hash({'lt':'<','gt':'>','amp':'&','quot':'"','#039':"'"}); return ( this.replace( new RegExp('&('+replacements.getKeys().join('|')+');', "gi"), function(replaceStr){return replacements[replaceStr.replace('&', '').replace(';', '')];} )); } }); window.addEvent('domready', function(){ /*FFx2 fix for navigation*/ if((function x(){})[-6]=='x'){ var p = $('box_navTop'); var e = p.getElement('.navTop').setStyle('float','left'); var ed = e.getDimensions(); var pd = p.getDimensions(); var pp = parseInt(p.getStyle('padding-left'), 10) + parseInt(p.getStyle('padding-right'), 10); var m = ((pd.width - pp) - (ed.width))/2; e.setStyles({'margin-left': m}); } /*last contxt margin*/ var lastCtxt = $$('.box_contxt div.space_b20'); if(lastCtxt && lastCtxt.length > 0){ lastCtxt[lastCtxt.length-1].setStyle('margin-bottom', 0); } /* TABSWAPPER */ if($$('.cnt_tabcontainer_tabset') != undefined) { $$('.cnt_tabcontainer_tabset').setStyle('visibility', 'visible'); } if($$('.cnt_tabcontainer_panelheading') != undefined) { $$('.cnt_tabcontainer_panelheading').setStyle('display', 'none'); } if($$('.box_cnt_tabcontainer') != undefined) { $$('.box_cnt_tabcontainer').each(function(element){ if(element.id != undefined) { var id = element.id; /* Prepare language-filtered tabs */ var filterTabs = element.getElements('.tab:not([data-filter-list=""])[data-filter-list]'); if(filterTabs.length){ var i = 0, firstContent = $$('#'+id+' div.cnt_tabcontainer_panelset div.cnt_tabcontainer_panel')[0], activeFilter, clonedContent, filteredElementsCount, itemCountElement; while (i < filterTabs.length) { activeFilter = filterTabs[i].get('data-filter-list'); filteredElementsCount = 0; clonedContent = firstContent.clone(); itemCountElement = clonedContent.getElement('.itemcount'); if(itemCountElement){itemCountElement.set('text','0');} //only works for one 'count' per tab. clonedContent.getElements('[data-filter-list]').each(function(el, i){ if(el.get('data-filter-list').indexOf(activeFilter) !== -1) {//element visible filteredElementsCount++; } else { el.destroy(); } }); if(itemCountElement) {itemCountElement.set('text', filteredElementsCount);} clonedContent.inject(element.getElement('.cnt_tabcontainer_panelset')); i++; } firstContent.destroy(); } //end filtered tabs var tabset_wrapper = element.getElement('.cnt_tabcontainer_tabset_wrapper'); if (tabset_wrapper != null){ var containerWidth = tabset_wrapper.getComputedSize().width; var nextPrev = element.getElements('.cnt_tabbox_left, .cnt_tabbox_right'); }; if (nextPrev != null) { var checkTabVisibility; var tabScroll; }; var ts; ts = new TabSwapper({ selectedClass: 'on', deselectedClass: 'off', tabs: $$('#'+id+' li.tab'), clickers: $$('#'+id+' li.tab a'), sections: $(id).getElements('.cnt_tabcontainer_panel'), /*use transitions to fade across*/ smooth: false, smoothSize: false//, //cookieName: 'tabPosition'+id }); if (tabset_wrapper && nextPrev) { if(!nextPrev.length){//if no arrows present: abort the rest. return; } if($$('#'+id+' li.tab').length < 2){ nextPrev.hide(); return; } checkTabVisibility = function(el, offset){ var c = el.getCoordinates(element); return (c.right < containerWidth + offset) && (c.left >= 0); } tabScroll = new Fx.Scroll(element.getElement('.cnt_tabcontainer_tabset_wrapper')) .addEvents({'complete': function(ev){ ts.tabs.each(function(tab, i){ tab.tween('opacity', checkTabVisibility(tab, i) ? 1 : 0 ); if (tab.getNext() != undefined) { tab.getNext().setStyle('border-left', checkTabVisibility(tab, i) ? 'none' : '1px solid #CCCCCC'); } if (tab.getPrevious() == undefined && tab.getStyle('border-left').contains('none')) { tab.setStyle('border-left', '1px solid #CCCCCC'); } }); }}); ts.addEvents({ 'active': function(idx, actContent, actTab){ if(!checkTabVisibility(actTab, idx)){ var activeScroll = tabScroll.element.scrollLeft c = actTab.getCoordinates(element), newScrollValue = (c.right > containerWidth) ? (c.right + (idx*2) - containerWidth) : c.left; tabScroll.start(activeScroll + newScrollValue, 0); } nextPrev[0].tween('opacity', idx === 0 ? 0.5 : 1); nextPrev[1].tween('opacity', idx === ts.tabs.length-1 ? 0.5 : 1); (function(){ tabScroll.fireEvent('complete'); }.delay(2)); } }); nextPrev[0].setStyle('opacity', 0.5); element.getElement('.cnt_tabbox_left').addEvent('mousedown', function(ev){ //console.log('prev '+ ts.now); ev.stop(); ts.show(ts.now - 1); }); element.getElement('.cnt_tabbox_right').addEvent('mousedown', function(ev){ //console.log('next '+ ts.now); ev.stop(); ts.show(ts.now + 1); }); /* fade that */ tabScroll.start(0,0).fireEvent('complete'); } } }); } //.cnt_tabcontainer_panel (not exclusively) - sadly, IE gets confused when copying elements before, so we can't use simple selectors: $(document.body).getElements('.cnt_more_info_list').each(function(el){var lis = el.getChildren(); if(lis.length>0){lis[lis.length-1].setStyles({ 'margin-bottom': 0, 'border-bottom': 0 });}}); /* ACCORDIONs */ //normal accordions don't support multiple opened sections. so, this happened. var MultiAccordion=new Class({Extends:Accordion,display:function(e,t){if(!this.check(e,t))return this;var n={},r=this.elements,i=this.options,s=this.effects;if(t==null)t=true;if(typeOf(e)=="element")e=r.indexOf(e);if(e==this.previous&&!i.alwaysHide)return this;if(i.resetHeight){var o=r[this.previous];if(o&&!this.selfHidden){for(var u in s)o.setStyle(u,o[s[u]])}}if(this.timer&&i.link=="chain"||e===this.previous&&!i.alwaysHide)return this;this.previous=e;this.selfHidden=false;r.each(function(r,o){n[o]={};var u;if(o!=e){return}else if(i.alwaysHide&&(r.offsetHeight>0&&i.height||r.offsetWidth>0&&i.width)){u=true;this.selfHidden=true}this.fireEvent(u?"background":"active",[this.togglers[o],r]);for(var a in s)n[o][a]=u?0:r[s[a]];if(!t&&!u&&i.resetHeight)n[o].height="auto"},this);this.internalChain.clearChain();this.internalChain.chain(function(){if(i.resetHeight&&!this.selfHidden){var t=r[e];if(t)t.setStyle("height","auto")}}.bind(this));return t?this.start(n):this.set(n).internalChain.callChain()}}) $$('.box_cnt_accordion').each(function(element){ if(!element.id) { element.id = element.uid; } var multipleOpenAllowed = element.hasClass('cnt_accordion_sit'); if(element.id != undefined) { var id = element.id; var myAccordion = ''; var display = 0; //check for id in a[name] in toggler... var show = 0; if(window.location.hash.replace('#','').toInt()){ var el = $$('#'+id+' .cnt_accordion_toggle a').filter(function(link){ return link.get('name')==window.location.hash.replace('#',''); })[0]; if(el){ var ev = el.getParent(); var show = ev.getAllPrevious('.cnt_accordion_toggle').length; } } if (element.getElements('.cnt_accordion_step').length == 0) { // dont execute it in faq if(element.getChildren().length != 0){ element.getLast('.cnt_accordion_toggle').setStyles({ 'margin-bottom': 0, 'border-bottom': 0 }); } } else { show = false; display = -1; } if(!multipleOpenAllowed) { var myAccordion = new Accordion($$('#'+id+' .cnt_accordion_toggle'), $$('#'+id+' .cnt_accordion_content'), {'show':show, 'opacity':false, 'display': display}); } else { var myAccordion = new MultiAccordion($$('#'+id+' .cnt_accordion_toggle'), $$('#'+id+' .cnt_accordion_content'), {'show':show, 'opacity':false, 'display': display, alwaysHide: true}); var numAccordionToggle = 0; $$('#'+id+' .cnt_accordion_toggle').each(function(element){ if(numAccordionToggle == 0 && display >= 0) { element.addClass('on'); } else { element.addClass('off'); } numAccordionToggle++; }); myAccordion.addEvent('active', function(toggler, element){ toggler.removeClass('off'); toggler.addClass('on'); toggler.setStyles({ 'margin-bottom': '1px', 'border-bottom': '1px solid #ccc' }); /* fix */ $(id).setStyle('position', 'relative'); }); myAccordion.addEvent('background', function(toggler, element){ toggler.addClass('off'); toggler.removeClass('on'); toggler.setStyles({ 'margin-bottom': 0, 'border-bottom': 0 }); }); } } }); /*more_info_list*/ $$('ul.cnt_more_info_list li').each(function(element){ var parent = element.getParent(); if (!parent.hasClass('cnt_article_list') && !parent.hasClass('no_hover')) { if(!element.hasClass('heading') && !element.hasClass('padding') && element.getElement('div.descr') != null && element.getElement('div.strong') != null){ element.addEvent('mouseenter', function(event){ element.addClass('hover'); }); element.addEvent('mouseleave', function(event){ element.removeClass('hover'); }); } } }); $$('ul.cnt_more_info_list li.padding').each(function(element){ element.addEvent('mouseenter', function(event){ element.addClass('hover'); }); element.addEvent('mouseleave', function(event){ element.removeClass('hover'); }); element.addEvent('click', function(event){ var link = element.getElement('a'); var url = link.href; try{}catch(err){if(typeof link.onclick == 'function'){link.onclick();}} event.stop(); event.stopPropagation(); if(link.hasClass('popup')){ link.fireEvent('click', event); } else { if(link.get('target') == '_blank'){ popNewWin(url); return; } else { window.location = url; } } }); }); /*little helper*/ $$('.box_cnt_glossar .box_cnt_accordion div.on').each(function(element){ element.addEvent('mouseenter', function(event){element.addClass('hover');}); element.addEvent('mouseleave', function(event){element.removeClass('hover');}); }); $$('#frame_cnt a.popup, #frame_left a.popup').addEvent('click', function(ev){ if(this.retrieve('requires-confirmation')){return;}//optionally written to link by "Element.confirmLinkClick()". Handles below code as well. ev.stop(); var dimensions = [800, 600]; if(this.rel && this.rel.test(/^popup/i)){ dimensions = this.rel.replace(/[[]|]/gi," ").split(' ')[1].split('x'); } if(this.hasClass('scroll')){ popGenericScroll(this.href, dimensions); return; } popGeneric(this.href, dimensions); }); /*END DOMREADY*/ }); /*quicksearch*/ var cachedQuickFinder = null; function loadQuickFinder(ulelement){ var jsonUrl = document.location.protocol+'//' + document.location.hostname+'/cps/rde/xchg/cw-bbraun-en-us/hs.xsl/productqf.json.txt'; if(cachedQuickFinder == null) { var jsonRequest = new Request.JSON({url: jsonUrl, onComplete: function(result) { cachedQuickFinder = result; fillQuickFinder(ulelement, result); }}).get(); } } function fillQuickFinder(ulelement, result){ if(!result){return;} var resSize = result.length; ulelement = $(ulelement); var mainEls = ulelement.getChildren(); for(var i=0; i < resSize; i++){ var numSubRes = result[i].sub; if(numSubRes.length){ mainEls[i].adopt(createQuickFinderlist(result[i].sub)); } } quickFinderEvents(ulelement); } function createQuickFinderlist(productList){ var numItems = productList.length; var ulEl = new Element('ul'); var liEls = []; var linkBase = document.location.protocol+'//' + document.location.hostname+'/cps/rde/xchg/cw-bbraun-en-us/hs.xsl/'; for (var i = 0;i < numItems;i++){ liEls[i] = new Element('li').adopt(new Element('a', {'href':linkBase+productList[i].url, 'html': productList[i].name+' '})); if(productList[i].sub.length > 0){ liEls[i].adopt(createQuickFinderlist(productList[i].sub)) } ulEl.adopt(liEls[i]); } return ulEl; } function quickFinderEvents(ulelement){ ulelement.getElements('li').each(function(el) { if(el.getElements('ul').length > 0) { el.addEvent('mouseenter', function(ev){ el.store('mouseentered', true); (function(){ if(!el.retrieve('mouseentered')){return;} el.getElement('a').setStyle('color', '#C2284E'); var ul = el.getElement('ul'); ul.setStyle('display', 'block'); ul.setStyle('z-index', '1000'); ul.setStyle('height', 'auto'); if((ul.getSize().y -2) > (ulelement.getSize().y)-1) { ulelement.getParent().getElements('ul').setStyle('height', ul.getSize().y-2); }else { ul.setStyle('height', (ulelement.getSize().y)-1); } ie6QuickFinderFrame(ulelement, ul); if(el.getParent().getParent().tagName == 'DIV'&& !Browser.Engine.trident){//only first sublevel el.getElement('ul').setStyle('opacity', 0.9); } }).delay(500); }); el.addEvent('mouseleave', function(ev){ el.store('mouseentered', false); var mouseLeaveFunc = function(el) { if(this.retrieve('mouseentered')) { return; } this.getElement('ul').setStyle('display', 'none'); ie6QuickFinderFrame(ulelement, this.getElement('ul')); if(this.getParent().getParent().tagName == 'DIV' && !Browser.Engine.trident) //only first sublevel this.getElement('ul').setStyle('opacity', 1); var topList = this.getParent('ul.quicksearch_list'); var shownElement = false; //restore initial height if necessary topList.getElements('ul').each(function(el){ if(el.getStyle('display') == 'block'){shownElement = true;} }); if(!shownElement){ topList.setStyle('height', 'auto'); } ie6QuickFinderFrame(ulelement, this.getElement('ul')); } mouseLeaveFunc.delay(500, el); el.getElement('a').setStyle('color', '#666'); el.getElement('ul').setStyle('z-index', '1'); }); } }); } function ie6QuickFinderFrame(ul, ulelement){ if(!Browser.Engine.trident || !Browser.ie6) { return; } var ieFrame = $$('#ie6PrQuIframe'); if(ieFrame.length == 0) { var ieFrame = new Element('iframe',{'src':'about:blank', 'id':'ie6PrQuIframe'}).inject(ul, 'before'); } if(ul.style.display !== 'block'){ ieFrame.setStyles({'width':0, 'height':0, 'display': 'none'}); return; } var maxX = 0; $$('.box_QuickFinder ul').each(function(el){ if(el.getPosition().x > maxX) { maxX = el.getPosition().x; } }); var iHeight = ul.getSize().y; ieFrame.setStyles({ 'display':'block', 'width': maxX + 117, 'height': iHeight, 'border': 0 }); } window.addEvent('domready', function(){ /*QUICKFINDER*/ /* hide last border, first level */ $$('ul.quicksearch_list > li:last-child').each(function(element){ element.setStyle('border-bottom-width', '0px'); }); /*init quickfinder*/ $$('#frame_left > .box_QuickFinder').each(function(element) { var trigger = element.getElement('img.quicksearch_trigger'); var triggered = element.getElement('img.quicksearch_triggered'); var quicksearch_list = element.getElement('.quicksearch_list'); if(trigger != null && triggered != null && quicksearch_list != null) { var clickfunc = function(ev){ $$([trigger, triggered, quicksearch_list]).toggle(); if(quicksearch_list.style.display === 'block' && !quicksearch_list.retrieve('modified')){ quicksearch_list.store('modified', true); loadQuickFinder(quicksearch_list); var menuHeight = quicksearch_list.getSize().y; quicksearch_list.getElements('ul').setStyle('height', menuHeight-1); } ie6QuickFinderFrame(element, element.getElement('ul')); } element.getElement('.quickfinder_head').addEvent('click', clickfunc); if(element.hasClass('on')){ clickfunc('automatic'); } } }); /*END DOMREADY*/ }); /*TOP Navigation Slider for Products USA*/ (function(){ /*quicksearch*/ //var cachedQuickFinder = null; var loadQuickFinder = function loadQuickFinder(ulelement){ var jsonUrl = document.location.protocol+'//' + document.location.hostname+'/cps/rde/xchg/cw-bbraun-en-us/hs.xsl/productqf.json.txt'; if(cachedQuickFinder == null) var jsonRequest = new Request.JSONP({url: jsonUrl, onComplete: function(result){ cachedQuickFinder = result; fillQuickFinder(ulelement, result); }}).send(); else{ //fillQuickFinder(ulelement, cachedQuickFinder); } } var fillQuickFinder = function fillQuickFinder(ulelement, result){ if(!result){return;} var resSize = result.length; ulelement = $(ulelement); var mainEls = ulelement.getChildren(); for(var i=0; i < resSize; i++){ var numSubRes = result[i].sub; if(numSubRes.length){ mainEls[i].adopt(createQuickFinderlist(result[i].sub)); } } quickFinderEvents(ulelement); } var createQuickFinderlist = function createQuickFinderlist(productList){ var numItems = productList.length; var ulEl = new Element('ul'); var liEls = []; var linkBase = document.location.protocol+'//' + document.location.hostname+'/'; for (var i = 0;i < numItems;i++){ liEls[i] = new Element('li').adopt(new Element('a', {'href':linkBase+productList[i].url, 'html': productList[i].name+' '})); if(productList[i].sub.length > 0){ liEls[i].adopt(createQuickFinderlist(productList[i].sub)) } ulEl.adopt(liEls[i]); } return ulEl; } var quickFinderEvents = function quickFinderEvents(ulelement){ var tmp, isFaultyIE = Browser.Engine.trident && ( /Windows NT 5.1/.test(navigator.userAgent) || /Windows NT 6.0/.test(navigator.userAgent) ); var activeHoverEl; //dismiss hover when already 'out of date' to reduce client load & flickering. var touchHref, longTouch; if( /Safari/.test(navigator.userAgent) && /Mobile/.test(navigator.userAgent)){ ulelement.getElements('a').addEvents({ 'touchstart':function(ev){ var href = this.get('href'); touchHref = href; window.setTimeout(function(){ longTouch = (href == touchHref); }, 500); }, 'touchend':function(ev){ if((longTouch || this.getParent('li').getElements('ul').length === 0) && this.get('href') == touchHref){ window.location = touchHref; }else if(this.get('href') == touchHref) { this.store('mouseentered', true); activeHoverEl = this; this.fireEvent('mouseenterdelayed', ev); } longTouch = false; touchHref = false; }, 'click': function(ev){ ev.stop().preventDefault(); } }); } if(isFaultyIE){ ulelement.addEvent('mouseenter', function(ev){//dimensions are calculated wrong when !:hover $$('.quicksearch_listTop > li > ul').setStyle('width', 156); }); } ulelement.getElements('li').each(function (el) { el.addEvents({ 'mouseenter': function (ev) { this.store('mouseentered', true); activeHoverEl = this; this.fireEvent.delay(500, this, 'mouseenterdelayed', ev); }, 'mouseleave': function (ev) { this.store('mouseentered', false); this.fireEvent.delay(500, this, 'mouseleavedelayed', ev); } }); if (isFaultyIE) {//workaround vista ie el.addEvents({ 'mouseenterdelayed': function (force) { if(activeHoverEl !== this && !force){return;} var subulist = $$(this.getParents('ul').filter(function(el){return !el.hasClass('navTop')})), levelmod = 2, subul = this.getElement('ul'); if (subul) { subul.style.display = 'block'; subulist.each(function (ul, i) { if(i == subulist.length - 2) {//second ul needs a px more to look right: ul.style.width = (((i + 1) * 157)) + 'px'; }else { ul.style.width = (((i + levelmod) * 157)-1) + 'px'; } }); } }, 'mouseleavedelayed': function () { this.getParent('li').fireEvent.delay(10, this.getParent('li'), 'mouseentered'); } }); } if(el.getElements('ul').length > 0) { //has submenus el.addEvents({ mouseenterdelayed: function (ev) { var ul = el.getElement('ul'); if (!el.retrieve('mouseentered')) {return;} el.getElement('a').style.color = '#C2284E'; var ul = el.getElement('ul'); ul.style.height = 'auto'; ul.style.zIndex = '1000'; ul.style.display = 'block'; if((ul.getSize().y -2) > (ulelement.getSize().y)-1) { ulelement.getParent().getElements('ul').setStyle('height', ul.getSize().y-2); }else { ul.style.height = (ulelement.getSize().y)-2 + 'px'; } }, mouseleavedelayed: function (ev) { var topList; if (this.retrieve('mouseentered')) { return; } if(isFaultyIE){//IE Vista workaround part 2 var parents = this.getParents('ul').length; var subulist = $$(this.getParents('ul').filter(function(el){return !el.hasClass('navTop')})); subulist.pop(); subulist.each(function (ul, i) { ul.style.width = (((i + 1) * 157) - 1) + 'px'; }); ulelement.style.width = (((parents - 1) * 157) - 1) + 'px'; } this.getElement('ul').setStyle('display', 'none'); topList = ulelement; if(topList){ var shownElement = false; //restore initial height if necessary topList.getElements('ul').each(function(el){ if(el.style.display == 'block'){shownElement = true;} }); if(!shownElement){ topList.setStyle('height', 'auto'); } } } }) } }); } var ie6QuickFinderFrame = function ie6QuickFinderFrame(ul, ulelement){ if(!Browser.Engine.trident) { return; } var ieFrame = $$('#ie6PrQuIframe'); if(ieFrame.length == 0) { var ieFrame = new Element('iframe',{'src':'about:blank', 'id':'ie6PrQuIframe'}).inject(ul, 'before'); } if(ul.style.display == 'none'){ ieFrame.setStyles({'width':0, 'height':0, 'display': 'none'}); return; } var maxX = 0; $$('.box_QuickFinderTop ul').each(function(el){ if(el.getPosition().x > maxX) { maxX = el.getPosition().x; } }); var iHeight = ul.getSize().y; ieFrame.setStyles({ 'display':'block', 'width': maxX + 117, 'height': iHeight }); } window.addEvent('domready', function(){ /*QUICKFINDER Top Navigation*/ /*init quickfinder Top Navigation*/ $$('#frame_top > .box_QuickFinderTop').each(function(element) { var quicksearch_list = element.getElement('.quicksearch_listTop'); var clickfunc = function(ev){ if(!quicksearch_list.retrieve('modified')){ if(cachedQuickFinder)quicksearch_list.store('modified', true); var menuHeight = quicksearch_list.getSize().y; quicksearch_list.getElements('ul').setStyle('height', menuHeight-1); } } element.getElement('.quicksearch_listTop').addEvent('mouseenter', clickfunc); loadQuickFinder(quicksearch_list); }); /*END DOMREADY*/ }); })() /* AUTOCOMPLETER*/ var startedAutoCompleteString = ''; //prevent new requests before the first one completes var cachedAutoCompleteString = ''; var cachedAutoCompleteResult = {}; window.addEvent('domready', function(){ $$('input.search_input').each(function(element){ element.store('orgvalue', element.value); element.addEvent('focus', function(event){ if(event.target.value==event.target.retrieve('orgvalue')) event.target.value=""; }); element.addEvent('blur', function(event){ if(event.target.value=="") { event.target.value=event.target.retrieve('orgvalue'); } }); }); $$('#main_search').each(function(element){ element.addEvent('keydown', function(event){ (function(){ var search = event.target.value; if(search.length < 2) { bbraunAutocomplete({}, ''); return; } bbraunAutocompleteSearch(search.trim()); }).delay(30); }); }); $(document.body).addEvent('click', function(ev){ var bsa = $('box_search_autocomplete'); if(!bsa){return;} if(bsa.style.display == 'block' && !$(ev.target).getParent('#box_search_autocomplete')){ bsa.style.display = 'none'; } }); }); function bbraunAutocompleteSearch(searchString) { if(cachedAutoCompleteString.length == 0 || searchString.match(cachedAutoCompleteString) == null) { if(startedAutoCompleteString != '' && searchString.match(startedAutoCompleteString) !== null){ return; //prevent unnecessary requests } } var jsonUrl = document.location.protocol+'//' + document.location.hostname+'/cps/rde/xchg/cw-bbraun-en-us/'; searchString = $('main_search').value; startedAutoCompleteString = searchString; var jsonRequest = new Request({url: jsonUrl + "hs.xsl/getSuggestions.txt", onComplete: function(resultText) { if(!resultText.contains('{')){ var result = {}; } else { var result = JSON.decode(resultText.trim()); } cachedAutoCompleteString = searchString; if (!result.length) { bbraunAutocomplete(cachedAutoCompleteResult, searchString); } else { cachedAutoCompleteResult = result; bbraunAutocomplete(result, ''); } }}).get({'q': searchString.trim(),'date':Date.now()}); } function bbraunAutocomplete(obj, filterStr) { filterStr = $('main_search').value; $('box_search_autocomplete').empty(); var newResult = new Element('ul'); if(obj.length > 0) { var i = 0; obj.each(function(result){ if (i < 10) { var docCheckVisible = ((result.doccheck && result.sessDocCheck) || !result.doccheck || (result.sessDisclaimerConfirmed && result.disclaimer && result.doccheck)); var showDisclaimer = result.disclaimer && !result.sessDisclaimerConfirmed; if(filterStr != '') { var hit = true; var splitFilter = filterStr.split(" "); for (var count = 0; countProducts' }); var viewAllLi = new Element('li', { 'class': 'search_autocomplete_footer', 'html': 'View all search results' }).addEvent('click', function(ev){$(document.body).getElement('form').submit();}); if(newResult.getChildren().length > 0) { headlineLi.inject(newResult, 'top'); viewAllLi.inject(newResult, 'top'); $('box_search_autocomplete').setStyle('display', 'block'); $('box_search_autocomplete').setStyle('opacity', 0.9); } else { $('box_search_autocomplete').setStyle('display', 'none'); } if(filterStr.length < 2){ $('box_search_autocomplete').setStyle('display', 'none'); } newResult.inject($('box_search_autocomplete')); } function bbraunAutocompleteNewSection(name, teaser, image, url, docCheckVisible, showDisclaimer) { var imgStr = ""; var jsonUrl = document.location.protocol+'//' + document.location.hostname+'/cps/rde/xchg/cw-bbraun-en-us/hs.xsl/'; if(image != "") { imgStr = '' + name + ''; } if(docCheckVisible) { teaser = teaser.entityDecode(); } else { teaser='This page is DocCheck-protected. DocCheck is an identification-service for physicians and apothecaries on the internet. Please login first in order to receive a password. After having received a password, you can login.'; } if(showDisclaimer) { teaser='This information is meant for medical professionals only. Please confirm that you are a medical professional before accessing this information. '; } else { teaser = teaser.entityDecode(); } return new Element('li', { 'html': '' + imgStr + '' + name.entityDecode() + '' + teaser + '' }); } /*TOOLTIPS*/ //remove the flipping behaviour Tips.implement( { position: function(event){ if (!this.tip) document.id(this); var size = window.getSize(), scroll = window.getScroll(), tip = {x: this.tip.offsetWidth, y: this.tip.offsetHeight}, props = {x: 'left', y: 'top'}, bounds = {y: false, x2: false, y2: false, x: false}, obj = {}; for (var z in props){ obj[props[z]] = event.page[z] + this.options.offset[z]; if (obj[props[z]] < 0) bounds[z] = true; } this.fireEvent('bound', bounds); this.tip.setStyles(obj); } } ); //init window.addEvent('domready', function(){ var myTips = new Tips('a.tooltipArea', {className:'toolTipContainer'}); $$('a.tooltipArea').each(function(el){ el.store('tip:text', el.getAttribute('rel')+' '); //add nonbreaking space -> opacity on firefox sometimes renders last char incorrectly }); myTips.addEvent('show', function(tip){ tip.setStyles({'visibility':'visible', 'opacity': 0.9}); }); //small ones ('websites'-page) var myTipsSmall = new Tips('a.tooltipAreaSmall', {className:'toolTipContainerSmall'}); $$('a.tooltipAreaSmall').each(function(el){ el.store('tip:text', el.getAttribute('rel')+' '); }); myTipsSmall.addEvent('show', function(tip){ tip.setStyles({'visibility':'visible', 'opacity': 0.9}); }); var myTipsImage = new Tips('a.tooltipImage', {className:'toolTipContainerImage'}); $$('a.tooltipImage').each(function(el){ el.store('tip:text', ''); }); myTipsImage.addEvent('show', function(tip){ tip.setStyle('visibility', 'hidden'); tip.store('ismouseover', true); (function(){ if(tip.retrieve('ismouseover')){ tip.setStyle('visibility', 'visible'); } }.delay(500)); }).addEvent('hide', function(tip){ tip.store('ismouseover', false); }); }); /* CHOOSE LOCATION */ window.addEvent('domready', function(){ $$('.box_imgMap .continent_chooser a, .box_imgMap map area').each(function(el){ el.addEvent('click', function(ev){ $$('.box_imgMap .continent_chooser a').setStyle('font-weight', 'normal'); ev.target.setStyle('font-weight', 'bold'); var searchFor = ev.target.getAttribute('rel'); if(!$$('.box_imgMap .choose_location').length){return;} $$('.box_imgMap .choose_location')[0].getChildren().setStyle('display', 'none'); $$('.box_imgMap .choose_location .continent')[0].setStyle('display', 'inline'); var contRequest = new Request({method: 'get', url: searchFor, onSuccess: function(responseText, responseXML){ responseText = this.response.text; responseXML = this.response.xml; $$('.box_imgMap .choose_location .continent')[0].innerHTML = responseText; //get links in continent $$('.box_imgMap .choose_location .continent')[0].getElements('a').addEvent('click', function(event){ $$('.box_imgMap .choose_location .continent a').setStyle('font-weight', 'normal'); event.target.setStyle('font-weight', 'bold'); var searchFor = event.target.getAttribute('rel'); $$('.choose_location .country, .choose_location .location').setStyle('display', 'none'); $$('.choose_location .country')[0].setStyle('display', 'inline'); var countrRequest = new Request({method: 'get', url: searchFor, onSuccess: function(responseText, responseXML){ responseText = this.response.text; responseXML = this.response.xml; $$('.box_imgMap .choose_location .country')[0].innerHTML = responseText; //get links in continent $$('.box_imgMap .choose_location .country')[0].getElements('a').addEvent('click', function(event){ $$('.box_imgMap .choose_location .country a').setStyle('font-weight', 'normal'); event.target.setStyle('font-weight', 'bold'); var searchFor = event.target.getAttribute('rel'); $$('.choose_location .location')[0].setStyle('display', 'inline'); var locRequest = new Request({method: 'get', url: searchFor, onSuccess: function(responseText, responseXML){ responseText = this.response.text; responseXML = this.response.xml; $$('.box_imgMap .choose_location .location')[0].innerHTML = responseText; }}).send(); event.stop(); }); }}).send(); event.stop(); }); }}).send(); ev.stop(); }); }); $$('#box_imgMap_map').each(function(el){ el.store('oldsrc', el.getProperty('src')); }); $$('.continent_chooser a, .box_imgMap map area').each(function(el){ el.addEvent('mouseout', function(){ $('box_imgMap_map').setProperty('src', $('box_imgMap_map').retrieve('oldsrc')); }); el.addEvent('mouseover', function(ev){ $$('#box_imgMap_map').setProperty('src', alternateImages[el.getAllPrevious().filter(function(el){return (el.get('tag')=='a' || el.get('tag')=='area') }).length]); }); el.addEvent('click', function(ev){ $$('#box_imgMap_map').store('oldsrc', $('box_imgMap_map').getProperty('src')); }); }); $$('.box_imgMap map area').each(function(el){ el.addEvent('click', function(ev){ var elNum = el.getAllPrevious().length; $$('.box_imgMap .continent_chooser a')[elNum].setStyle('font-weight', 'bold'); }); }); }); /* PRINT */ window.addEvent('domready', function(e){ $$('a.print').each(function(el){ el.addEvent('click', function(ev){ ev.stop(); //do not follow href... ev.stopPropagation(); if(el.hasClass('print2')){ //press release: more width var printWindow = window.open(el.href, "bbraun_print2", 'status=0,toolbar=0,location=0,menubar=0,directories=0,scrollbars=1,height=689,width=666'); } else { var printWindow = window.open(el.href, "bbraun_print", 'status=0,toolbar=0,location=0,menubar=0,directories=0,scrollbars=1,height=689,width=488'); } printWindow.onload = function(){ if (window.focus) {printWindow.focus();} }; }); }); if(!$(document.body).hasClass('pdf') && typeof $('box_navTop') == 'object')if($$('#box_navTop')[0] && $$('#box_navTop')[0].getStyle('display')=='none'){ $$('.box_contxt').each(function(el){ if($$('.box_cnt')[1]){ el.inject($$('.box_cnt')[1], 'top').setStyle('display', 'block'); } }); $$('.cnt_accordion_content').each(function(element){element.setStyle('height', 'auto');}); } }); window.addEvent('domready', function(e){ if(Browser.Engine.trident) { $$('.box_cnt_glossar .box_cnt_accordion div.cnt_accordion_toggle').each(function(element){ element.addEvent('mouseenter', function(event){element.addClass('hover');}); element.addEvent('mouseleave', function(event){element.removeClass('hover');}); }); } }); /* Pop-Up GoogleMaps */ function popGoogleMaps(url) { newwindow=window.open(url,'GoogleMapsWin',"width=500,height=300,location=no,menubar=no,resizable=yes,status=yes,toolbar=no,top="+((screen.height-300)/2)+",left="+((screen.width-500)/2)); if (window.focus) {newwindow.focus()} return false; } function popNewWin(url) { newwindow=window.open(url,'',''); if (window.focus) {newwindow.focus()} return false; } function popGeneric(url, dimensions, scroll) { if(!dimensions || !dimensions[0] || !parseInt(dimensions[0],10) || !parseInt(dimensions[1],10)){dimensions = [800,600];} newwindow=window.open(url,'BBraunWin',"width="+dimensions[0]+",height="+dimensions[1]+",location=no,menubar=no,resizable=yes,status=yes,"+(scroll?"scrollbars=1,":'')+"toolbar=no,top="+((screen.height-dimensions[1])/2)+",left="+((screen.width-dimensions[0])/2)); if (window.focus && newwindow.focus) {newwindow.focus()} return false; } function popGenericScroll(url, dimensions) { return popGeneric(url, dimensions, true); } /* NEWS+PHOTO AUTOSUBMIT */ window.addEvent('domready', function(e){ $$('.cnt_pressphoto_select select').addEvent('change', function(ev){ var el = ev.target; if(!el.hasClass('noauto')){ el.getParent('form').submit(); } }); }); /*lightbox loc*/ var bbr_lb_img = 'Image'; var bbr_lb_of = 'of'; /*sitemap*/ window.addEvent('domready', function(){ $$('.box_sitemap').each(function(el){ var hdl = el.getElements('h4'), hdl_anc = hdl.getElement('a'), hasChildren = el.getElement('.box_sitemap_cnt').getElement('ul li'); if (!hasChildren) { el.addClass('box_sitemap_no_child'); return; } hdl_anc.addEvent('click', function(ev){ ev.stopPropagation();}); var siteAccordion = new Accordion(hdl_anc, el.getElements('.box_sitemap_cnt'), {'show':0, 'opacity':false, 'alwaysHide':true, 'show': -1}); hdl_anc.addEvent('click', function(ev){ if (hasChildren) { ev.stop(); //do not follow href... ev.stopPropagation(); } }); siteAccordion.addEvent('active', function(toggler, element){ element.getParent().addClass('box_sitemap_active').setStyle('margin-bottom', '25px'); }); siteAccordion.addEvent('background', function(toggler, element){ element.getParent().removeClass('box_sitemap_active'); }); }); });/* lists, floated images and IE */ window.addEvent('domready', function(){ if(Browser.Engine.trident) { $$('.cnt_img_text').each(function(el){ if( el.getElement('div.img_lt') != null && el.getElement('ul') != null && Browser.ie6){ var imgwidth = el.getElement('img').getSize().x + 10; el.getElements('ul').setStyle('margin-left', imgwidth); } }); $$('div.prodNav_4levels').each(function(el){ if(el.getChildren().length == 1) { el.getElement('.lvl1').setStyle('clear', 'left'); } else { $$('div.lvl4').each(function(el){ el.getParent().setStyle('width', '732px').setStyle('margin-right', '-20px'); }); } }); /* $$('div.lvl2').each(function(el){ el.getParent().setStyle('width', '357px'); }); $$('div.lvl3').each(function(el){ el.getParent().setStyle('width', '543px'); });*/ } }); /* email replace*/ window.addEvent('domready', function(){ $$('span.mailreplace').each(function(el){ var linkClass = 'more'; if(el.hasClass('noMore')){ linkClass = ''; } var mail = el.get('text').replace(/ \[dot\] /g, '.').replace(' [at] ', '@'); var mailt = mail; if (mail.length > 23 && el.getParent('.box_contxt')){ mailt = mail.replace('@', '@ '); } new Element('a',{ 'href': 'mailto:'+mail, 'text': mailt, 'class': linkClass }).replaces(el); }); }); /* BMI Calculator */ var BmiCalc = new Class({ Implements: [Events, Options], options: { container: $(document.body), strings: { weight: '', height: '', send: '', cancel: '', yourBmi: '', comment: '', results: [ '', '', '', '', '', '' ] } }, initialize: function(options){ this.setOptions(options); this.buildForm(); }, calc: function(options) { if(!options.height || !options.weight){ return; } var m = options.height / 100; return (options.weight/(m*m)).round(2); }, calcOutput: function(options) { var bmi = this.calc(options); if(!bmi){ $('bmi_output').setStyle('display', 'none'); return; } var comment = ''; if (bmi >= 40.00) { comment = this.options.strings.results[0];} else if (bmi >=35.00 && bmi < 40) {comment = this.options.strings.results[1];} else if (bmi >=30.00 && bmi < 35) {comment = this.options.strings.results[2];} else if (bmi >=25.00 && bmi < 30) {comment = this.options.strings.results[3];} else if (bmi >=18.50 && bmi < 25) {comment = this.options.strings.results[4];} else if (bmi < 18.50) { comment = this.options.strings.results[5];} $('bmi_output').setStyle('display', 'block'); $('bmi_result').set('text', bmi); $('bmi_comment').set('html', comment); }, buildForm: function(options){ this.form = new Element('form', {html:'

BMI

' +'' +'
' +'
' +'' }).inject(new Element('div', {id:'frame_formbuilder'})); this.form.getParent().inject(this.options.container); this.form.addEvent('submit', function(ev){ ev.stop(); this.calcOutput({height:$('bmi_height').get('value'), weight:$('bmi_weight').get('value')}); }.bind(this)); $('bmi_cancel').addEvent('click', function(){$('bmi_output').setStyle('display', 'none');}); } }); var bmi = null; window.addEvent('domready', function(ev){ if($('bmi_calc')){ bmi = new BmiCalc({container:$('bmi_calc')}); } }); /* WLC Calculator */ var WlcCalc = new Class({ Implements: [Events, Options], options: { strings: { previousWeight: '', currentWeight: '', period: '', send: '', comment: '', error: '', results: [ '', // red '', //yellow '' //green ] } }, initialize: function(options){ this.setOptions(options); this.buildForm(); }, calc: function(options) { // parse float options.previousWeight = parseFloat(options.previousWeight.replace(",",".")).round(1); options.currentWeight = parseFloat(options.currentWeight.replace(",",".")).round(1); options.period = parseFloat(options.period.replace(",",".")).round(1); // check NaN if( isNaN(options.previousWeight) || options.previousWeight <= 0 || isNaN(options.currentWeight) || options.currentWeight <= 0 || isNaN(options.period) || options.period <= 0 || options.previousWeight < options.currentWeight) return; var m = (100 - (100/options.previousWeight * options.currentWeight)).round(2); return m; }, calcOutput: function(options) { var bmi = this.calc(options), boxClass = "message-"; if(!bmi) { this.setError(); return; } var comment = '

'+ bmi +'% ' + options.period; // check single week if (options.period == 1) { comment += ' '; } else { comment += ' '; } comment += '.

'; // red if (bmi >= 10.00 && options.period >= 4 && options.period <= 54) { comment += this.options.strings.results[0]; boxClass += "red"} else if (bmi >=9.00 && options.period >= 4 && options.period <= 54) { comment += this.options.strings.results[0]; boxClass += "red"} else if (bmi >=8.00 && options.period >= 4 && options.period <= 12) { comment += this.options.strings.results[0]; boxClass += "red"} else if (bmi >=7.00 && options.period >= 4 && options.period <= 8) { comment += this.options.strings.results[0]; boxClass += "red"} else if (bmi >=6.00 && options.period >= 4 && options.period <= 6) { comment += this.options.strings.results[0]; boxClass += "red"} else if (bmi >=5.00 && options.period == 4) { comment += this.options.strings.results[0]; boxClass += "red"} else if (bmi >=4.00 && options.period == 3) { comment += this.options.strings.results[0]; boxClass += "red"} else if (bmi >=3.00 && options.period == 2) { comment += this.options.strings.results[0]; boxClass += "red"} else if (bmi >=2.00 && options.period == 1) { comment += this.options.strings.results[0]; boxClass += "red"} //yellow else if (bmi >=9.00 && options.period == 24) { comment += this.options.strings.results[1];} else if (bmi >=8.00 && options.period >= 16 && options.period <= 54) { comment += this.options.strings.results[1]; boxClass += "yellow"} else if (bmi >=7.00 && options.period >= 12 && options.period <= 20) { comment += this.options.strings.results[1]; boxClass += "yellow"} else if (bmi >=6.00 && options.period >= 8 && options.period <= 16) { comment += this.options.strings.results[1]; boxClass += "yellow"} else if (bmi >=5.00 && options.period >= 8 && options.period <= 12) { comment += this.options.strings.results[1]; boxClass += "yellow"} else if (bmi >=4.00 && options.period >= 4 && options.period <= 8) { comment += this.options.strings.results[1]; boxClass += "yellow"} else if (bmi >=3.00 && options.period >= 3 && options.period <= 6) { comment += this.options.strings.results[0]; boxClass += "yellow"} else if (bmi >=2.00 && options.period >= 2 && options.period <= 4) { comment += this.options.strings.results[0]; boxClass += "yellow"} else if (bmi >=1.00 && options.period == 2) { comment += this.options.strings.results[0]; boxClass += "yellow"} // green else if (bmi >=7.00 && options.period == 24) { comment += this.options.strings.results[2]; boxClass += "green"} else if (bmi >=6.00 && options.period >= 20 && options.period <= 54) { comment += this.options.strings.results[2]; boxClass += "green"} else if (bmi >=5.00 && options.period >= 14 && options.period <= 54) { comment += this.options.strings.results[2]; boxClass += "green"} else if (bmi >=4.00 && options.period >= 10 && options.period <= 54) { comment += this.options.strings.results[1]; boxClass += "green"} else if (bmi >=3.00 && options.period >= 6 && options.period <= 54) { comment += this.options.strings.results[2]; boxClass += "green"} else if (bmi >=2.00 && options.period >= 4 && options.period <= 54) { comment += this.options.strings.results[2]; boxClass += "green"} else if (bmi >=1.00 && options.period >= 2 && options.period <= 54) { comment += this.options.strings.results[2]; boxClass += "green"} else { this.setError(); return; } this.setClassForOutput(boxClass); $('wlc_output').setStyle('display', 'block'); $('wlc_comment').set('html', comment); }, buildForm: function(options){ this.form = new Element('form', {html:'

' +'' +'' +'
' }).inject(new Element('div', {id:'frame_formbuilder'})); this.form.getParent().inject(this.options.container); this.options.container.adopt( new Element('div', { html: '
', id: 'wlc_output', 'class' : 'calc_output_box' }), 'bottom' ); this.form.addEvent('submit', function(ev){ ev.stop(); this.calcOutput({ previousWeight : $('wlc_previousWeight').get('value'), currentWeight : $('wlc_currentWeight').get('value'), period : $('wlc_period').get('value') }); }.bind(this)); }, setClassForOutput: function(className) { $('wlc_output').className=""; $('wlc_output').addClass(className); $('wlc_output').addClass("calc_output_box"); }, setError: function() { this.setClassForOutput("error"); $('wlc_output').setStyle('display', 'block'); $('wlc_comment').set('html', this.options.strings.error); } }); var bmi = null; window.addEvent('domready', function(ev){ if($('wlc_calc')){ bmi = new WlcCalc({ container: $('wlc_calc') }); } }); /* Changes to how AddThis works: - nothing should happen on hover - the Menu normally shown on hover should be shown on click. */ window.addEvent('domready', function(ev){ if(navigator.userAgent.match(/iPad/i)){ return; } var addthisCheck, changeAddThis, atBtn = document.getElement('.addthis_button'); if(!atBtn){return;} changeAddThis = function(){ atBtn.onclick = atBtn.onmouseover; atBtn.onmouseover= function(){}; }; addthisCheck = function(){//calls changeAddThis when addThis is set if(addthis_config) { clearInterval(addthisCheck); changeAddThis(); window.fireEvent.delay(0, window, 'checkheadlinewidth'); } }.periodical(400); }); /*Fontsize Changer*/ function getComputedElementStyle(elem, name) { // J/S Pro Techniques p136 if (elem.style[name]) { return elem.style[name]; } else if (elem.currentStyle) { return elem.currentStyle[name]; } else if (document.defaultView && document.defaultView.getComputedStyle) { name = name.replace(/([A-Z])/g, "-$1"); name = name.toLowerCase(); s = document.defaultView.getComputedStyle(elem, ""); return s && s.getPropertyValue(name); } else { return null; } } var fontsizeModifier = 0; changeFontSizeEverywhere = function(mod){//mod = 1 || -1 if ( $$('.fontsize').length == 0 ) return; var maxFontSize = 2; var minFontSize = -2; var newsize = window.fontsizeModifier + mod; var elements = [ document.getElement('.fontsize-down'), document.getElement('.fontsize-reset'), document.getElement('.fontsize-up') ]; if(newsize < 0){ elements[0].setStyle('border-bottom', '1px solid #737373'); elements[2].setStyle('border-bottom', '0'); }else if(newsize > 0){ elements[0].setStyle('border-bottom', '0'); elements[2].setStyle('border-bottom', '1px solid #737373'); } else { elements[0].setStyle('border-bottom', '0'); elements[2].setStyle('border-bottom', '0'); } if(window.fontsizeModifier + mod > maxFontSize || window.fontsizeModifier + mod < minFontSize){ return; } window.fontsizeModifier += mod; Cookie.write('fSize', window.fontsizeModifier, {duration: 30 } ); var els = document.getElements('*').filter(function(el){if($(el).get)return ($(el).get('text') !== '');}); els.each(function(el){ //erst zwischenspeichern... var modifier = mod; if(el.hasClass('no-fontresize') || el.getParent('.no-fontresize')){ modifier = 0; } el.store('_font-size', getComputedElementStyle(el, 'fontSize').toInt()+modifier); el.store('_line-height', getComputedElementStyle(el, 'lineHeight').toInt()+modifier); }); els.each(function(el){ //... dann ändern (vererbungen!) el = $(el);//IE if(!el.style || isNaN(el.retrieve('_font-size')) || isNaN(el.retrieve('_line-height')) || el.retrieve('_line-height') == 0){return;}//IE el.setStyles({ 'font-size':el.retrieve('_font-size')+'px', 'line-height':el.retrieve('_line-height')+'px' }); return; }); } /* fontsize */ var fontsizeModifier = 0; window.addEvent('domready', function(ev){ if ( $$('.fontsize').length == 0 ) return; if (document.body.hasClass('welcome')) return; var fSize = Cookie.read('fSize'); if (fSize !== null) { fSize = fSize.toInt(); changeFontSizeEverywhere(fSize); } $$('.fontsize').each(function(con){ var lt = con.getElement('.fontsize-down').addEvent('click', function(ev) { ev.stop(); this.focus(); changeFontSizeEverywhere(-1); }); var gt = con.getElement('.fontsize-up').addEvent('click', function(ev) { ev.stop(); this.focus(); changeFontSizeEverywhere(1); }); var rst = con.getElement('.fontsize-reset').addEvent('click', function(ev) { ev.stop(); this.focus(); changeFontSizeEverywhere(window.fontsizeModifier * -1); }); }); window.addEvent('checkheadlinewidth', function(){ $$('.box_headline > .rt').each(function(el){ var w = 0, e = el.getPrevious('.lt'); el.getChildren().each(function(ch){ if(ch.get('tag') === 'script'){return;}//addthis bug in Firefox w += ch.getDimensions().x; }); if(e){ e.setStyle('width', 521 - w); // -4px print margin, -3px for spaces in icons. } }); }); window.fireEvent.delay(0, window, 'checkheadlinewidth'); }); /* navigation fix 19239 */ window.addEvent("domready", function(){$$('ul.navTop > li > ul ').each(function(el){ if( el.getElements('li').length == 0){ el.hide(); } });}); /* short product level texts */ window.addEvent('domready',function() { cutContent(); }); function cutContent() { // setup options var content = $$('.prodNav_overviewEntry div'); if (content !== undefined) { content.each(function(element) { // necessary information if(element.getStyle('height') != '0px') { var content_height = parseFloat(element.getStyle('height')), content_line_height = parseFloat(element.getStyle('line-height')), content_rows = content_height / content_line_height, content_new_height = ( content_height / content_rows ) * 3, transparent_div = new Element('div', { 'class' : 'transparent_div' }); // cut element element.setStyles({ height: content_new_height, overflow: 'hidden', position: 'relative' }); // insert image div element.adopt(transparent_div); } }); } }; /* Locationfinder */ var LocationFinder = new Class({ Implements:[Options, Events], options:{ network:{ searchInstance:'generic' } }, els:{}, initialize:function(options){ this.setOptions(options); this.initElements(); this.initFormToggle().initFormToggle(1);//first w/ event this.initNetwork(); this.initMap(); }, initElements:function(){ var els = this.els, h = new Hash({ 'context':'.box_contxt .locationfinder', 'formtoggle':'.box_contxt .locationfinder .location-form-toggle', 'form':'.box_contxt .locationfinder form', 'productselect':'.box_contxt .locationfinder select.category', 'searchresults':'.box_contxt .locationfinder .results' }).each(function(v,k){ els[k] = document.getElement(v); }); this.els.form.getElements('input[type=text]').each(function(el){ el.store('orgval', el.get('value')); el.addEvents({ focus:function(ev){ if(this.get('value') == this.retrieve('orgval')){this.set('value', '');} }, blur:function(ev){ if(this.get('value') == ''){this.set('value', this.retrieve('orgval'));} } }); }); this.els.form.addEvent('submit', this.onFormSubmit.bind(this)); this.els.searchresults.store('scroll', new Fx.Scroll(this.els.searchresults)); }, initFormToggle:function(force){ //force: 1 ~ open; 0 ~ close; undefined: only set click event if not set var els = this.els, activeClass='locationfinder-active'; togglefunc = function(ev){ if(ev && ev.stop){new Event(ev).stop();} var isActive = els.context.hasClass(activeClass); if(isActive || force === 0){ els.context.removeClass(activeClass); els.form.fade('out'); } else if(!isActive || force === 1){ els.context.addClass(activeClass); els.form.fade('in'); } }; if(!els.formtoggle.retrieve('toggle')){ els.formtoggle.addEvent('click', togglefunc).store('toggle', true); } if(typeof force !== 'undefined'){ els.formtoggle.fireEvent('click'); } return this; }, onFormSubmit:function(ev){ ev.stop().preventDefault(); //copy values to LocationFinderNetwork: this.els.form.getElements('input[type=text]').fireEvent('focus'); var searchValues = []; this.els.form.getElements('input, select').each(function(input){ var type = input.get('type'); if(type === 'submit' || type === 'reset' || !input.get('value')){return;} searchValues[input.get('name')] = input.get('value'); }); this.network.submitSearch(searchValues); this.els.form.getElements('input[type=text]').fireEvent('blur'); }, initMap:function(){ this.map = new LocationFinderMap(); }, initNetwork: function(){ this.network = new LocationFinderNetwork(this.options.network); if(this.options.network.disableProducts && this.els.productselect){ this.els.productselect.destroy(); } this.network.addEvents({ 'products': function(res){ var sel = this.els.productselect; sel.getElements('option[value]').destroy(); if(!res.product || !res.product.length){return;} sel.grab(new Element('option',{'value':'', 'text':this.options.selectProductString})); res.product.each(function(v,k){ sel.grab(new Element('option',{'value':v.id, 'text':v.value||v.name})); }); }.bind(this), 'search': function(res){ var container = new Element('div').setStyles({'visibility':'hidden', 'opacity':0}), count = res.count, addresses = []; this.els.formtoggle.getParent().getElement('span.resultnumber').setStyles({visibility:'hidden', opacity:0}).set('text', '('+count+' Treffer)').fade('in'); res.location.each(function(v,k){ var url, otherContact=''; if(v.contact && v.contact.website){ url = (v.contact.website).split(' '); url = url[url.length - 1]; } //api for website changed without warning, so: if(!url && v.otherInformation){ Array.each(v.otherInformation, function(info){ if(info.type == 'website'){ url = info.value; } }) } if(v.contact && v.contact[0]){ // phone, fax, email if(!!v.contact[0].phone.replace(/^\s+|\s+$/, '')) { otherContact += 'Telefon: '+v.contact[0].phone+'
'; } if(!!v.contact[0].fax.replace(/^\s+|\s+$/, '')) { otherContact += 'Fax: '+v.contact[0].fax+'
'; } if(!!v.contact[0].email.replace(/^\s+|\s+$/, '')) { otherContact += ('E-Mail: '+v.contact[0].email).replace(/([\S\s]{22})(?=\S)/g, "$1
"); } } var resdiv = new Element('div',{ 'html':''+v.name+'
' +v.street+'
' +v.postalCode+' '+v.city+'
' +otherContact + '
' +(url?'Homepage':'') +'Standort' +'Route planen
', 'class':'result' }).store('address', v); resdiv.getElement('.locationlinkaddress').addEvent('click', function(ev){ ev.stop(); this.map.centerMarker(resdiv.retrieve('marker')); }.bind(this)); container.grab(resdiv); }.bind(this)); //does not work in single loop :/ container.getElements('.result').each(function(el){ addresses.push(el); }); this.map.setAddresses(addresses); this.els.searchresults.empty().grab(container.fade('in')); this.els.searchresults.retrieve('scroll').toTop(); this.els.formtoggle.fireEvent('click') }.bind(this) }); this.network.submitProducts(); } }); /* Handle requests for Product prefill & search: */ var LocationFinderNetwork = new Class({ Implements:[Options, Events], options:{ searchInstance:'generic', searchType:'generic', productsInstance:'generic', productsType:'generic', disableProducts: false, urls:{ // products:'/locationfinder/products', // search:'/locationfinder/search' } }, initialize:function(options){ this.setOptions(options); if(!this.options.disableProducts){ this.products = new Request.JSON({ url:this.options.urls.products, method:'get', headers:{'Accept': 'application/json'}, onSuccess:function(res){ this.fireEvent('products', res);}.bind(this) }); } this.search = new Request.JSON({ url:this.options.urls.search, headers:{'Accept': 'application/json'}, method:'get', onSuccess:function(res){; (function(){ this.fireEvent('search', res); }).delay(40, this); }.bind(this) }); }, searchValues:{},//filled by LocationFinder submitProducts:function(){ if(this.options.disableProducts){ return; } this.products.send({data:{instance:this.options.productsInstance, type:this.options.productsType}}); }, submitSearch:function(values){ if(values){ this.searchValues = values; } this.search.send({data:new Hash({instance:this.options.searchInstance, type:this.options.searchType}).combine(this.searchValues)}); } }); var LocationFinderMap = new Class({ Implements:[Options, Events], options:{ mapelement:'#locationmap' }, initialize:function(options){ //return this.setOptions(options); this.initjs(); this.addEvent('addressupdated', this.reCenter); }, initjs:function(){ window.LocationFinderMapsCallback = function(){ this.initmap(); }.bind(this); this.mapjs = Asset.javascript('//maps.google.com/maps/api/js?sensor=false&callback=LocationFinderMapsCallback'); }, addresses:[], initmap:function(){ var latlng, myOptions; latlng = new google.maps.LatLng(51.133333, 9.55);//start in melsungen myOptions = { zoom: 13, center: latlng, mapTypeId: google.maps.MapTypeId.TERRAIN } this.map = new google.maps.Map(document.getElement(this.options.mapelement), myOptions); this.ready = 1; this.fireEvent('ready'); }, addAddresses:function(ads){ if(!this.ready){ this.addEvent('ready', function(){this.addAddresses(ads)}.bind(this)); return; } this.geocoder = new google.maps.Geocoder(); Array.each(ads, function(e,i){ var v = e.retrieve('address'); var address = v.street+', '+v.postalCode+', '+v.city+' '+v.country; var pos = new google.maps.LatLng(v.latitude,v.longitude); v.marker = new google.maps.Marker({ map: this.map, position: pos }); e.store('marker', v.marker); this.addresses.push(v) this.fireEvent('addressupdated', this.addresses); }.bind(this)); }, setAddresses:function(ads){//Todo: clear marker for(var i=0; i-1){return"horizontal"}else{if(this.effects.vertical.indexOf(this.options.effect)>-1){return"vertical"}else{return this.options.orientation}}},getSlices:function(){return this.holder.getElements(".nivoo-slice")},initSlider:function(){if(this.options.directionNavPosition==="outside"){this.container.addClass("direction-nav-outside")}this.holder=(new Element("div.nivoo-slider-holder")).adopt(this.container.getChildren()).inject(this.container);this.containerSize=this.holder.getSize();this.children=this.getImages();this.totalSlides=this.children.length;this.children.setStyle("display","none");this.currentImage=this.children[0];this.createLinkHolder();this.setLink();this.setBackgroundImage();this.createCaption();this.showCaption();if(this.options.pauseOnHover&&this.options.autoPlay){this.holder.addEvents({mouseenter:function(){this.pause()}.bind(this),mouseleave:function(){this.play()}.bind(this)})}if(this.options.directionNav){this.createDirectionNav()}if(this.options.controlNav){this.createControlNav()}},hideCaption:function(){this.caption.retrieve("fxInstance").start({bottom:this.caption.getHeight()*-1,opacity:.5})},next:function(){this.currentSlide+=1;if(this.currentSlide===this.totalSlides){this.currentSlide=0}this.slide()},pause:function(){window.clearInterval(this.interval);this.interval=null},play:function(){console.log("played");if(this.interval===null&&this.isActive===true){this.interval=this.next.periodical(this.options.interval,this)}},previous:function(){if(this.options.autoPlay){this.pause();if(!this.options.pauseOnHover){this.play()}}this.currentSlide-=1;if(this.currentSlide<0){this.currentSlide=this.totalSlides-1}this.slide()},setCurrentControlItem:function(){var e=this.container.getElement("div.control-nav a.current");if(e){e.removeClass("current")}this.container.getElements("div.control-nav a")[this.currentSlide].addClass("current")},showCaption:function(){var e=this.currentImage.get("title");if(!e){this.hideCaption();return}this.setCaptionText(e);this.caption.retrieve("fxInstance").start({bottom:0,opacity:1})},slide:function(e){var t,n,r,i,s,o;if(this.running){return}if(this.orientation==="random"){this.orientation=["horizontal","vertical"].getRandom()}this.arrangeSlices();if(e!==undefined){this.currentSlide=e}this.currentImage=this.children[this.currentSlide];if(this.options.controlNav){this.setCurrentControlItem()}this.setLink();this.showCaption();i=this.slices;o=0;this.slices.each(function(e){t=e.retrieve("coordinates");e.setStyles({background:'url("'+this.currentImage.get("src")+'") no-repeat -'+t.left+"px "+t.top*-1+"px",bottom:"",height:t.height,left:t.left,opacity:0,right:"",top:t.top,width:t.width});var n=this.orientation==="horizontal"?"width":"height";e.setStyle(n,0)},this);this.start();this.running=true;n=this.options.effect;if(n==="random"){n=this.effects[this.orientation].getRandom()}if(["sliceDownRight","sliceDownLeft"].contains(n)){if(n==="sliceDownLeft"){i=i.reverse()}i.each(function(e){e.setStyle("top",0);this.animate.delay(100+o,this,[e,{height:this.containerSize.y,opacity:1}]);o+=50},this)}else{if(["sliceUpRight","sliceUpLeft"].contains(n)){if(n==="sliceUpLeft"){i=i.reverse()}i.each(function(e){var t=e.retrieve("fxInstance");e.setStyle("bottom",0);this.animate.delay(100+o,this,[e,{height:this.containerSize.y,opacity:1}]);o+=50},this)}else{if(["sliceUpDownRight","sliceUpDownLeft"].contains(n)){if(n==="sliceUpDownLeft"){i=i.reverse()}i.each(function(e,t){if(t%2===0){e.setStyle("top",0)}else{e.setStyles({bottom:0,top:""})}this.animate.delay(100+o,this,[e,{height:this.containerSize.y,opacity:1}]);o+=50},this)}else{if(["wipeLeft","wipeRight"].contains(n)){s={height:this.containerSize.y,opacity:1,width:0};if(n==="wipeRight"){Object.append(s,{backgroundPosition:"top right",left:"",right:0})}r=i[0];r.setStyles(s);this.animate(r,{width:this.containerSize.x},true)}else{if(["sliceLeftUp","sliceLeftDown","sliceRightDown","sliceRightUp"].contains(n)){if(n==="sliceLeftUp"||n==="sliceRightUp"){i=i.reverse()}if(n==="sliceRightDown"||n==="sliceRightUp"){i.setStyles({left:"",right:0})}else{i.setStyles({left:0,right:""})}i.each(function(e){this.animate.delay(100+o,this,[e,{opacity:1,width:this.containerSize.x}]);o+=50},this)}else{if(["sliceLeftRightDown","sliceLeftRightUp"].contains(n)){if(n==="sliceLeftRightUp"){i=i.reverse()}i.each(function(e,t){if(t%2===0){e.setStyles({left:0,right:""})}else{e.setStyles({left:"",right:0})}this.animate.delay(100+o,this,[e,{opacity:1,width:this.containerSize.x}]);o+=50},this)}else{if(["wipeDown","wipeUp"].contains(n)){s={height:0,opacity:1,width:this.containerSize.x};if(n==="wipeUp"){Object.append(s,{backgroundPosition:"bottom left",bottom:0,top:""})}r=i[0];r.setStyles(s);this.animate(r,{height:this.containerSize.y},true)}else{if(["foldDown","foldLeft","foldRight","foldUp"].contains(n)){if(n==="foldUp"||n==="foldLeft"){i.reverse()}i.each(function(e){var t={opacity:1};if(this.orientation==="horizontal"){t.height=e.getHeight();e.setStyles({height:0,width:this.containerSize.x})}else{t.width=e.getWidth();e.setStyles({height:this.containerSize.y,width:0})}this.animate.delay(100+o,this,[e,t]);o+=50},this)}else{r=i[0];r.setStyles({height:this.containerSize.y,width:this.containerSize.x});this.animate(r,{opacity:1},true)}}}}}}}}this.sliding()},setBackgroundImage:function(){this.holder.setStyle("background-image",'url("'+this.currentImage.get("src")+'")')},setCaptionText:function(e){this.caption.set("text",e)},setLink:function(){var e,t=this.currentImage.getParent();if(t.get("tag")==="a"){e=t.clone(false).cloneEvents(t);e.replaces(this.linkHolder);this.linkHolder=e;this.linkHolder.addClass("nivoo-link").setStyle("display","block")}else{this.linkHolder.setStyle("display","none")}},finish:function(){this.fireEvent("finish")},sliding:function(){this.fireEvent("sliding")},lastSlide:function(){this.fireEvent("lastSlide")},start:function(){this.fireEvent("start")}});NivooSlider.implement({sliding:function(){$this=this;Array.each($$($this.container),function(e){var t=e.getElement($this.caption).getStyle("height");e.setStyle("height",t.toInt()+300)})},finish:function(){},createCaption:function(){this.caption=(new Element("div",{"class":"nivoo-multicaption",styles:{opacity:0}})).inject(this.holder);this.caption.store("fxInstance",new Fx.Morph(this.caption,{duration:200,wait:false}))},showCaption:function(){var e=this.currentImage.get("data-captionel");if(e){e=document.id(e);if(e){e=e.get("html")}}if(!e){this.hideCaption()}this.setCaptionText(e);this.caption.retrieve("fxInstance").start({top:300,opacity:1})},setCaptionText:function(e){this.caption.set("html",e)}}); NivooSlider.implement({ sliding : function() { // fix for slider height $this = this; Array.each($$($this.container), function(slider) { var height = slider.getElement($this.caption).getStyle("height"); // hope this works if($$($this.caption)[0].getChildren().length > 0){ height = 0; var arrLength = $$($this.caption)[0].getChildren().length ; for (var i=0; i 0){ height = $$($this.caption)[0].getHeight(); } } slider.setStyle("height", height.toInt() + 285); }); }, createCaption: function () { this.caption = new Element('div', { 'class': 'nivoo-multicaption', styles: { opacity: 0 } }).inject(this.holder); this.caption.store('fxInstance', new Fx.Morph(this.caption, { duration: 200, wait: false })); }, showCaption: function () { //support for captions from RichText Editor var title = this.currentImage.get('data-captionel'); if(title) { title = document.id(title); if (title) { title = title.get('html'); } } if (!title) { this.hideCaption(); //return; } this.setCaptionText(title); this.caption.retrieve('fxInstance').start({ top: 300, opacity: 1 }); }, setCaptionText: function (html) { //it's actually more sethtml now. this.caption.set('html', html); } }); $$('.box_cnt.nivoo-slider').each(function (el) { el.addEvents({'mouseover': function(){el.addClass('nivoo-hover');},'mouseout': function(){el.removeClass('nivoo-hover');}}); //IE var interval = Math.max(el.get('data-interval') || 5000, 600), options = { directionNavPosition: el.get('data-directionNavPosition') || 'inside', effect: el.get('data-effect') || 'random', interval: interval, orientation:'random', autoPlay: el.get('data-autostart') === 'true'?true:false, directionNavHide: el.get('data-directionnavhide') === 'true'?true:false }, instance = new NivooSlider(el, options); instance.sliding(); var ielayoutlostfix = function () {el.addClass('nivoo-hover').removeClass('nivoo-hover');}//IE bug. ielayoutlostfix.delay(0); el.getElements('.direction-nav-left a, .direction-nav-right a').each(function(el,i){el.addEvent('click', el.blur)}); }); }); /* Image Map List Teasers - dialysis */ window.addEvent('domready', function () { $$('.imagemaplinks').each(function(container){ if(!container.getElement('img.map')) return; var img = container.getElement('img.map'), orgimgsrc = img.get('src'), map = container.getElement('map'), mapareas = map.getElements('area'), // list = map.getPrevious(), listlinks = container.getElements('a.pficon'); mapareas.each(function (el, i) { if(listlinks.length > 0){ listlinks[i].addEvents({ //map mouseover mouseenter: function (ev) {mapareas[i].fireEvent('mouseover', ev);}, mouseleave: function (ev) {mapareas[i].fireEvent('mouseout', ev);} }); } mapareas[i].addEvents({ mouseover: function (ev) { var hoverImg = this.get('data-img'); if (hoverImg) { img.set('src', hoverImg).style.cursor = 'pointer'; } if(listlinks.length > 0) listlinks[i].addClass('hover'); }, mouseout: function (ev) { img.set('src', orgimgsrc).style.cursor = ''; if(listlinks.length > 0) listlinks[i].removeClass('hover'); } }); }); }); }); /* Link Click Confirmation */ //do stuff when external links are clicked instead of opening them - distinguishing between known and unknown domains var ExternalLinkCheck = new Class({ Implements: [Options, Events], options:{ knownHosts: ['www.comspace.de'], activeHost: window.location.host,//variable 'source' host selector:'a[href^="http://"],a[href^="https://"]',//initial selector for processed Links filterFunc: function(el){ return (!el.getParent('.continent_chooser')) && (el.get('href').getHostname() != this.options.activeHost) && (!el.getParent('.social_media_teaser_item')) && (!el.hasClass('addthis_button'))}//filter elements dynamically; bound to "this" on execution at init time. }, initialize: function(options){ this.setOptions(options); var els = document.getElements(this.options.selector).filter(this.options.filterFunc.bind(this)); els.each(function(el){ var hostname = el.get('href').getHostname() if(this.options.knownHosts.contains(hostname) && ("").length > 0){//include different messages... el.confirmLinkClick(''); }else if (!this.options.knownHosts.contains(hostname) && ("You are leaving BBraunUSA.com. This link is provided strictly for information sharing purposes. B. Braun Medical Inc. assumes no responsibility for the quality, content, nature, or reliability of any linked site.").length > 0) { el.confirmLinkClick('You are leaving BBraunUSA.com. This link is provided strictly for information sharing purposes. B. Braun Medical Inc. assumes no responsibility for the quality, content, nature, or reliability of any linked site.'); } }.bind(this)); } }); Function.prototype.protect=function(){this._protected=true;return this;}; //slightly smaller than including MooTools Extras.URI String.implement({ getHostname : function() { var re = new RegExp('^(?:f|ht)tp(?:s)?\://([^/]+)', 'im'); return this.match(re)[1].toString(); } }); //run it and do something on click window.addEvent('domready', function(){ var lc = new ExternalLinkCheck({ knownHosts:['www.bbraunusa.com','www.raadvantages.com','www.hit.bbraunusa.com','www.asc.bbraunusa.com','www.evergreen.bbraunusa.com','www.hida.bbraunusa.com','www.smartpumps.bbraunusa.com','www.whin.bbraunusa.com','www.bpassive.bbraunusa.com','www.caresite.bbraunusa.com','www.ems.bbraunusa.com','www.introcan.bbraunusa.com','www.needlesandsyringes.bbraunusa.com','www.oncology.bbraunusa.com','www.perifixfx.com','www.prontosan.bbraunusa.com','www.stimuplexultra.com','video.bbraunusa.com','prv-cw-bbraun-en-us.bbraun.de','prd-cw-bbraun-en-us.bbraun.de','1030.3868.m.edge-cdn.net','www.contiplexstim.com','www.introcansafety.bbraunusa.com','oncology.bbraunusa.com','ems.bbraunusa.com','tpnmanager.com','www.tpnmanager.com','www.cytotoxicexposure.com','BBMUSSANDBOX.COM','WWW.BBMUSSANDBOX.COM','www.contiplexc.com','www.bbraunava.com','www.contiplexecho.com','www.bbraunintegra.com'] }); }); //needed libs: var Overlay=new Class({Implements:[Options,Events],options:{id:"overlay",color:"#000",duration:500,opacity:0.8,zIndex:5E3},initialize:function(a,b){this.setOptions(b);this.container=$(a);if(Browser.Engine.trident&&Browser.version<=6)this.ie6=!0;this.bound={window:{resize:this.resize.bind(this),scroll:this.scroll.bind(this)},overlayClick:this.overlayClick.bind(this),tweenStart:this.tweenStart.bind(this),tweenComplete:this.tweenComplete.bind(this)};this.build().attach()},build:function(){this.overlay= (new Element("div",{id:this.options.id,opacity:0,styles:{position:this.ie6?"absolute":"fixed",background:this.options.color,left:0,top:0,"z-index":this.options.zIndex}})).inject(this.container);this.tween=new Fx.Tween(this.overlay,{duration:this.options.duration,link:"cancel",property:"opacity"});return this}.protect(),attach:function(){window.addEvents(this.bound.window);this.overlay.addEvent("click",this.bound.overlayClick);this.tween.addEvents({onStart:this.bound.tweenStart,onComplete:this.bound.tweenComplete}); return this},detach:function(){Array.prototype.slice.call(arguments).each(function(a){a=="window"&&window.removeEvents(this.bound.window);a=="overlay"&&this.overlay.removeEvent("click",this.bound.overlayClick)},this);return this},overlayClick:function(){this.fireEvent("click");return this},tweenStart:function(){this.overlay.setStyles({width:"100%",height:this.container.getScrollSize().y});return this},tweenComplete:function(){this.fireEvent(this.overlay.get("opacity")==this.options.opacity?"show": "hide");return this},open:function(){this.fireEvent("open");this.overlay.setStyle("visibility", "visible");this.tween.start(this.options.opacity);return this},close:function(){this.fireEvent("close");this.tween.start(0);return this},resize:function(){this.fireEvent("resize");if(this === undefined) return; this.overlay.setStyle("height",this.container.getScrollSize().y);return this},scroll:function(){this.fireEvent("scroll");this.ie6&&$(this.overlay).setStyle("left",window.getScroll().x);return this}}),MooDialog=new Class({Implements:[Options,Events],options:{size:{width:300,height:100}, offset:{x:0,y:-100},title:null,scroll:!0,useEscKey:!0,disposeOnClose:!0,closeButton:!0,closeOnOverlayClick:!0,useScrollBar:!0,fx:{type:"tween",open:1,close:0,options:{property:"opacity",duration:400}}},initialize:function(a){this.setOptions(a);this.ie6=Browser.Engine.trident&&Browser.Engine.version<=4;var a=this.options,b=a.size,c=b.width,d=b.height,b=this.wrapper=(new Element("div",{"class":"MooDialog",styles:{width:c,height:d,position:a.scroll&&!this.ie6?"fixed":"absolute","z-index":6E3,opacity:0}})).inject(document.body); this.content=(new Element("div",{styles:{width:c,height:d,overflow:a.useScrollBar?"auto":"hidden"}})).inject(b);if(a.title)this.title=(new Element("div",{"class":"title",text:a.title})).inject(b),b.addClass("MooDialogTitle");if(a.closeButton)this.closeButton=(new Element("a",{"class":"close",events:{click:this.close.bind(this)}})).inject(b);var e=$(document.body).getSize();this.setPosition((e.x-c)/2,(e.y-d)/2);a.scroll&&this.ie6&&window.addEvent("scroll",function(){this.setPosition((e.x-c)/2,(e.y- d)/2)}.bind(this));if(!this.fx)this.fx=a.fx.type=="morph"?new Fx.Morph(b,a.fx.options):new Fx.Tween(b,a.fx.options);this.fx.addEvent("complete",function(){this.fireEvent(this.open?"show":"hide");a.disposeOnClose&&!this.open&&this.dispose()}.bind(this));this.overlay=new Overlay(document.body,{duration:this.options.fx.options.duration});a.closeOnOverlayClick&&this.overlay.addEvent("click",this.close.bind(this))},setContent:function(a){this.content.empty();switch($type(a)){case "element":this.content.adopt(a); break;case "string":case "number":this.content.set("text",a)}return this},setPosition:function(a,b){var c=this.options,d=this.wrapper;a+=c.offset.x;b+=c.offset.y;a=a<10?10:a;b=b<10?10:b;d.getStyle("position")!="fixed"&&(c=$(document.body).getScroll(),a+=c.x,b+=c.y);d.setStyles({left:a,top:b});return this},open:function(){this.open=!0;this.fireEvent("open");this.fx.start(this.options.fx.open);this.overlay.open();this.options.useEscKey&&$(document.body).addEvent("keydown",function(a){a.key=="esc"&& this.close()}.bind(this));return this},close:function(){this.open=!1;this.fireEvent("close");this.fx.start(this.options.fx.close);this.overlay.close();return this},dispose:function(){this.wrapper.destroy();this.overlay.overlay.destroy()},toElement:function(){return this.wrapper}});Element.implement({MooDialog:function(a){this.store("MooDialog",(new MooDialog(a)).setContent(this).open());return this}}); MooDialog.Confirm=new Class({Extends:MooDialog,options:{okText:"Ok",cancelText:"Cancel",focus:!0},initialize:function(a,b,c,d){this.parent(d);var b=b?b:function(){},c=c?c:function(){},e=new Element("input",{type:"button",events:{click:function(){c();this.close()}.bind(this)},value:this.options.cancelText});this.setContent((new Element("div")).adopt(new Element("p",{"class":"MooDialogConfirm",text:a})).adopt((new Element("div",{"class":"buttons"})).adopt(e).adopt(new Element("input",{type:"button", events:{click:function(){b();this.close()}.bind(this)},value:this.options.okText})))).open();this.options.focus&&this.addEvent("show",function(){e.focus()})}}); Element.implement({ confirmLinkClick:function(a,b){ //set bool on element -> can be queried at "non confirmation popups". Removing all other click events would break tracking. this.store('requires-confirmation', true); this.addEvent("click",function(c){ c.stop(); new MooDialog.Confirm(a,function(){ if(this.hasClass('popup')){ var dimensions = [800, 600]; if(this.rel && this.rel.test(/^popup/i)){ dimensions = this.rel.replace(/[[]|]/gi," ").split(' ')[1].split('x'); } if(this.hasClass('scroll')){ popGenericScroll(this.href, dimensions); return; } popGeneric(this.href, dimensions); return } if(this.get('target')=='_blank'){ window.open(this.get("href"), 'externallink'+Math.floor(Math.random()*10000)); }else{ location.href=this.get("href") } }.bind(this),null,b); }); return this }, confirmFormSubmit:function(a,b){this.addEvent("submit",function(c){c.stop();new MooDialog.Confirm(a,this.submit,null,b)}.bind(this));return this}} ); /* Date Format News Archive Results 24300 */ window.addEvent('domready',function() { // ------------------------------------------------------------------ // formatDate (date_object, format, month_names, day_names) // Returns a date in the output format specified. // ------------------------------------------------------------------ var formatDate = function (d, format, months, days) { var month_fallback = 'January|February|March|April|May|June|July|August|September|October|November|December|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec'; var day_fallback = 'Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sun|Mon|Tue|Wed|Thu|Fri|Sat'; var month_names = months || month_fallback; var day_names = day_names || day_fallback; month_names = month_names.split('|'); day_names = day_names.split('|'); //safety: if(month_names.length !== 24) { month_names = month_fallback.split('|');} if(day_names.length !== 14) { day_names = day_fallback.split('|');} var date = new Date(d); var format = format + ""; var result = ""; var i_format = 0; var c = ""; var token = ""; var y = date.getYear() + ""; var M = date.getMonth() + 1; var d = date.getDate(); var E = date.getDay(); var H = date.getHours(); var m = date.getMinutes(); var s = date.getSeconds(); var yyyy, yy, MMM, MM, dd, hh, h, mm, ss, ampm, HH, H, KK, K, kk, k; // Convert real date parts into formatted versions var value = new Object(); if (y.length < 4) { y = "" + (y - 0 + 1900); } value["y"] = "" + y; value["yyyy"] = y; value["yy"] = y.substring(2, 4); value["M"] = M; value["MM"] = LZ(M); value["MMM"] = month_names[M - 1]; value["NNN"] = month_names[M + 11]; value["d"] = d; value["dd"] = LZ(d); value["E"] = day_names[E + 7]; value["EE"] = day_names[E]; value["H"] = H; value["HH"] = LZ(H); if (H == 0) { value["h"] = 12; } else if (H > 12) { value["h"] = H - 12; } else { value["h"] = H; } value["hh"] = LZ(value["h"]); if (H > 11) { value["K"] = H - 12; } else { value["K"] = H; } value["k"] = H + 1; value["KK"] = LZ(value["K"]); value["kk"] = LZ(value["k"]); if (H > 11) { value["a"] = "PM"; } else { value["a"] = "AM"; } value["m"] = m; value["mm"] = LZ(m); value["s"] = s; value["ss"] = LZ(s); while (i_format < format.length) { c = format.charAt(i_format); token = ""; while ((format.charAt(i_format) == c) && (i_format < format.length)) { token += format.charAt(i_format++); } if (value[token] != null) { result = result + value[token]; } else { result = result + token; } } return result; } $$('#news_archive_results .box_news div.date').each(function(element){ //if(!element.get('text').test(regex)){return;} var datearr = element.get('text').split('-'), newsdate = new Date(datearr[0], datearr[1]-1, datearr[2]); var newDateValue = formatDate (newsdate, "MM/dd/yyyy", "", ""); element.set('text', newDateValue); }); }); function cookieAcknowledgement(){ var cornerLayer = $$('.corner-cookieLayer'); if(Cookie.read('cookie_ack') === null && cornerLayer.length) { cornerLayer.setStyle('display', 'block'); $$('.corner-cookieLayer .close-button').addEvent('click', function(){ closeCookieLayer(); }); $("close-cookie-layer").addEvent("click", function(el) { closeCookieLayer(); return false; }); function closeCookieLayer() { Cookie.write('cookie_ack', '1', {duration:500}); cornerLayer.setStyle('display', 'none'); } } } window.addEvent('domready', function(){ $$('.cnt_sitcircle').each(function(el, i){ if(el.retrieve('circle')){return;} el.store('circle', true); var img = el.getElement('img'), orgsrc = img.get('src'), description = el.getElements('.sitdescription'); //set bg to reduce flickering el.setStyle('background-image', 'url('+orgsrc+')'); el.getElements('area').each(function(area, i){ var hoversrc = area.get('data-hoverimg'); if(!hoversrc) {return;} Asset.image(hoversrc); $$([area, description[i]]).addEvents({ mouseenter:function(){img.set('src', hoversrc); el.addClass('hover'+i);}, mouseleave:function(){img.set('src', orgsrc); el.removeClass('hover'+i);} }).fireEvent('mouseenter').fireEvent('mouseleave'); }); el.getElements('span').each(function(el){ var s = el.getSize().y; if(el.getSize().y !== 80) { //IE7 el.setStyles({'margin-top': (80 - s)/2, 'display':'block'}); } }); }); }); var bbstartslider = function(el, startIndex){ startIndex = startIndex || 0; this.options = {fxDuration:1000}; this.width = el.getDimensions().x; this.slides = el.set('morph', { onComplete:this.showNext.bind(this), duration: this.options.fxDuration})//initial opacity fade only! .morph({opacity:1}) .getChildren().each(function(slide, i){slide.addClass(i).inject(el, 'top');})//let default z-index work for us .set('tween', { duration: this.options.fxDuration,onComplete:function(){//width this.element.inject(el, 'top').removeClass('current').removeClass('withering').setStyles({'width':this.width}) .getElement('.stage-slider-shade').setStyle('width', 0); this.element.getElement('.stage-slider-text').setStyle('opacity', 0); }}); this.active = -1; } bbstartslider.prototype.showNext = function() { var currentIndex = this.active, slide; this.active = (this.active === this.slides.length - 1) ? 0 : this.active + 1 ; slide = this.slides[this.active]; slide.addClass('current'); this.slides[currentIndex] && this.slides[currentIndex].addClass('withering').tween('width', [this.width,0]); window.setTimeout(function() {this.slideLifeCycle(slide);}.bind(this), this.options.fxDuration); }; bbstartslider.prototype.slideLifeCycle = function(slide) { var d = 0, scope=this, shade = slide.getElement('.stage-slider-shade').set('tween', {duration:scope.options.fxDuration*2}).set('morph', {duration:scope.options.fxDuration*2}), text = slide.getElement('.stage-slider-text').set('tween', {duration:scope.options.fxDuration}).set('morph', {duration:scope.options.fxDuration}); d += 1000; //fade shade to 50%; fade text to 1 window.setTimeout(function() { shade.morph({'opacity': [0,0.5], width:[0,scope.width/2]}); }, d); d += 1000 window.setTimeout(function() { text.tween('opacity', [0,1]); }, d); //show a while d+=5000 window.setTimeout(function(){shade.set('tween', {duration:scope.options.fxDuration}).tween('width', scope.width);}, d); d+=this.options.fxDuration; d+=500; window.setTimeout(scope.showNext.bind(scope), d); }; window.addEvent('domready', function domready () { var html5stage = $('header_html5'); if(html5stage) { var s = new bbstartslider(html5stage); } }); //history slider timeline (function() { var CSV = function () {}; CSV.separator = ";"; CSV.quote = "\""; CSV.newline = "\n"; CSV.parse = function (raw_csv) { var in_quote = false; raw_csv = raw_csv.replace(/\r/, ''); var char_length = raw_csv.length; var field_value = ''; var rows = []; var fields = []; var pos_in_field = 0; function fieldFinished() { // deactivated, because customer wants to set own linebreaks. field_value = field_value.replace(/^[\s\n\r\t]+/, '').replace(/[\s\n\r\t]+$/, '').replace(/\n/gm,''); fields.push(field_value); field_value = ''; pos_in_field = 0; } function rowFinished() { rows.push(fields); fields = []; field_value = ''; } for (var i = 0; i < char_length; i++) { var current_char = raw_csv.charAt(i); var next_char = raw_csv.charAt(i + 1); pos_in_field++; // quoted switches if (current_char == CSV.quote && (next_char != CSV.quote || pos_in_field == 1)) { in_quote = !in_quote; continue; } // escaped quote in a quoted string if (in_quote && current_char == CSV.quote && next_char == CSV.quote) { field_value += CSV.quote; i++; continue; } // a row ends if (!in_quote && current_char == CSV.newline && fields.length != 0) { fieldFinished(); rowFinished(); continue; } // a new field begins if (!in_quote && current_char == CSV.separator) { fieldFinished(); continue; } field_value += current_char; } if (field_value.length != 0) { fieldFinished(); } if (fields.length != 0) { rowFinished(); } return rows; }; (function () { 'use strict'; var decodeEntities = (function() { // this prevents any overhead from creating the object each time var element = document.createElement('div'); function decodeHTMLEntities (str) { if(str && typeof str === 'string') { element.innerHTML = str.replace(/\n/gm,'--------TEMP-------'); str = $(element).get('text').replace(/--------TEMP-------/gm,'\n'); $(element).set('text',str); } return str; } return decodeHTMLEntities; })(); window.Timeline = new Class({ initialize: function initialize(opts) { if (!opts.csv || !opts.wrapper) { return; } var self = this; this.activeYear = null; this.groupedYearElements = {}; this.wrapper = opts.wrapper; this.ranges = opts.ranges; this.imageSchema = opts.imageSchema; this.entries = this.parseCSV(opts.csv); this.entriesByYear = this.yearAssociation(this.entries); this.searchBoundaries(); this.prepareDefaultElements(); this.createInitialElements(); this.activateFirstYear(); setTimeout(function () { self.updateYearElementsWidth(); self.wrapper.setStyle('visibility', 'visible'); }, 50); //console.log('doing stuff', this.entries, opts.wrapper); }, parseCSV: function parseCSV(csv) { var decoded = decodeEntities(csv); var rows = CSV.parse(decoded); var entries = []; rows.each(function (raw_entry) { if (raw_entry.length >= 3) { var entry = { year: parseInt(raw_entry[0]), caption: (raw_entry[1]), copy: (raw_entry[2]) } if (entry.year) { entries.push(entry); } } }); entries.sort(function (a, b) { return a.year - b.year; }); return entries; }, yearAssociation: function yearAssociation(entries) { var associated = {}; entries.each(function (entry) { associated[entry.year] = entry; }); return associated; }, prepareDefaultElements: function prepareDefaultElements() { var self = this; this.el_caption = this.wrapper.getElement('.caption'); this.el_info_text = this.wrapper.getElement('.info-text'); this.el_active_year = this.wrapper.getElement('.year-selected'); this.el_slider_wrapper = this.wrapper.getElement('.slider-wrapper'); this.el_timeline_wrapper = this.wrapper.getElement('.timeline-wrapper'); this.el_timeline_years_wrapper = this.wrapper.getElement('.timeline-years-wrapper'); this.el_timeline_years = this.wrapper.getElement('.timeline-years'); this.el_timeline_years.empty(); this.el_year_groups = this.wrapper.getElement('.year-groups'); this.el_year_groups.empty(); this.el_image = this.wrapper.getElement('.image'); this.el_arrow_right = this.wrapper.getElement('.arrow-right'); this.el_arrow_right.addEvent('click', function (ev) { ev.preventDefault(); self.activateYear(self.getNextAvailableYear(self.activeYear, 1)); }); this.el_arrow_left = this.wrapper.getElement('.arrow-left'); this.el_arrow_left.addEvent('click', function (ev) { ev.preventDefault(); self.activateYear(self.getNextAvailableYear(self.activeYear, -1)); }); this.wrapper.getElement('.skip-end').addEvent('click', function (ev) { ev.preventDefault(); self.activateLastYear(); }); this.wrapper.getElement('.skip-start').addEvent('click', function (ev) { ev.preventDefault(); self.activateFirstYear(); }); }, createInitialElements: function createInitialElements() { var self = this; self.entries.each(function (entry) { var el_timeline_year_link = new Element('a', { text: entry.year, href: '#' }); el_timeline_year_link.addEvent('click', function (ev) { ev.preventDefault(); self.activateYear(entry.year); }); var el_timeline_year = new Element('td', { 'class': 'year_' + entry.year }); entry.el = el_timeline_year; el_timeline_year.adopt(el_timeline_year_link); self.el_timeline_years.adopt(el_timeline_year); }); self.ranges.each(function (range) { var from = range[0]; var to = range[1] ? range[1] : new Date().getFullYear(); self.groupedYearElements[range[0]] = self.groupedYearElements[range[0]] || []; self.entries.each(function (entry) { if (entry.year >= from && entry.year <= to) { self.groupedYearElements[range[0]].push(entry); } }); var el_link = new Element('a', { text: range[0] + ' - ' + (range[1] ? range[1] : 'now'), href: '#' }); el_link.addEvent('click', function (ev) { ev.preventDefault(); self.activateYear(self.entriesByYear[range[0]] ? range[0] : self.getNextAvailableYear(range[0], 1)); }); var el_range = new Element('td', { 'data-from': range[0], 'data-to': range[1] ? range[1] : new Date().getFullYear() }); el_range.adopt(el_link); self.el_year_groups.adopt(el_range); }); }, updateYearElementsWidth: function updateYearElementsWidth() { var self = this; var availableWidth = this.el_slider_wrapper.getSize().x; for (var fromYear in self.groupedYearElements) { var els = self.groupedYearElements[fromYear]; var widthPerElement = Math.floor(availableWidth / els.length); var widthSum = widthPerElement * els.length; var addRoundingError = 0; if (widthSum < availableWidth) { addRoundingError = availableWidth - widthSum; } els.each(function (entry) { entry.el.getElement('a').setStyle('width', widthPerElement + (addRoundingError > 0?1:0) ); addRoundingError--; }); } }, searchBoundaries: function searchBoundaries() { var self = this; var earliest = 9999; var latest = 0; self.entries.each(function (entry) { earliest = Math.min(entry.year, earliest); latest = Math.max(entry.year, latest); }); this.earliest = earliest; this.latest = latest; }, activateFirstYear: function activateFirstYear() { var self = this; self.activateYear(self.earliest); }, activateLastYear: function activateLastYear() { var self = this; self.activateYear(self.latest); }, activateYear: function activateYear(year) { if (this.activeYear == year || year == null || !this.entriesByYear[year]) { return; } var self = this; this.activeYear = year; //console.log('activating', year); this.el_year_groups.getElements('td').removeClass('active'); this.el_year_groups.getElements('td').each(function (el, idx) { if (el.get('data-from') <= year && el.get('data-to') >= year) { el.addClass('active'); var new_left = -1 * idx * self.el_slider_wrapper.getSize().x; self.el_timeline_years_wrapper.tween('left', new_left); } }); this.el_timeline_years.getElements('td').removeClass('active'); this.el_timeline_years.getElements('.year_' + year).addClass('active'); this.el_active_year.set('text', this.activeYear); this.el_caption.set('text', this.entriesByYear[this.activeYear].caption); this.el_info_text.set('text', this.entriesByYear[this.activeYear].copy); this.el_info_text.set('html', this.el_info_text.get('html').replace(/\[(.+?)\]/mgi, "

$1

")); this.el_arrow_left.setStyle('visibility', this.activeYear == this.earliest ? 'hidden' : 'visible'); this.el_arrow_right.setStyle('visibility', this.activeYear == this.latest ? 'hidden' : 'visible'); this.el_image.set('src', this.imageSchema.substitute({ year: year })); }, getNextAvailableYear: function getNextAvailableYear(origin, direction) { var check = origin; for (var i = 0; i < 100; i++) { // if no matching year is found within a century, it is unlikely to find it anyway check += direction; for (var h = 0; h < this.entries.length; h++) { if (this.entries[h].year == check) { return check; } } } return null; } }); })(); }()); //end timeline