/* Coppenrath & Wiese JS Methods by http://www.comspace.de Dependencies: Mootools Core 1.2.3+ Mootools More -Slider (mooflow) -Assets (mooflow) -Fx.Accordion */ /* * InputToggle: convenience Class to clear Inputs on Focus/hover * @author jgi@comspace.de */ var InputToggle = new Class({ Implements:[Options, Events], options:{ 'selector': 'input.toggle', 'focus': true, //toggle on focus/unfocus 'hover':false, //toggle on hover 'select':true //select value on toggle }, initialize: function(options){ this.setOptions(options); var elements = document.id(document.body).getElements(this.options.selector); if(!elements || (!this.options.focus && !this.options.hover)){ return; } this.prepareElements(elements); }, prepareElements: function(elements){ elements.each(function(element){ element.store('originalValue', element.get('value')); if(this.options.focus){ element.addEvents({ 'focus': this.onToggle.bind(this), 'blur': this.onUnToggle }); } if(this.options.hover){ element.addEvents({ 'mouseenter': this.onToggle.bind(this), 'mouseleave': this.onUnToggle }); } }.bind(this)); }, onToggle: function(event){ var element = document.id(event.target); if(element.get('value') === element.retrieve('originalValue')){ element.set('value', ''); } else if(this.options.select) { element.select(); } }, onUnToggle: function(event){ var element = document.id(event.target); if(element.get('value') === ""){ element.set('value', element.retrieve('originalValue')); } } }); /* Image.changeSrc(src), Image.resetSrc() - convenience method for cms-friendly src-replacement Author: jgi@comspace.de Requires: - Core - Element (store, retrieve) */ Element.implement({ changeSrc: function(src) { if(!src){return this;} if(!this.retrieve('orgsrc')){this.store('orgsrc', this.src);} this.src=src; return this; }, resetSrc: function() { if(!this.retrieve('orgsrc')){return this;} this.src=this.retrieve('orgsrc'); return this; } }); /* showSearch - animated search-form for coppenrath&wiese Author: jgi@comspace.de Requires: - Core - Element (store, retrieve, ...) - Event - Function (delay) - Fx.Morph */ var showSearch = new Class({ Implements:[Options], options:{ 'trigger':'li.n5', 'content':'.vSearchWrapper', 'mouseout':'#frame_nav', 'delay':1000 }, initialize:function(options){ this.locked = false; this.focuslocked = false; this.shown = true; this.setOptions(options); this.contentEl = $$(this.options.content)[0]; this.triggerEl = $$(this.options.trigger)[0]; this.mouseoutEl = $$(this.options.mouseout)[0]; if(!this.contentEl || !this.triggerEl || !this.mouseoutEl){ return; } this.showFx = new Fx.Morph(this.contentEl, {duration:1000, transition:Fx.Transitions.Bounce.easeOut}); this.hideFx = this.showFx; this.setupEvents(); if(!document.body.hasClass('start')){//nofx on init, except for start this.shown = false; this.contentEl.setStyles({'top':'-40px', 'opacity': 0}); } else { this.hide(0); } }, setupEvents:function(){ this.triggerEl.addEvents({'mouseenter': this.show.bind(this), 'click':function(ev){ev.stop(); this.contentEl.getElement('input').focus();}.bind(this)}); this.mouseoutEl.addEvents({ 'mouseleave': this.hide.bind(this) }); this.contentEl.addEvents({ 'mouseenter':this.lock.bind(this), 'mouseleave':function(){this.unlock(); this.hide();}.bind(this) }); this.contentEl.getElements('input').addEvents({ 'focus': function(){this.focuslock(); this.lock();}.bind(this), 'blur':function(){this.focusunlock();this.unlock(); this.hide();}.bind(this) }); }, show:function(options){ if(options.stop){ options.stop(); } if(this.shown){return;} this.shown = true; this.showFx.start({'top':['-40', 0], 'opacity':[0,1]}); }, hide:function(options){ var delay = (options)?options:this.options.delay; if(this.locked || this.focuslocked || !this.shown){ return; } /* if(delay === 0){ this.contentEl.setStyles({'top':'-40px', 'opacity':0}); this.shown = false; return; } */ (function(){ if(this.locked || this.focuslocked || !this.shown){ return; } this.shown = false; this.showFx.start({'top':[0, '-40'], 'opacity':[1, 0]}); }.bind(this)).delay(delay); }, lock:function(){ this.locked = true; }, unlock:function(){ this.locked = false; }, focuslock:function(){ this.focuslocked = true; }, focusunlock:function(){ this.focuslocked = false; } }); //switch to /* showSearch - initialize coverflow: mooflow when flash is unavailable, or flash version (for coppenrath&wiese) Author: jgi@comspace.de Requires: - Core - Element (store, retrieve, ...) - Event - Function (delay) - Fx.Morph */ var cfSwitch = new Class({ Implements:[Options], options:{ minFlash:9, startIndex:3 }, initialize:function(options){ if(!options.el){return;} this.setOptions(options); var optEl = document.id('cfactive'); if(!window.cfSwitchIndex && optEl && optEl.get('class')){ this.options.startIndex = optEl.get('class'); } if(window.cfSwitchIndex){ this.options.startIndex = window.cfSwitchIndex; } //if(this.options.startIndex < 3){this.options.startIndex = 3;} if(Browser.Plugins.Flash.version && Browser.Plugins.Flash.version >= this.options.minFlash){ this._startFlashFlow(); }else { this._startMooFlow(); } }, _startMooFlow:function(){ //TODO: remove std-values this.options.el.removeClass('noimgs'); //if(this.options.startIndex < 4){this.options.startIndex = 4;} this.mf = new MooFlow(this.options.el, { bgColor:'transparent', useMouseWheel: false, heightRatio: 0.304, offsetY:-45, useCaption: true, startIndex: parseInt(this.options.startIndex - 1, 10), factor: 98, reflection: 0, useViewer:true, onClickView: function(obj){ //alert('der Link des Bildes '+obj.title+'\n zeigt auf '+obj.href); if(!obj.href){return false;} window.location=obj.href; } }); this.options.el.addClass('ieload'); this.mf.addEvent('glideToI', function(index){ var plusminus = 4; var outid0 = index - plusminus; var outid1 = index + plusminus; //console.log('glide ', mf, index, mf.loadedImages[outid]); var imgs = this.loadedImages.length; for(var i = 0; idiv>ul>li').each(function(el){ if(el.getElement('li')){ el.addEvents({ 'mouseenter':function(ev){ if(el.getPrevious()){ el.style.marginBottom = '-3px'; } el.getElements('ul').each(function(ul){ul.style.display = 'block';}); }, 'mouseleave':function(ev){ el.style.marginBottom = '0px'; el.getElements('ul').each(function(ul){ul.style.display = 'none';}); }}); } }); } } else { mod.setStyles({'display': 'block', 'visibility':'visible', 'opacity':0}).tween('opacity', [0,0.98]).getParent('li').addClass('animating'); } morph.start({'top':['5px', '38px']}); }, mouseleave:function(){ morph.cancel(); //mod.get('tween').cancel(); mod.setStyles({'display': 'none', 'opacity':0, 'visibility':'hidden'}); } }); }); } }); function popGeneric(url) { newwindow=window.open(url,'cwWin',"width=800,height=600,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 popGenericScroll(url) { newwindow=window.open(url,'cwWin',"width=800,height=600,location=no,menubar=no,resizable=yes,status=yes,scrollbars=1,toolbar=no,top="+((screen.height-300)/2)+",left="+((screen.width-500)/2)); if (window.focus) {newwindow.focus()} return false; } // AUTOLOAD CODE BLOCK // AUTOLOAD CODE BLOCK window.addEvent('domready', function(){ if( window.Mediabox){ Mediabox.scanPage = function() { // $$('#mb_').each(function(hide) { hide.set('display', 'none'); }); var links = $$("a").filter(function(el) { return el.rel && el.rel.test(/^lightbox/i); }); $$(links).addEvent('click', function(ev){ev.stop();}).mediabox({fullscreenNum: '0', fullscreen: 'false',NBloop: 'false', NBpath: '/assets/js/NonverBlaster.swf'}, null, function(el) { var rel0 = this.rel.replace(/[[]|]/gi," "); var relsize = rel0.split(" "); return (this == el) || ((this.rel.length > 8) && el.rel.match(relsize[1])); }); } }}); var Cwmap = new Class({ 'initialize':function(){ var el = this.initElements(); if(!el){return;} this.fx = new Fx.Tween($('map_europe').getParent().setStyle('opacity', '0'), {duration:500, link:'ignore'}); this.initEvents(); }, elements:{ container:null, area_europe:null, area_close:null }, initElements:function(){ this.elements.container = document.getElement('.cnt_worldmap'); if(!this.elements.container){ return false; } //this.elements.container.getElements('img').each(function(img){ //img.store('originalSource', img.get('src')); //}); this.elements.area_europe = this.elements.container.getElement('area.europe'); this.elements.area_close = this.elements.container.getElements('area.close'); this.elements.countries = this.elements.container.getElements('area.tip'); //add popup images and tips var needle = document.id('needlePrototype'); var needleBrd = document.id('needlePrototypeDe'); var needleUSA = document.id('needlePrototypeUSA'); var needleUK = document.id('needlePrototypeUK'); var hoverNeedles = []; this.elements.countries.each(function(el){ var coords = el.get('coords').split(','); var center = [parseInt(coords[0])+(parseInt(coords[2])-parseInt(coords[0]))/2, parseInt(coords[1])+(parseInt(coords[3])-parseInt(coords[1]))/2]; var img = document.getElement('img[usemap$="'+el.getParent().get('name')+'"]'); //console.log(el.get('title'), center, el.getParent().get('name'), img.getParent()); //console.log(el.get('title'), center, el.getParent().get('name'), img.getParent()); var hNeedle; if(el.hasClass('brd')){ hNeedle = needleBrd.clone(); } else if(el.hasClass('uk')) { hNeedle = needleUK.clone() } else if(el.hasClass('usa')){ hNeedle = needleUSA.clone() } else { hNeedle = needle.clone() } hNeedle.setStyles({ 'left': center[0], 'top':center[1], 'position':'absolute', 'display':'inline' }).set('data-title', el.get('data-title')) .addEvents({'click': function(ev){ ev.target = el; el.fireEvent('click', ev); }}) .inject(img.getParent()); el.store('needle', hNeedle); hoverNeedles.push(hNeedle); }); var myTips = new Tips(hoverNeedles,{fixed: true, title:'data-title'}); this.elements.countries.addEvents({ 'mouseenter':function(ev){ev.target.retrieve('needle').fireEvent('mouseenter', ev);}, 'mouseleave':function(ev){ev.target.retrieve('needle').fireEvent('mouseleave', ev);} }) return true; }, initEvents:function(){ this.elements.area_europe.addEvent('mouseenter', this.show.bind(this)); this.elements.area_close.addEvent('mouseenter', this.hide.bind(this)); this.elements.countries.addEvents({ 'mouseenter': function(ev){ //var mapid = ev.target.getParent().get('id'); //var numap = ev.target.get('target'); //var img = document.getElement('img[usemap$="'+mapid+'"]'); //img.set('src', numap); }, 'mouseleave': function(ev){ //var mapid = ev.target.getParent().get('id'); //var img = document.getElement('img[usemap$="'+mapid+'"]'); //img.set('src', img.retrieve('originalSource')); }, 'click': function(ev){ ev.stop(); var acc = document.getElement('.box_inneraccordion').retrieve('accordion'); var open = ev.target.get('rel'); var link = ev.target.get('href'); if(open !== 0){ acc.display(open - 1 ); } if(link && link != '' && link != '#'){ Mediabox.open(ev.target.href, ev.target.alt, '850 350'); } //console.log(ev.target.href); //return false; } }); }, show:function(){this.fx.start('opacity', 1);}, hide:function(){this.fx.start('opacity', 0);} }); //MooTools More, . Copyright (c) 2006-2009 Aaron Newton , Valerio Proietti & the MooTools team , MIT Style License. /* --- script: More.js name: More description: MooTools More license: MIT-style license requires: - Core/MooTools provides: [MooTools.More] ... */ MooTools.More = { 'version': '1.2.5.1', 'build': '254884f2b83651bf95260eed5c6cceb838e22d8e' }; /* --- script: Tips.js name: Tips description: Class for creating nice tips that follow the mouse cursor when hovering an element. license: MIT-style license authors: - Valerio Proietti - Christoph Pojer requires: - Core/Options - Core/Events - Core/Element.Event - Core/Element.Style - Core/Element.Dimensions - /MooTools.More provides: [Tips] ... */ (function(){ var read = function(option, element){ return (option) ? ($type(option) == 'function' ? option(element) : element.get(option)) : ''; }; this.Tips = new Class({ Implements: [Events, Options], options: { /* onAttach: $empty(element), onDetach: $empty(element), */ onShow: function(){ this.tip.setStyle('display', 'block'); }, onHide: function(){ this.tip.setStyle('display', 'none'); }, title: 'title', text: function(element){ return element.get('rel') || element.get('href'); }, showDelay: 100, hideDelay: 100, className: 'tip-wrap', offset: {x: 16, y: 16}, windowPadding: {x:0, y:0}, fixed: false }, initialize: function(){ var params = Array.link(arguments, {options: Object.type, elements: $defined}); this.setOptions(params.options); if (params.elements) this.attach(params.elements); this.container = new Element('div', {'class': 'tip'}); }, toElement: function(){ if (this.tip) return this.tip; return this.tip = new Element('div', { 'class': this.options.className, styles: { position: 'absolute', top: 0, left: 0 } }).adopt( new Element('div', {'class': 'tip-top'}), this.container, new Element('div', {'class': 'tip-bottom'}) ); }, attach: function(elements){ $$(elements).each(function(element){ var title = read(this.options.title, element), text = read(this.options.text, element); element.erase('title').store('tip:native', title).retrieve('tip:title', title); element.retrieve('tip:text', text); this.fireEvent('attach', [element]); var events = ['enter', 'leave']; if (!this.options.fixed) events.push('move'); events.each(function(value){ var event = element.retrieve('tip:' + value); if (!event) event = this['element' + value.capitalize()].bindWithEvent(this, element); element.store('tip:' + value, event).addEvent('mouse' + value, event); }, this); }, this); return this; }, detach: function(elements){ $$(elements).each(function(element){ ['enter', 'leave', 'move'].each(function(value){ element.removeEvent('mouse' + value, element.retrieve('tip:' + value)).eliminate('tip:' + value); }); this.fireEvent('detach', [element]); if (this.options.title == 'title'){ // This is necessary to check if we can revert the title var original = element.retrieve('tip:native'); if (original) element.set('title', original); } }, this); return this; }, elementEnter: function(event, element){ this.container.empty(); ['title', 'text'].each(function(value){ var content = element.retrieve('tip:' + value); if (content) this.fill(new Element('div', {'class': 'tip-' + value}).inject(this.container), content); }, this); $clear(this.timer); this.timer = (function(){ this.show(element); this.position((this.options.fixed) ? {page: element.getPosition()} : event); }).delay(this.options.showDelay, this); }, elementLeave: function(event, element){ $clear(this.timer); this.timer = this.hide.delay(this.options.hideDelay, this, element); this.fireForParent(event, element); }, fireForParent: function(event, element){ element = element.getParent(); if (!element || element == document.body) return; if (element.retrieve('tip:enter')) element.fireEvent('mouseenter', event); else this.fireForParent(event, element); }, elementMove: function(event, element){ this.position(event); }, 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'}, obj = {}; for (var z in props){ obj[props[z]] = event.page[z] + this.options.offset[z]; if ((obj[props[z]] + tip[z] - scroll[z]) > size[z] - this.options.windowPadding[z]) obj[props[z]] = event.page[z] - this.options.offset[z] - tip[z]; } this.tip.setStyles(obj); }, fill: function(element, contents){ if(typeof contents == 'string') element.set('html', contents); else element.adopt(contents); }, show: function(element){ if (!this.tip) document.id(this); if (!this.tip.getParent()) this.tip.inject(document.body); this.fireEvent('show', [this.tip, element]); }, hide: function(element){ if (!this.tip) document.id(this); this.fireEvent('hide', [this.tip, element]); } }); })();