/* Copyright (C) 2007 - 2009 YOOtheme GmbH */ var YOOBase = { /* Match height of div tags */ matchDivHeight: function(selector, minWidth) { var maxHeight = 0; var matchDivs = []; var selectors = selector.split(" "); var elements = selectors.shift(); var script = ''; selectors.each(function(el, i){ script += '.getElement("' + el + '")'; }); $ES(elements).each(function(element, i){ eval('matchDivs.push(element' + script + ');'); }); matchDivs.each(function(div, i){ if (!$chk(div)) return; var divHeight, divPadding; if (div.offsetHeight) { divHeight = div.offsetHeight; divPadding = 0; divPadding += div.getStyle('padding-top').toInt(); divPadding += div.getStyle('padding-bottom').toInt(); divHeight -= divPadding; divBorder = 0; divBorder += div.getStyle('border-top-width').toInt(); divBorder += div.getStyle('border-bottom-width').toInt(); divHeight -= divBorder; } else if (div.style.pixelHeight) { divHeight = div.style.pixelHeight; } maxHeight = Math.max(maxHeight, divHeight); }); if (minWidth != undefined) { maxHeight = Math.max(maxHeight, minWidth); } matchDivs.each(function(div, i){ if (!$chk(div)) return; if(window.ie6) { /* use height style for IE6 compatibility */ div.setStyle('height', maxHeight + 'px') } else { div.setStyle('min-height', maxHeight + 'px') } }); } }; var YOOMorph = new Class({ initialize: function(element, enter, leave, enterFx, leaveFx, elementFx) { this.setOptions({ duration: 500, transition: Fx.Transitions.expoOut, wait: false, ignoreClass: '' }, enterFx); var options = this.options; $$(element).each(function(el, i){ var elfx = el; if (elementFx) { var elms = el.getElementsBySelector(elementFx); if (elms.length > 0) { elfx = elms[0]; } } var fx = new Fx.Styles(elfx, options); if (!($chk(options.ignoreClass) && el.hasClass(options.ignoreClass))) { el.addEvent('mouseenter', function(e){ fx.setOptions(options, enterFx).start(enter); }); el.addEvent('mouseleave', function(e){ fx.setOptions(options, leaveFx).start(leave); }); } }); } }); YOOMorph.implement(new Options); var YOOBackgroundFx = new Class({ initialize: function(options) { this.setOptions({ transition: Fx.Transitions.linear, duration: 9000, wait: false, colors: ['#FFFFFF', '#999999'] }, options); var body = new Element(document.body); var fx = body.effects(this.options); var index = 0; var colors = this.options.colors; var timer = animate.periodical(this.options.duration * 2); animate(); function animate() { fx.start({ 'background-color': colors[index] }); if (index + 1 >= colors.length) { index = 0; } else { index++; }; } } }); YOOBackgroundFx.implement(new Options);/* Copyright (C) 2007 - 2009 YOOtheme GmbH */ var YOOAccordionMenu = new Class({ initialize: function(togglers, elements, options) { this.setOptions({ accordion: 'default' }, options); this.togs = togglers; this.elms = elements; switch(this.options.accordion) { case 'slide': this.createSlide(); break; default: this.createDefault(); } }, createDefault: function() { var options = {}; if (!$defined(this.options.display) && !$defined(this.options.show)) { options = { show: -1 }; } $ES(this.togs).each(function(tog, i) { if (tog.hasClass('active')) options = { show: i }; }.bind(this)); var accordionMenu = new Fx.Accordion(this.togs, this.elms, $extend(this.options, options)); }, createSlide: function() { $ES(this.togs).each(function(tog, i) { var span = tog.getElement('span'); var ul = tog.getElement(this.elms); var fx = new Fx.Slide(ul, { transition: Fx.Transitions.linear, duration: 250 }); if (!(tog.hasClass('active') || this.options.display == 'all' || this.options.display == i)) { fx.hide(); } span.addEvent('click', function(){ fx.toggle(); }); }.bind(this)); } }); YOOAccordionMenu.implement(new Options);/* Copyright (C) 2007 - 2009 YOOtheme GmbH */ var YOOFancyMenu = new Class({ initialize: function(menu, options) { this.setOptions({ transition: Fx.Transitions.sineInOut, duration: 500, wait: false, onClick: Class.empty, opacity: 1, mode: 'move', slideOffset: 30, colorSelector: ['red', 'pink', 'blue', 'green', 'orange', 'yellow', 'lilac', 'turquoise'], itemSelector: 'li.level1', activeSelector: 'li.active' }, options); this.menu = $(menu), this.current = this.menu.getElement(this.options.activeSelector); this.li = []; this.div = []; this.menu.getElements(this.options.itemSelector).each(function(item, i){ this.createBackground(item, i); item.addEvent('click', function(event){ this.clickItem(event, item); }.bind(this)); item.addEvent('mouseenter', function(){ this.mouseenterItem(item, i); }.bind(this)); if (this.options.mode == 'move') { item.addEvent('mouseleave', function(){ this.mouseleaveItem(this.current, i); }.bind(this)); } else { item.addEvent('mouseleave', function(){ this.mouseleaveItem(item, i); }.bind(this)); } }.bind(this)); if (this.options.mode == 'move') { if (this.current) { this.setCurrent(this.current) } else { var first = this.menu.getElement('li'); first.addClass('active'); first.addClass('current'); this.setCurrent(first); }; } }, createBackground: function(item, i) { if (this.options.mode == 'move' && i != 0) return; var css = 'fancy ' + 'bg' + (i+1); this.options.colorSelector.each(function(col, i){ if (item.hasClass(col)) { css += ' bg-' + col; } }); this.div[i] = new Element('div', {'class': 'fancy-1'}).adopt(new Element('div', {'class': 'fancy-2'}).adopt(new Element('div', {'class': 'fancy-3'}))); this.div[i].fx = this.div[i].effects(this.options); this.li[i] = new Element('li', {'class': css}).adopt(this.div[i]).injectInside(this.menu); this.li[i].fx = this.li[i].effects(this.options); }, setCurrent: function(item) { this.li[0].setStyles({ 'left': item.offsetLeft, 'width': item.offsetWidth, 'visibility': 'visible', 'opacity': this.options.opacity }); this.current = item; }, clickItem: function(event, item) { if (!this.current) this.setCurrent(item); this.current = item; this.options.onClick(new Event(event), item); }, mouseenterItem: function(item, i) { switch (this.options.mode) { case 'fade': this.fadeFx(item, i, true); break; case 'slide': this.slideFx(item, i, true); break; default: this.moveFx(item, 0); } }, mouseleaveItem: function(item, i) { switch (this.options.mode) { case 'fade': this.fadeFx(item, i, false); break; case 'slide': this.slideFx(item, i, false); break; default: this.moveFx(item, 0); } }, moveFx: function(item, i) { if(!this.current) return; this.li[i].fx.custom({ 'left': [this.li[i].offsetLeft, item.offsetLeft], 'width': [this.li[i].offsetWidth, item.offsetWidth] }); }, fadeFx: function(item, i, show) { if (show) { this.li[i].fx.setOptions(this.options); this.li[i].fx.set({ 'left': item.offsetLeft, 'width': item.offsetWidth }); this.li[i].fx.custom({ 'opacity': [0, 1] }); } else { var dur = this.options.duration * 2; this.li[i].fx.setOptions({duration: dur}); this.li[i].fx.custom({ 'opacity': [1, 0] }); } }, slideFx: function(item, i, show) { var offset = this.options.slideOffset; if (show) { this.li[i].fx.set({ 'opacity': 1, 'left': item.offsetLeft, 'width': item.offsetWidth }); this.div[i].fx.set({ 'margin-top': offset }); this.div[i].fx.custom({ 'margin-top': [offset, 0] }); } else { this.div[i].fx.set({ 'margin-top': 0 }); this.div[i].fx.custom({ 'margin-top': [0, offset] }); } } }); YOOFancyMenu.implement(new Options);/* Copyright (C) 2007 - 2009 YOOtheme GmbH */ var YOODropdownMenu = new Class({ initialize: function(element, options) { this.setOptions({ mode: 'default', duration: 600, transition: Fx.Transitions.linear, wait: false }, options); var reset = {'width': 0, 'height': 0, 'opacity': 0}; switch(this.options.mode) { case 'width': reset = {'width': 0, 'opacity': 0}; break; case 'height': reset = {'height': 0, 'opacity': 0}; break; } $$(element).each(function(li) { var ul = li.getElement('ul'); if (ul) { var fx = new Fx.Styles(ul, this.options); var styles = ul.getStyles('width','height','opacity'); ul.setStyles(reset); li.addEvents({ mouseenter: function() { var parent = li.getParent(); if (parent.getStyle('overflow') == 'hidden') parent.setStyle('overflow', 'visible'); fx.element.setStyle('overflow', 'hidden'); fx.start(styles); }, mouseleave: function() { fx.stop(); ul.setStyles(reset); } }); } }.bind(this)); } }); YOODropdownMenu.implement(new Options);/* Copyright (C) 2007 - 2009 YOOtheme GmbH */ var YOOTools = { start: function() { /* Match height of div tags */ YOOTools.setDivHeight(); /* Accordion menu */ new YOOAccordionMenu('div#middle ul.menu li.toggler', 'ul.accordion', { accordion: 'slide' }); /* Dropdown menu */ new YOODropdownMenu('div#menu li.parent', { mode: 'height', transition: Fx.Transitions.Expo.easeOut }); /* Morph: main menu - level1 (tab) */ var menuEnter = { 'color': '#dc3200' }; var menuLeave = { 'color': '#323232' }; switch (YtSettings.color) { case 'yellow': menuEnter = { 'color': '#bb8a01' }; break; case 'pink': menuEnter = { 'color': '#834b94' }; break; case 'turquoise': menuEnter = { 'color': '#3c8b9c' }; break; case 'mossgreen': menuEnter = { 'color': '#829333' }; break; case 'green': menuEnter = { 'color': '#6a9939' }; break; case 'blue': menuEnter = { 'color': '#2f66a7' }; break; } new YOOMorph('div#menu li.level1', menuEnter, menuLeave, { transition: Fx.Transitions.linear, duration: 0, ignoreClass: 'active' }, { transition: Fx.Transitions.sineIn, duration: 300 }, 'a.level1'); new YOOMorph('div#menu li.level1', menuEnter, menuLeave, { transition: Fx.Transitions.linear, duration: 0, ignoreClass: 'active'}, { transition: Fx.Transitions.sineIn, duration: 300 }, 'span.sub'); /* Morph: main menu - level2 and deeper (color) */ var selector = 'div#menu li.level2 a, div#menu li.level2 span.separator'; /* fix for Opera because Mootools 1.1 is not compatible with latest Opera version */ if (window.opera) { selector = 'div#menu li.item1 li.level2 a, div#menu li.item1 li.level2 span.separator, div#menu li.item2 li.level2 a, div#menu li.item2 li.level2 span.separator, div#menu li.item3 li.level2 a, div#menu li.item3 li.level2 span.separator, div#menu li.item4 li.level2 a, div#menu li.item4 li.level2 span.separator, div#menu li.item5 li.level2 a, div#menu li.item5 li.level2 span.separator, div#menu li.item6 li.level2 a, div#menu li.item6 li.level2 span.separator, div#menu li.item7 li.level2 a, div#menu li.item7 li.level2 span.separator'; } new YOOMorph(selector, menuEnter, menuLeave, { transition: Fx.Transitions.linear, duration: 0, ignoreClass: 'active' }, { transition: Fx.Transitions.sineIn, duration: 300 }); /* Morph: sub menu - level1 */ new YOOMorph('div#middle ul.menu a, div#middle ul.menu span.separator', menuEnter, menuLeave, { transition: Fx.Transitions.expoOut, duration: 0, ignoreClass: 'active' }, { transition: Fx.Transitions.sineIn, duration: 300 }); /* Smoothscroll */ new SmoothScroll({ duration: 500, transition: Fx.Transitions.Expo.easeOut }); }, /* Include script */ include: function(library) { $ES('script').each(function(s, i){ var src = s.getProperty('src'); var path = ''; if (src && src.match(/yoo_tools\.js(\?.*)?$/)) path = src.replace(/yoo_tools\.js(\?.*)?$/,''); if (src && src.match(/template\.js\.php(\?.*)?$/)) path = src.replace(/template\.js\.php(\?.*)?$/,''); if (path != '') document.write(''); }); }, /* Match height of div tags */ setDivHeight: function() { YOOBase.matchDivHeight('div.headerbox div.deepest', 0, 40); YOOBase.matchDivHeight('div.topbox div.deepest', 0, 40); YOOBase.matchDivHeight('div.bottombox div.deepest', 0, 40); YOOBase.matchDivHeight('div.maintopbox div.deepest', 0, 40); YOOBase.matchDivHeight('div.mainbottombox div.deepest', 0, 40); YOOBase.matchDivHeight('div.contenttopbox div.deepest', 0, 40); YOOBase.matchDivHeight('div.contentbottombox div.deepest', 0, 40); } }; /* Add functions on window load */ window.addEvent('domready', YOOTools.start); /* Load IE6 fix */ if (window.ie6) { YOOTools.include('addons/ie6fix.js'); YOOTools.include('addons/ie6png.js'); YOOTools.include('yoo_ie6fix.js'); }