var TrademarkRotator=null;document.observe("dom:loaded",function(){TrademarkRotator=new TTrademarkRotator({count:10,size:92,expand_size:308,wrapper:"tmitems"})});var TTrademarkRotator=Class.create({initialize:function(a){this.wrapper=$(a.wrapper);this.count=a.count;this.expand_size=a.expand_size;this.size=a.size;this.width_expanded=this.expand_size-6;this.width_collapsed=-10+this.size;this.offset1=this.size+6;this.offset2=this.width_expanded-this.size+10;this.div=new Array();this.effects=new Array();for(i=0;i<=this.count;i++){this.div[i]=new Element("div");this.div[i].className="tmsqare";this.div[i].setStyle({left:this.offset1*i+"px"});this.wrapper.insert({bottom:this.div[i]});this.load(i)}this.timer=setTimeout(this.play.bind(this),2000)},load:function(a){this.div[a].update('<img alt="wait" src="/img/spinner.gif" style="padding-top: 25px; width:32px;">');new Ajax.Request("/users/trademark/",{onComplete:function(b){if(Prototype.Browser.IE||Prototype.Browser.Opera){this.tm.div[this.number].setStyle({paddingLeft:"3px",paddingRight:"7px"})}this.tm.div[this.number].update(b.responseText);fdiv=new Element("div");fdiv.clonePosition(this.tm.div[this.number]);fdiv.setStyle({zIndex:100,position:"absolute",background:"#ffffff",opacity:0,top:"0px",left:"0px",width:this.tm.size+"px"});this.tm.div[this.number].insert({bottom:fdiv});fdiv.onclick=this.tm.div[this.number].select("table").first().onclick;if(fdiv.onclick){fdiv.setStyle({cursor:"pointer"})}fdiv.observe("mouseover",function(c){this.expand(c)}.bind(this.tm));fdiv.observe("mouseout",function(c){this.collapse(c)}.bind(this.tm))}.bind({tm:this,number:a})})},play:function(){if(this.timer){clearTimeout(this.timer)}if(this.div.length>this.count+1){this.div[this.count+1].remove();this.div.pop()}this.div.unshift(new Element("div"));this.div[0].className="tmsqare";this.div[0].setStyle({left:-this.offset1+"px"});this.wrapper.insert({top:this.div[0]});this.load(0);for(i=0;i<=this.count+1;i++){new Effect.Move(this.div[i],{x:this.offset1,y:0,mode:"relative",transition:Effect.Transitions.sinoidal})}this.timer=setTimeout(this.play.bind(this),5000)},stop:function(){if(this.timer){clearTimeout(this.timer)}},expand:function(a){a.stop();elem=a.element();this.stop();this.effects=new Array();for(i=0;i<=this.count;i++){if($(elem.parentNode)==this.div[i]){break}}if(i>=6){for(j=0;j<=i;j++){this.effects.push(new Effect.Move(this.div[j],{x:this.offset1*j-this.offset2,y:0,mode:"absolute",duration:0.6,delay:0.6}))}}else{for(j=i+1;j<=this.count;j++){this.effects.push(new Effect.Move(this.div[j],{x:this.offset1*j+this.offset2,y:0,mode:"absolute",duration:0.6,delay:0.6}))}}this.effects.push(new Effect.Morph(elem.parentNode,{style:"width:"+this.width_expanded+"px",duration:0.6,delay:0.6}));this.effects.push(new Effect.Morph(elem,{style:"width:"+(12+this.width_expanded)+"px",duration:0.6,delay:0.6}))},collapse:function(a){a.stop();elem=a.element();this.timer=setTimeout(this.play.bind(this),2000);$A(this.effects).each(function(b){if(b){b.cancel()}});for(i=0;i<=this.count;i++){if($(elem.parentNode)==this.div[i]){break}}if(i>=6){for(j=0;j<=i;j++){new Effect.Move(this.div[j],{x:this.offset1*j,y:0,mode:"absolute",duration:0.6})}}else{for(j=i+1;j<=this.count;j++){new Effect.Move(this.div[j],{x:this.offset1*j,y:0,mode:"absolute",duration:0.6})}}new Effect.Morph(elem.parentNode,{style:"width:"+this.width_collapsed+"px",duration:0.6});new Effect.Morph(elem,{style:"width:"+(12+this.width_collapsed)+"px",duration:0})}});
