YAHOO.namespace("selectedGamesScroller");var DOM=YAHOO.util.Dom;var EVT=YAHOO.util.Event;YAHOO.selectedGamesScroller.featuredGame=function(a){this.init(a)};YAHOO.selectedGamesScroller.featuredGame.prototype={hideClass:"hide",highlightClass:"on",gamesDivSuffix:"Games",categories:new Array(),curIndex:0,prevIndex:0,catCount:0,autoPlay:null,scrollDelay:5000,init:function(t){var w=this;var a=DOM.get(t);var c=(a.childNodes[0].nodeName=="UL")?a.childNodes[0]:a.childNodes[1];var b=DOM.getElementsBy(function(i){return true},"li",c);for(var u=0;u<b.length;u++){var m=new Array();m[u]=b[u].firstChild.lastChild.nodeValue;m[u]=m[u].toLowerCase().replace(/\s/,"");gamesCheck=m[u].substring(m[u].length-5);this.categories[u]=b[u].id;var f=u+1;var v=b[u].firstChild;var d=m[u]}function r(i){EVT.preventDefault(i);w.stopAutoScroll();w.scrollTo(0),w}EVT.on(DOM.get(this.categories[0]).firstChild,"click",r);function p(i){EVT.preventDefault(i);w.stopAutoScroll();w.scrollTo(1),w}EVT.on(DOM.get(this.categories[1]).firstChild,"click",p);function n(i){EVT.preventDefault(i);w.stopAutoScroll();w.scrollTo(2),w}EVT.on(DOM.get(this.categories[2]).firstChild,"click",n);function l(i){EVT.preventDefault(i);w.stopAutoScroll();w.scrollTo(3),w}EVT.on(DOM.get(this.categories[3]).firstChild,"click",l);function k(i){EVT.preventDefault(i);w.stopAutoScroll();w.scrollTo(4),w}EVT.on(DOM.get(this.categories[4]).firstChild,"click",k);function j(i){EVT.preventDefault(i);w.stopAutoScroll();w.scrollTo(5),w}EVT.on(DOM.get(this.categories[5]).firstChild,"click",j);function h(i){EVT.preventDefault(i);w.stopAutoScroll();w.scrollTo(6),w}EVT.on(DOM.get(this.categories[6]).firstChild,"click",h);function g(i){EVT.preventDefault(i);w.stopAutoScroll();w.scrollTo(7),w}EVT.on(DOM.get(this.categories[7]).firstChild,"click",g);function e(i){EVT.preventDefault(i);w.stopAutoScroll();w.scrollTo(8),w}EVT.on(DOM.get(this.categories[8]).firstChild,"click",e);function s(i){EVT.preventDefault(i);w.stopAutoScroll();w.scrollTo(9),w}EVT.on(DOM.get(this.categories[9]).firstChild,"click",s);function q(i){EVT.preventDefault(i);w.stopAutoScroll();w.scrollTo(10),w}EVT.on(DOM.get(this.categories[10]).firstChild,"click",q);function o(i){EVT.preventDefault(i);w.stopAutoScroll();w.scrollTo(11),w}EVT.on(DOM.get(this.categories[11]).firstChild,"click",o);this.startAutoScroll()},startAutoScroll:function(){if(this.autoPlay!==null){return}var a=this;this.autoPlay=setInterval(function(){a.scrollNext()},this.scrollDelay)},stopAutoScroll:function(){if(this.autoPlay!==null){clearTimeout(this.autoPlay);this.autoPlay=null}},scrollNext:function(){var a=this;this.prevIndex=this.curIndex;this.curIndex++;this.curIndex=this.curIndex%this.categories.length;this.removeHighlight(this.categories[this.prevIndex],this.highlightClass);this.addHighlight(this.categories[this.curIndex],this.highlightClass);setTimeout(function(){a.changeGameList(a.curIndex)},350)},scrollTo:function(a){var b=this;this.prevIndex=this.curIndex;this.curIndex=a;this.removeHighlight(this.categories[this.prevIndex],this.highlightClass);this.addHighlight(this.categories[this.curIndex],this.highlightClass);setTimeout(function(){b.changeGameList(b.curIndex)},350)},removeHighlight:function(b,a){node=DOM.get(b).firstChild;DOM.removeClass(node,a)},addHighlight:function(b,a){node=DOM.get(b).firstChild;DOM.addClass(node,a)},changeGameList:function(a){listElem=DOM.get(this.categories[a]+this.gamesDivSuffix);DOM.removeClass(listElem,this.hideClass);prevElem=DOM.get(this.categories[this.prevIndex]+this.gamesDivSuffix);DOM.addClass(prevElem,this.hideClass)}};