function ncBuildScrollTicker(pName, pWidth, pHeight, pSpeed, pClassName, p_lScrollType, p_bStartEmpty, p_lStoryStartPause, p_bHorizontalOnOneLine){var oTicker=window[pName]=new ncScrollTicker(pName, pWidth, pHeight, pSpeed, pClassName, p_lScrollType, p_bStartEmpty, p_bHorizontalOnOneLine);oTicker.StoryStartPause=p_lStoryStartPause?p_lStoryStartPause:0;oTicker.Build();oTicker.Init();}function ncScrollTicker(pName, pWidth, pHeight, pSpeed, pClassName, p_lScrollType, p_bStartEmpty, p_bHorizontalOnOneLine){var t=this, d=document;t.Name=pName;t.Width=!isNaN(pWidth)?pWidth+"px":pWidth;t.Height=!isNaN(pHeight)?pHeight+"px":pHeight;t.Pauseable=1;t.OutputType=d.getElementById?t.UP_LEVEL:t.NON_COMPAT;t.ClassName=pClassName;t.CurrentCopy=1;t.Speed=pSpeed>3?pSpeed-3:pSpeed * 0.25;t.Interval=25;var lMult=1;t.Speed *=lMult;t.Interval *=lMult;t.CurrSpeed=t.Speed;t.PauseSpeed=t.Pauseable?0:t.CurrSpeed;t.ContentHeight="";t.FirstScroll=1;t.ScrollType=p_lScrollType==t.SCROLL_LEFT?t.SCROLL_LEFT:t.SCROLL_UP;t.StartEmpty=p_bStartEmpty;t.__StoryArr=[];t.__StoryStartPaused=false;t.StoryStartPause=0;t.__CurrentStoryIdx=-1;t.__HorizontalOnOneLine=p_bHorizontalOnOneLine;return t;}ncScrollTicker.prototype.UP_LEVEL=0;ncScrollTicker.prototype.NON_COMPAT=2;ncScrollTicker.prototype.SCROLL_UP=0;ncScrollTicker.prototype.SCROLL_LEFT=1;ncScrollTicker.prototype.Build=function(){var t=this;if(t.OutputType==t.UP_LEVEL){var sStyle='overflow:hidden;';if(t.ScrollType==t.SCROLL_UP){sStyle+='width:'+t.Width+';height:'+t.Height+';';}var sHtml='<div class="'+t.ClassName+'" style="'+sStyle+'" '+'onmouseover="'+t.Name+'.CurrSpeed='+t.Name+'.PauseSpeed;" '+'onmouseout="'+t.Name+'.CurrSpeed='+t.Name+'.Speed">'+'<div id="'+t.Name+'_CH" style="position:relative;overflow:hidden;height:100%;width:100%;">'+'<div id="'+t.Name+'_C1" style="position:relative;left:0px;top:0px;"></div>'+'<div id="'+t.Name+'_C2" style="position:relative;left:0px;top:0px;"></div>'+'</div></div>';  var d=document;var oContentDiv=d.getElementById(t.Name);var oOutputDiv=d.createElement('div');oOutputDiv.id=t.Name+"_Output";oOutputDiv.innerHTML=sHtml;oContentDiv.parentNode.insertBefore(oOutputDiv, oContentDiv);}};ncScrollTicker.prototype.Init=function(){var t=this;if(t.OutputType==t.UP_LEVEL){t.Top=parseInt(t.Height)+8;var oContentHolder=document.getElementById(t.Name+"_CH");var lScrollWidth=t.Left=oContentHolder.offsetWidth;oContentHolder.style.width=lScrollWidth+"px";var te1=t.TargetEl1=document.getElementById(t.Name+"_C1");var te2=t.TargetEl2=document.getElementById(t.Name+"_C2");if(!t.StartEmpty){t.Top=0;t.Left=0;}if(t.ScrollType==t.SCROLL_UP){te2.style.top=te1.style.top=t.Top+"px";t.__AddStories();if(parseInt(t.Height, 10)>parseInt(t.ContentHeight, 10)){var lCopies=Math.ceil(parseInt(t.Height, 10) / parseInt(t.ContentHeight, 10))-1;lCopies=Math.min(lCopies, 10);for(var i=0;i<lCopies;i++){ t.__AddStories();}}te2.style.top=te1.offsetHeight+"px";te2.innerHTML=te1.innerHTML;}else{t.__NewOutputTable=te1.appendChild(document.createElement("table"));t.__NewOutputTable2=te2.appendChild(document.createElement("table"));t.__NewOutputRow=t.__NewOutputTable.insertRow(-1);t.__NewOutputRow2=t.__NewOutputTable2.insertRow(-1);t.__NewOutputTable.className=t.__NewOutputTable2.className="ncFormatting";te1.style.whiteSpace=te2.style.whiteSpace="nowrap";te1.style.left=t.Left+"px";t.__AddStories();var lTrueWidth=t.__NewOutputTable.offsetWidth;if(lTrueWidth<lScrollWidth){var lCopies=Math.ceil(lScrollWidth / lTrueWidth)-1;lCopies=Math.min(lCopies, 10);te1.style.width=lTrueWidth+'px';for(var i=0;i<lCopies;i++){t.__AddStories();}lTrueWidth=t.__NewOutputTable.offsetWidth;}te1.style.width=te2.style.width=lTrueWidth+'px';oContentHolder.style.height=oContentHolder.offsetHeight+"px";te2.style.left=t.Left+"px";}te1.style.position=te2.style.position='absolute';var lStoryCount=t.__StoryArr.length;t.__StoryArr.length=lStoryCount * 2;for(var i=0;i<lStoryCount;i++){t.__StoryArr[i+lStoryCount]={Top:t.ContentHeight+t.__StoryArr[i].Top, Left:t.ContentWidth+t.__StoryArr[i].Left};}t.__ScrollInterval=setInterval(t.Name+".Scroll()", t.Interval);}};ncScrollTicker.prototype.__AddStories=function(){var t=this;var lStoryCount=t.__StoryArr.length;var oContentDiv=document.getElementById(t.Name);var oStoryEls=oContentDiv.childNodes;var te1=t.TargetEl1;for(var i=0;i<oStoryEls.length;i++){if(oStoryEls[i].nodeType==1){if(t.ScrollType==t.SCROLL_UP){t.__StoryArr[lStoryCount++]={Top:-te1.offsetHeight};te1.innerHTML+="<div>"+oStoryEls[i].innerHTML+"</div>";}else{t.__StoryArr[lStoryCount++]={Left:-t.__NewOutputTable.offsetWidth};var oStoryEl=oStoryEls[i];var oStoryPartEls=oStoryEl.childNodes;for(var j=0;j<oStoryPartEls.length;j++){if(oStoryPartEls[j].nodeType==1&&oStoryPartEls[j].tagName.toLowerCase()=="div"){if(oStoryPartEls[j].innerHTML!=''){t.__AddContentCell(t.__NewOutputRow, oStoryPartEls[j]);t.__AddContentCell(t.__NewOutputRow2, oStoryPartEls[j]);}}}}}}if(t.ScrollType==t.SCROLL_UP){t.ContentHeight=te1.offsetHeight;}else{t.ContentWidth=t.__NewOutputTable.offsetWidth;}};ncScrollTicker.prototype.__AddContentCell=function(p_oRow, p_oContentDiv){var t=this;var oCell=p_oRow.insertCell(-1);oCell.className="ncFormatting";if(!ncBwHlpr.DtdFound()){var oTickerEl=document.getElementById(t.Name+"_Output").childNodes[0];var sFontSize=ncBwHlpr.GetStyle(oTickerEl, "font-size");if(sFontSize.length>0){oCell.style.fontSize=sFontSize;}}var oDiv=oCell.appendChild(document.createElement("div"));oDiv.className=p_oContentDiv.className;oDiv.style.whiteSpace=t.__HorizontalOnOneLine?'nowrap':'normal';oDiv.innerHTML=p_oContentDiv.innerHTML;};ncScrollTicker.prototype.CleanUp=function(){var t=this;if(t.__ScrollInterval){clearInterval(t.__ScrollInterval);t.__ScrollInterval=null;}};ncScrollTicker.prototype.Scroll=function(){var t=this;var sContentMeas, sContentPos, sContentPosStyle;if(t.ScrollType==t.SCROLL_LEFT){sContentMeas="ContentWidth";sContentPos="Left";sContentPosStyle="left";}else{sContentMeas="ContentHeight";sContentPos="Top";sContentPosStyle="top";}if(!t.__StoryStartPaused){if(t[sContentPos]-1>=-t[sContentMeas]){t[sContentPos]=Math.max(t[sContentPos]-t.CurrSpeed,-t[sContentMeas]);}else{t.FirstScroll=0;t[sContentPos]=parseInt(t[sContentMeas]);}var lPos=parseInt(t[sContentPos], 10);var lNextStoryIdx=(t.__CurrentStoryIdx+1) % t.__StoryArr.length;var bNextStory;if(t.__StoryArr[lNextStoryIdx][sContentPos]>0){bNextStory=lPos>0&&lPos<=t.__StoryArr[lNextStoryIdx][sContentPos];}else{bNextStory=lPos<=t.__StoryArr[lNextStoryIdx][sContentPos]}if(bNextStory){t.__CurrentStoryIdx=lNextStoryIdx;if(t.StoryStartPause>0){t.__StoryStartPaused=true;setTimeout(t.Name+".EndStoryStartPause();", t.StoryStartPause);lPos=t.__StoryArr[t.__CurrentStoryIdx][sContentPos];}}t.TargetEl1.style[sContentPosStyle]=lPos+"px";var te2Trailing=t.FirstScroll||lPos<0;if(te2Trailing){t.TargetEl2.style[sContentPosStyle]=(lPos+t[sContentMeas])+"px";}else{t.TargetEl2.style[sContentPosStyle]=(lPos-t[sContentMeas])+"px";}}};ncScrollTicker.prototype.EndStoryStartPause=function(){this.__StoryStartPaused=false;};
