//MooTools More, . Copyright (c) 2006-2009 Aaron Newton , Valerio Proietti & the MooTools team , MIT Style License. /* Clientcide Copyright (c) 2006-2009, http://www.clientcide.com/wiki/cnet-libraries#license*/ //Contents: More, Fx.Elements, Element.Shortcuts, SimpleCarousel //This lib: http://www.clientcide.com/js/build.php?excludeLibs[]=mootools-core&require[]=SimpleCarousel&compression=jsmin MooTools.More={'version':'1.2.4.4','build':'6f6057dc645fdb7547689183b2311063bd653ddf'}; Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(elements,options){this.elements=this.subject=$$(elements);this.parent(options);},compute:function(from,to,delta){var now={};for(var i in from){var iFrom=from[i],iTo=to[i],iNow=now[i]={};for(var p in iFrom)iNow[p]=this.parent(iFrom[p],iTo[p],delta);} return now;},set:function(now){for(var i in now){var iNow=now[i];for(var p in iNow)this.render(this.elements[i],p,iNow[p],this.options.unit);} return this;},start:function(obj){if(!this.check(obj))return this;var from={},to={};for(var i in obj){var iProps=obj[i],iFrom=from[i]={},iTo=to[i]={};for(var p in iProps){var parsed=this.prepare(this.elements[i],p,iProps[p]);iFrom[p]=parsed.from;iTo[p]=parsed.to;}} return this.parent(from,to);}}); Element.implement({isDisplayed:function(){return this.getStyle('display')!='none';},isVisible:function(){var w=this.offsetWidth,h=this.offsetHeight;return(w==0&&h==0)?false:(w>0&&h>0)?true:this.isDisplayed();},toggle:function(){return this[this.isDisplayed()?'hide':'show']();},hide:function(){var d;try{d=this.getStyle('display');}catch(e){} return this.store('originalDisplay',d||'').setStyle('display','none');},show:function(display){display=display||this.retrieve('originalDisplay')||'block';return this.setStyle('display',(display=='none')?'block':display);},swapClass:function(remove,add){return this.removeClass(remove).addClass(add);}}); var SimpleCarousel = new Class({ Implements: [Options, Events], options: { // onRotate: $empty, // onStop: $empty, // onAutoPlay: $empty, // onShowSlide: $empty, slideInterval: 4000, transitionDuration: 700, startIndex: 0, buttonOnClass: "selected", buttonOffClass: "off", rotateAction: "none", rotateActionDuration: 100, autoplay: true }, initialize: function(container, slides, buttons, options){ this.container = document.id(container); var instance = this.container.retrieve('SimpleCarouselInstance'); if (instance) return instance; this.container.store('SimpleCarouselInstance', this); this.setOptions(options); this.container.addClass('hasCarousel'); this.slides = $$(slides); this.buttons = $$(buttons); this.createFx(); this.showSlide(this.options.startIndex); if (this.options.autoplay) this.autoplay(); if (this.options.rotateAction != 'none') this.setupAction(this.options.rotateAction); return this; }, toElement: function(){ return this.container; }, setupAction: function(action) { this.buttons.each(function(el, idx){ document.id(el).addEvent(action, function(ev){ if (el.hasClass('off')){ ev.stop(); this.slideFx.setOptions(this.slideFx.options, {duration: this.options.rotateActionDuration}); if (this.currentSlide != idx) this.showSlide(idx); this.stop(); } }.bind(this)); }, this); }, createFx: function(){ if (!this.slideFx) this.slideFx = new Fx.Elements(this.slides, {duration: this.options.transitionDuration}); this.slides.each(function(slide){ slide.setStyle('opacity',0); }); }, showSlide: function(slideIndex){ var action = {}; this.slides.each(function(slide, index){ if (index == slideIndex && index != this.currentSlide){ //show if (document.id(this.buttons[index])) document.id(this.buttons[index]).swapClass(this.options.buttonOffClass, this.options.buttonOnClass); action[index.toString()] = { opacity: 1 }; } else { if (document.id(this.buttons[index])) document.id(this.buttons[index]).swapClass(this.options.buttonOnClass, this.options.buttonOffClass); action[index.toString()] = { opacity:0 }; } }, this); this.fireEvent('onShowSlide', slideIndex); this.currentSlide = slideIndex; this.slideFx.start(action); return this; }, autoplay: function(){ this.slideshowInt = this.rotate.periodical(this.options.slideInterval, this); this.fireEvent('onAutoPlay'); return this; }, stop: function(){ $clear(this.slideshowInt); this.fireEvent('onStop'); return this; }, rotate: function(){ var current = this.currentSlide; var next = (current+1 >= this.slides.length) ? 0 : current+1; this.showSlide(next); this.fireEvent('onRotate', next); return this; } }); /*Rotation Box*/ var rotationbox = new Class({ clickStat : true, currentIndex : 0, nextIndex : 1, Implements: [Options], options: { rotationBox : 'rotation-box', slides : 'rotation-box .slide', slideButton : 'rotation-more', autoPlay : 2 }, initialize: function(options) { this.setOptions(options); if ( this.options.autoPlay == "") this.options.autoPlay = "no"; if (this.setupElements()) { this.setupEffect(); this.setupEvents(); } }, rotate: function() { var action = {}; if ( this.nextIndex > this.options.slides.length-1) this.nextIndex = 0; if ( this.currentIndex > this.options.slides.length-1) this.currentIndex = 0; this.options.slides[this.nextIndex].setStyle('left', '-441px'); this.options.slides.each(function(slide, index){ if (index == this.nextIndex){ action[index.toString()] = { left: 0 }; } else if (index == this.currentIndex) { action[index.toString()] = { left: '441px' }; } }, this); this.slideFx.start(action); Cufon.refresh(); this.currentIndex++; this.nextIndex++; }, setupElements: function() { this.options.rotationBox = $(this.options.rotationBox); this.options.slides = $$('#' + this.options.slides); if (this.options.slideButton === null ) return false; this.options.slideButton = $(this.options.slideButton).getParent(); if ( this.options.rotationBox === null || this.options.slides.length < 1 || this.options.slideButton === null ) { return false; } this.options.slides.each(function(slide, index) { if (index == 0) { slide.setStyles({ 'position':'absolute', 'left':0, 'top':0 }); } else { slide.setStyles({ 'position':'absolute', 'left':-441, 'top':0 }); }; }); return true; }, setupEffect: function() { this.slideFx = new Fx.Elements(this.options.slides, { duration: 500, onStart: function() { this.clickStat = false; }.bind(this), onComplete: function() { this.clickStat = true; }.bind(this) }); if (this.options.autoPlay != "no") { this.options.autoPlay = (this.options.autoPlay.toInt()) * 1000; this.timer = this.rotate.bind(this).periodical(this.options.autoPlay); } }, setupEvents: function() { this.options.slideButton.show().addEvent('click', function(ev){ ev.stop(); if (this.clickStat == true ) this.rotate(); }.bind(this)); if (this.options.autoPlay != "no") { this.options.rotationBox.addEvents({ mouseenter: function() { clearInterval(this.timer); }.bind(this), mouseleave: function() { this.timer = this.rotate.bind(this).periodical(this.options.autoPlay); }.bind(this) }) } } }); window.addEvent('domready', function() { /*Search input value change*/ /*$$('#search-text').addEvent('focus', function(ev) { this.set('value', ''); }); $$('#search-text').addEvent('blur', function(ev) { this.set('value', 'Search'); });*/ var el = $('search-text1'); if(!el) el = $('search-text'); if(el){ el.store('org', el.get('value')).addEvents({ 'focus':function(){if(this.value == this.retrieve('org')) this.value='';}, 'blur':function(){if(this.value == '') this.value=this.retrieve('org');} }); } /*Toggle the expanding detail information for products*/ $$('.expand-it').setStyle('display', 'block'); $$('.expandable-toggle').setStyle('display', 'none'); //$$('.expandable-product-detail .anc-more').getParent('p').setStyle('display','none'); //$$('.expandable-toggle .expandable-product-detail .anc-more').getParent('p').setStyle('display','block'); $$('.expand-it').each(function(exp) { exp.store('toggleState', false).getElement('.expand-it-txt').store('originaltext', exp.getElement('.expand-it-txt').get('text')); //exp.store('toggleState', false); exp.getElements('a').addEvent('click', function(ev) { ev.stop(); if(exp.retrieve('toggleState') == false) { exp.getPrevious('.expandable-toggle').setStyle('display', 'block'); exp.getElement('.expand-it-img-left').set('src', '../../../xbcr/www-aastra-sg/expand-it-minus.png'); exp.getElement('.expand-it-txt').set('text', 'Hide information'); exp.getElement('.expand-it-img-right').set('src', '../../../xbcr/www-aastra-sg/expand-it-arrow-up.png'); exp.getPrevious('.close-it').setStyle('display', 'block'); exp.store('toggleState', true); } else { exp.getPrevious('.expandable-toggle').setStyle('display', 'none'); exp.getElement('.expand-it-img-left').set('src', '../../../xbcr/www-aastra-sg/expand-it-plus.png'); exp.getElement('.expand-it-txt').set('text', exp.getElement('.expand-it-txt').retrieve('originaltext')); //exp.getElement('.expand-it-txt').set('text','Partner information'); exp.getElement('.expand-it-img-right').set('src', '../../../xbcr/www-aastra-sg/expand-it-arrow-down.png'); exp.getPrevious('.close-it').setStyle('display', 'none'); exp.store('toggleState', false); } }); }); $$('.close-it').each(function(exp) { exp.getElements('a').addEvent('click', function(ev) { ev.stop(); exp.getNext('.expandable-toggle').setStyle('display', 'none'); exp.getNext('.expand-it').getElement('.expand-it-img-left').set('src', '../../../xbcr/www-aastra-sg/expand-it-plus.png'); exp.getNext('.expand-it').getElement('.expand-it-txt').set('text', exp.getNext('.expand-it').getElement('.expand-it-txt').retrieve('originaltext')); //exp.getNext('.expand-it').getElement('.expand-it-txt').set('text', 'Partner information'); exp.getNext('.expand-it').getElement('.expand-it-img-right').set('src', '../../../xbcr/www-aastra-sg/expand-it-arrow-down.png'); exp.setStyle('display', 'none'); exp.getNext('.expand-it').store('toggleState', false); }); }); /*Rotation Box*/ var rotationbox = $('rotation-box'); if(rotationbox){ rotationbox.setStyle('overflow', 'hidden'); var slides = $$('#rotation-box .slide').setStyle('display', 'block'); var slideButton = $('rotation-more').getParent(); var nextIndex = 1; var currentIndex = 0; slides.each(function(slide, index){ if (index == 0) { slide.setStyles({'position':'absolute', 'left':0, 'top':0}); } else { slide.setStyles({'position':'absolute', 'left':-441, 'top':0}); }; }); var slideFx = new Fx.Elements(slides, {duration: 500}); var action = http://www.aastra.sg/cps/rde/xchg/www-aastra-sg/hs.xsl/{}; if (slides.length > 1) { slideButton.show().addEvent('click', function(ev){ ev.stop(); if (nextIndex > slides.length-1) nextIndex = 0; if (currentIndex > slides.length-1) currentIndex = 0; slides[nextIndex].setStyle('left', '-441px'); slides.each(function(slide, index){ if (index == nextIndex){ action[index.toString()] = { left: 0 }; } else if (index == currentIndex) { action[index.toString()] = { left: '441px' }; } }, this); slideFx.start(action); Cufon.refresh(); currentIndex++; nextIndex++; }); } } /* Create Toggle for Product Downloads */ var downloadsContainer = $('downloads'); if (downloadsContainer) { downloadsContainer.getElements('li').each(function(li){ var element = li.getChildren('ul'); var toggler = li.getElement('a.toggle'); if (element && toggler) { element.setStyle('display', 'none'); if (toggler.getParent('li').hasClass('file')){ toggler.addClass('fileclosed'); } else { toggler.addClass('closed'); } toggler.addEvent('click', function(ev){ ev.stop(); if (this.getParent('li').hasClass('file')){ this.toggleClass('fileopened'); this.toggleClass('fileclosed'); } else { this.toggleClass('opened'); this.toggleClass('closed'); } this.getParent('li').getChildren('ul').toggle(); }); } }); } }); MooTools.More={'version':'1.2.4.4','build':'6f6057dc645fdb7547689183b2311063bd653ddf'}; Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(elements,options){this.elements=this.subject=$$(elements);this.parent(options);},compute:function(from,to,delta){var now={};for(var i in from){var iFrom=from[i],iTo=to[i],iNow=now[i]={};for(var p in iFrom)iNow[p]=this.parent(iFrom[p],iTo[p],delta);} return now;},set:function(now){for(var i in now){var iNow=now[i];for(var p in iNow)this.render(this.elements[i],p,iNow[p],this.options.unit);} return this;},start:function(obj){if(!this.check(obj))return this;var from={},to={};for(var i in obj){var iProps=obj[i],iFrom=from[i]={},iTo=to[i]={};for(var p in iProps){var parsed=this.prepare(this.elements[i],p,iProps[p]);iFrom[p]=parsed.from;iTo[p]=parsed.to;}} return this.parent(from,to);}}); Element.implement({isDisplayed:function(){return this.getStyle('display')!='none';},isVisible:function(){var w=this.offsetWidth,h=this.offsetHeight;return(w==0&&h==0)?false:(w>0&&h>0)?true:this.isDisplayed();},toggle:function(){return this[this.isDisplayed()?'hide':'show']();},hide:function(){var d;try{d=this.getStyle('display');}catch(e){} return this.store('originalDisplay',d||'').setStyle('display','none');},show:function(display){display=display||this.retrieve('originalDisplay')||'block';return this.setStyle('display',(display=='none')?'block':display);},swapClass:function(remove,add){return this.removeClass(remove).addClass(add);}}); var SimpleCarousel = new Class({ Implements: [Options, Events], options: { // onRotate: $empty, // onStop: $empty, // onAutoPlay: $empty, // onShowSlide: $empty, slideInterval: 4000, transitionDuration: 700, startIndex: 0, buttonOnClass: "selected", buttonOffClass: "off", rotateAction: "none", rotateActionDuration: 100, autoplay: true }, initialize: function(container, slides, buttons, options){ this.container = document.id(container); var instance = this.container.retrieve('SimpleCarouselInstance'); if (instance) return instance; this.container.store('SimpleCarouselInstance', this); this.setOptions(options); this.container.addClass('hasCarousel'); this.slides = $$(slides); this.buttons = $$(buttons); this.createFx(); this.showSlide(this.options.startIndex); if (this.options.autoplay) this.autoplay(); if (this.options.rotateAction != 'none') this.setupAction(this.options.rotateAction); return this; }, toElement: function(){ return this.container; }, setupAction: function(action) { this.buttons.each(function(el, idx){ document.id(el).addEvent(action, function(ev){ if (el.hasClass('off')){ ev.stop(); this.slideFx.setOptions(this.slideFx.options, {duration: this.options.rotateActionDuration}); if (this.currentSlide != idx) this.showSlide(idx); this.stop(); } }.bind(this)); }, this); }, createFx: function(){ if (!this.slideFx) this.slideFx = new Fx.Elements(this.slides, {duration: this.options.transitionDuration}); this.slides.each(function(slide){ slide.setStyle('opacity',0); }); }, showSlide: function(slideIndex){ var action = {}; this.slides.each(function(slide, index){ if (index == slideIndex && index != this.currentSlide){ //show if (document.id(this.buttons[index])) document.id(this.buttons[index]).swapClass(this.options.buttonOffClass, this.options.buttonOnClass); action[index.toString()] = { opacity: 1 }; } else { if (document.id(this.buttons[index])) document.id(this.buttons[index]).swapClass(this.options.buttonOnClass, this.options.buttonOffClass); action[index.toString()] = { opacity:0 }; } }, this); this.fireEvent('onShowSlide', slideIndex); this.currentSlide = slideIndex; this.slideFx.start(action); return this; }, autoplay: function(){ this.slideshowInt = this.rotate.periodical(this.options.slideInterval, this); this.fireEvent('onAutoPlay'); return this; }, stop: function(){ $clear(this.slideshowInt); this.fireEvent('onStop'); return this; }, rotate: function(){ var current = this.currentSlide; var next = (current+1 >= this.slides.length) ? 0 : current+1; this.showSlide(next); this.fireEvent('onRotate', next); return this; } }); window.addEvent('domready', function(){ document.getElements('.hidden-content-button').each(function(el){ var hidden = el.getParent('.inner').getElement('.hidden-content'); if(!hidden){return;} el.store('hidden', hidden).addEvent('click', function(ev){ ev.stop(); this.retrieve('hidden').toggleClass('hidden-content').toggleClass('ex-hidden-content'); this.setStyle('display', 'none'); }); }); });