function debug(msg){
}
function getNumValFromPxStyle(str){
if(str.indexOf("px")!=-1){
return Number(str.split("px")[0]);
}else{
return str;
}
}
function getNumericStyleValue(val){
val=getNumValFromPxStyle(val);
return (isNaN(val))?0:Number(val);
}
function getFullWidthForId(tID){
var _60d=Number(document.getElementById(tID).offsetWidth);
var _60e=getNumericStyleValue(YAHOO.util.Dom.getStyle(tID,"marginLeft"));
var _60f=getNumericStyleValue(YAHOO.util.Dom.getStyle(tID,"marginRight"));
return _60d+_60f+_60e;
}
function getFullHeightForId(tID){
var _611=Number(document.getElementById(tID).offsetHeight);
var _612=getNumericStyleValue(YAHOO.util.Dom.getStyle(tID,"marginTop"));
var _613=getNumericStyleValue(YAHOO.util.Dom.getStyle(tID,"marginBottom"));
return _611+_612+_613;
}
TextScroller=function(id,_615,_616,dir,_618,_619,_61a,_61b,_61c){
this.contElemClassName=_616;
this.scrollObjId=id;
this.itemContainerId=_615;
this.clonedElemsCounter=0;
if(_61c){
this.zebra=_61c;
}else{
this.zebra=false;
}
this.animTimer;
this.anim=new Object();
this.runAnim=true;
this.continousScroll=_619;
if(this.continousScroll){
this.baseSpeed=(_61a!=null)?_61a:7/100;
this.animParams={motionTypeFunc:YAHOO.util.Easing.easeNone};
}else{
this.animParams={speed:0.5,motionTypeFunc:YAHOO.util.Easing.easeOut};
}
this.scrollDir=dir;
if(_618!=null){
this.scrollDelay=_618;
}else{
this.scrollDelay=3000;
}
if(_61b!=null){
this.delayOnStart=_61b;
}else{
this.delayOnStart=0;
}
this.itemContainerElem;
this.wrapperWidth;
this.wrapperHeight;
YAHOO.util.Event.addListener(window,"load",this.init,this,true);
};
TextScroller.prototype.getContKidsArray=function(){
return YAHOO.util.Dom.getElementsByClassName(this.contElemClassName,"div",this.itemContainerId);
};
TextScroller.prototype.getAddedContentWidth=function(){
var kids=this.getContKidsArray();
var _61e=0;
for(var i=0;i<kids.length;i++){
var tID=kids[i].id;
_61e+=Number(getFullWidthForId(tID));
}
return _61e;
};
TextScroller.prototype.getAddedContentHeight=function(){
var kids=this.getContKidsArray();
var _622=0;
for(var i=0;i<kids.length;i++){
var tID=kids[i].id;
_622+=Number(getFullHeightForId(tID));
}
return _622;
};
TextScroller.prototype.isContentBigEnough=function(){
if(this.scrollDir=="hor"){
return (this.getAddedContentWidth()>(2*this.wrapperWidth))?true:false;
}else{
if(this.scrollDir=="ver"){
return (this.getAddedContentHeight()>this.wrapperHeight)?true:false;
}
}
};
TextScroller.prototype.handleOnMouseOver=function(){
this.runAnim=false;
};
TextScroller.prototype.handleOnMouseOut=function(){
var _625=this;
function scrollElement(){
_625.scrollElement();
}
this.runAnim=true;
window.clearTimeout(this.animTimer);
this.animTimer=setTimeout(scrollElement,this.scrollDelay);
};
TextScroller.prototype.scrollElement=function(){
clearTimeout(this.animTimer);
if(!this.runAnim){
return;
}
var kids=this.getContKidsArray();
var tID=kids[0].id;
var _628;
var _629=document.getElementById(tID).cloneNode(true);
var _62a=_629.id;
if(_62a.indexOf("-clone")!=-1){
_629.id=_62a.split("-clone")[0];
}else{
_629.id=_62a+"-clone";
}
if(this.zebra){
if(YAHOO.util.Dom.hasClass(kids[kids.length-1],"zebra")){
YAHOO.util.Dom.removeClass(_629,"zebra");
}else{
YAHOO.util.Dom.addClass(_629,"zebra");
}
}
this.itemContainerElem.appendChild(_629);
if(this.scrollDir=="hor"){
_628=getFullWidthForId(tID)*-1;
if(this.continousScroll){
this.animParams.speed=Math.abs(this.baseSpeed*_628);
}
var _62b={left:{by:_628}};
}else{
if(this.scrollDir=="ver"){
_628=getFullHeightForId(tID)*-1;
var _62b={top:{by:_628}};
}else{
debug("'scrollDir' hat keinen gueltigen Wert.");
}
}
this.anim=new YAHOO.util.Anim(this.itemContainerId,_62b,this.animParams.speed,this.animParams.motionTypeFunc);
this.anim.objRef=this;
this.anim.onComplete.subscribe(this.handleOnElementScrollReady);
this.anim.animate();
};
TextScroller.prototype.handleOnElementScrollReady=function(){
this.objRef.onElementScrollReady();
};
TextScroller.prototype.onElementScrollReady=function(){
var _62c=this;
function scrollElement(){
_62c.scrollElement();
}
var kids=this.getContKidsArray();
if(kids.length==0){
return;
}
var tID=kids[0].id;
if(this.scrollDir=="hor"){
var _62f=0;
if(document.location.search!=""&&$("tsinfo")&&this.itemContainerId.indexOf("olling_cont")>0){
$("tsinfo").innerHTML+="<br>getLeft:"+this.anim.getAttribute("left")+" / ";
}
this.anim.setAttribute("left",_62f,"px");
this.itemContainerElem=document.getElementById(this.itemContainerId);
}else{
if(this.scrollDir=="ver"){
var _630=this.anim.getAttribute("top");
var _631=0;
this.anim.setAttribute("top",_631,"px");
}else{
debug("'scrollDir' hat keinen gueltigen Wert.");
}
}
if(document.getElementById(tID)){
this.itemContainerElem.removeChild(document.getElementById(tID));
}
if(this.runAnim){
this.animTimer=setTimeout(scrollElement,this.scrollDelay);
}
};
TextScroller.prototype.checkShortContent=function(){
var kids=this.getContKidsArray();
if(this.scrollDir=="hor"){
var _633=getFullWidthForId(kids[0].id);
return (this.getAddedContentWidth()>this.wrapperWidth)?false:true;
}else{
if(this.scrollDir=="ver"){
var _634=getFullHeightForId(kids[0].id);
return (this.getAddedContentHeight()-_634>this.wrapperHeight)?false:true;
}
}
};
TextScroller.prototype.cloneContElem=function(){
var kids=this.getContKidsArray();
var _636=(YAHOO.util.Dom.hasClass(kids[kids.length-1],"zebra"))?1:0;
var last=kids.length;
for(i=0;i<kids.length;i++){
var tID=kids[i].id;
var _639=document.getElementById(tID).cloneNode(true);
_639.id=tID+"-dbl"+String(last+i);
if(this.zebra){
if(_636%2==0){
YAHOO.util.Dom.addClass(_639,"zebra");
}else{
YAHOO.util.Dom.removeClass(_639,"zebra");
}
}
this.itemContainerElem.appendChild(_639);
_636++;
}
this.itemContainerElem.style.width=String((kids.length+1)*getFullWidthForId(tID))+"px";
};
TextScroller.prototype.init=function(){
var _63a=this;
function timeoutHandler(){
_63a.scrollElement();
}
this.itemContainerElem=document.getElementById(this.itemContainerId);
this.wrapperWidth=document.getElementById(this.scrollObjId).offsetWidth;
this.wrapperHeight=document.getElementById(this.scrollObjId).offsetHeight;
if(this.scrollDir=="hor"){
this.itemContainerElem.style.width=String(this.getAddedContentWidth()+2000)+"px";
}else{
if(this.scrollDir=="ver"){
this.itemContainerElem.style.height=this.getAddedContentHeight()+400+"px";
}
}
YAHOO.util.Dom.setStyle(this.itemContainerId,"left","0px");
var cnt=0;
while(!this.isContentBigEnough()){
cnt++;
if(cnt>9){
break;
}
this.cloneContElem();
}
if(this.isContentBigEnough()){
_63a.scrollElement();
}else{
if(this.continousScroll){
}
}
var kids=this.getContKidsArray();
for(i=0;i<kids.length;i++){
var _63d=kids[i].getElementsByTagName("a");
for(j=0;j<_63d.length;j++){
_63d[j].objRef=this;
_63d[j].onmouseover=function(){
_63a.handleOnMouseOver();
};
_63d[j].onmouseout=function(){
_63a.handleOnMouseOut();
};
}
}
};
TextScroller.prototype.kill=function(){
this.runAnim=false;
window.clearInterval(this.animTimer);
this.anim.stop();
this.anim.onComplete=null;
this.anim=null;
var kids=this.getContKidsArray();
for(i=0;i<kids.length;i++){
if(kids[i]){
this.itemContainerElem.removeChild(kids[i]);
}
}
};
