var duration = 400; window.addEvent('domready',function(){ setRollover(); startBootCycle(); setTwitterControl(); }); function setRollover(){ $$("#db-blog > .rollover, #first-box > .rollover, #tech-box > .rollover, #pimp-my-boot2 > .rollover, #product > .item > .rollover").set('tween', { duration: duration , transition: Fx.Transitions.Expo.easeInOut } ); $$("#db-blog > .rollover > *, #first-box > .rollover > *, #tech-box > .rollover > *, #pimp-my-boot2 > .rollover > *, #product > .item > .rollover > *").each(function(el){ el.set('morph', { duration: duration , transition: Fx.Transitions.Expo.easeInOut } ).setStyles({ 'top': -el.get('data') , 'opacity':0 }); }); $$("#db-blog, #first-box, #tech-box, #pimp-my-boot2, #product > .item").addEvent('mouseenter',function(event){ var blog = this.getChildren(".rollover"); blog.setStyle('top',0); this.getChildren(".rollover > *").each(function(item,index){ item.morph.delay(index*100, item, { 'top': 0 , 'opacity':1 } ); }); }).addEvent('mouseleave',function(event){ var blog = this.getChildren(".rollover"); blog.setStyle('top',-550); this.getChildren(".rollover > *").each(function(item,index){ (function(){ item.get('morph').cancel(); item.setStyles({ 'top': -item.get('data') , 'opacity':0 }); }).delay(index*100); }); }).getChildren(".rollover").each(function(item,index){ var link = item.getParent().getFirst('a').get('href'); var target = item.getParent().getFirst('a').get('target'); item.addEvent("click",function(event){ if(target == "_blank") window.open(link); else location.href = link; }); }); $$("#page-content > div.rollovered > div").set('tween', { duration: duration , transition: Fx.Transitions.Expo.easeInOut } ); $$("#page-content > div.rollovered > div > *").set('morph', { duration: duration , transition: Fx.Transitions.Expo.easeInOut } ).each(function(el){ el.set('morph', { duration: duration , transition: Fx.Transitions.Expo.easeInOut } ).setStyles({ 'top': -el.get('data') , 'opacity':0 }); }); $$("#page-content > div.rollovered").addEvent('mouseenter',function(event){ var boot = this.getChildren("div"); boot.setStyle('top',0); this.getChildren("div > *").each(function(item,index){ item.morph.delay(index*100, item, { 'top': 0 , 'opacity':1 } ); }); }).addEvent('mouseleave',function(event){ var boot = this.getChildren("div"); boot.setStyle('top',-450); this.getChildren("div > *").each(function(item,index){ (function(){ item.get('morph').cancel(); item.setStyles({ 'top': -item.get('data') , 'opacity':0 }); }).delay(index*100); }); }).addEvent('click',function(){ var link = this.getChildren("h2 > a").get('href'); if( !this.hasClass('private') ) location.href = link; }); } function startBootCycle(){ var actualElement = 0; var timerEl; var items = []; $$('#product > .item').set('tween', { duration: duration , transition: Fx.Transitions.Expo.easeInOut } ).each(function(el,index){ items[index] = el; el.setStyle('left',-el.getSize().x); el.addEvent('mouseenter',function(){ timerEl && clearInterval(timerEl) }).addEvent('mouseleave',function(){ timerEl = setInterval(function(){ items[actualElement].tween('left',-items[actualElement].getSize().x); actualElement += 1; if(actualElement == items.length) actualElement = 0; items[actualElement].tween('left',0); },4000); }); }); items[0].setStyle('left',0); timerEl = setInterval(function(){ items[actualElement].tween('left',-items[actualElement].getSize().x); actualElement += 1; if(actualElement == items.length) actualElement = 0; items[actualElement].tween('left',0); },4000); } function setTwitterControl(){ var Twitter = 'Dalbello'; $$('#twitter-wall > #container > .atleti').setStyle( 'opacity' , 0 ); $$('#twitter-wall > #container > div').set('morph', { duration: duration , transition: Fx.Transitions.Quart.easeInOut } ); $$('#twitter-wall > .twitter-filter > a').addEvent('click',function(e){ e.stop(); if( this.title != Twitter ){ $$('#twitter-wall > .twitter-filter > a').removeClass('active'); this.addClass('active'); if( this.title == 'DBTeam' ){ $$('#twitter-wall > #container > .atleti').morph({ left:0, opacity:1 }); $$('#twitter-wall > #container > .dalbello').morph({ left:-274, opacity:0 }); Twitter = 'DBTeam'; } else { $$('#twitter-wall > #container > .dalbello').morph({ left:0, opacity:1 }); $$('#twitter-wall > #container > .atleti').morph({ left:-274, opacity:0 }); Twitter = 'Dalbello'; } } }); }