function initDisplayEffects(element) { //list of target elements var list = (element != null) ? $$("#"+element+" .cCollapsible") : $$('.cCollapsible'); //list elements to be clicked on var headings = (element != null) ? $$("#"+element+" .cToggler") : $$('.cToggler'); //array to store all of the collapsibles var collapsibles = new Array(); headings.each( function(heading, i) { //for each element create a slide effect var collapsible = new Fx.Slide(list[i], { duration: 300, transition: Fx.Transitions.linear }); //and store it in the array collapsibles[i] = collapsible; //add event listener heading.removeEvent('click'); heading.addEvent('click', function(e){ collapsible.toggle(); //return false; }); //collapse all of the list items collapsible.hide(); }); } function getRate(photoId,increareViewCount) { new Ajax('index.php?a=_getRate&photoId=' + photoId + '&increareViewCount=' + increareViewCount, { method: 'get', evalScripts:true }).request(); } function rate(photoId, point, userId) { new Ajax('index.php?a=_rate&photoId=' + photoId + '&point=' + point + '&userId=' + userId, { method: 'get', evalScripts:true }).request(); } function rateOver(rateIndex) { for(i=1;i<=rateIndex;i++) { $('rateStar'+i).src='img/starOnBlackBg.gif'; } for(i=rateIndex+1;i<=5;i++) { $('rateStar'+i).src='img/starOffBlackBg.gif'; } } window.addEvent('load', function() { new SmoothScroll(); mooWindow = $(window); initDisplayEffects(); }); function promotionEffect() { var list = $$('.promotionIndex'); var linkFx = []; list.each( function(link,i) { link.removeEvent('click'); link.addEvent('click', function(e) { e = new Event(e).stop(); linkFx[i] = new Fx.Styles('promotionBannerImage', {duration:250, wait:false}); updatePromotionBannerIndex(i+1); linkFx[i].start({ 'opacity': [1,0] }).chain(function() { $('promotionBannerImage').src = link.getProperty('imgSrc'); linkFx[i].start({ 'opacity': [0,1] }); }); }); }); } function updatePromotionBannerIndex(i) { $each($('promotionIndexContainer').childNodes, function(item_) { item_.setStyle('background-image','url(img/bannerIndexBgPassive.gif)'); item_.setStyle('color','#fff'); }); $('promotionIndexContainer').childNodes[i-1].setStyle('background-image','url(img/bannerIndexBgActive.gif)'); $('promotionIndexContainer').childNodes[i-1].setStyle('color','#212121'); //$('promotionContainerText').setText($('promotionIndexContainer').childNodes[i-1].getAttribute('promoText')); $('promotionLink').href = $('promotionIndexContainer').childNodes[i-1].getAttribute('linkUrl'); }