/////////////////////////////////////////////////////////////////// /*####################### CLASS.SCROLLER ########################*/ /////////////////////////////////////////////////////////////////// function JsScroller() { ////////////////////////////////// ///////// THIS.VARIABLES ///////// ////////////////////////////////// var Id; var PreItems,Items,Timer,Margin; var Layer,Frame,Content; var Direction,Speed,MaxSpeed,MinSpeed,First; var Pause; /*############################################*/ /*############# PRIVATE.INITIALIZE ###########*/ /*############################################*/ ////////////////////////////////// ////// FUNCTION.INITIALIZE /////// ////////////////////////////////// this.Initialize=function(Args) { this.Id ='JsScroller_'+Args[0]+'_'; this.PreItems =[]; this.Items =[]; this.Margin =Args[3]; this.Direction =-1; this.Speed =1.5; this.MaxSpeed =5; this.MinSpeed =0; var Holder=document.getElementById(Args[0]); if(Holder) { var Layer =document.createElement('div'); Layer.style.width =Args[1]+'px'; Layer.style.height =Args[2]+'px'; Layer.style.float ='left'; Layer.style.marginTop ='5px'; Layer.style.border ='3px solid #B9CCDE'; Layer.style.background ='#DFECF7'; Layer.style.display ='none'; var Frame =document.createElement('iframe'); Frame.frameBorder =0; Frame.border =0; Frame.scrolling ='no'; Frame.allowTransparency =true; Frame.style.width =Math.round(Args[1]-(2*Args[3]))+'px'; Frame.style.height =Math.round(Args[2]-(2*Args[3]))+'px'; Frame.style.margin =Args[3]+'px'; Frame.style.background ='transparent'; Frame.style.float ='left'; Holder.appendChild(Layer); Layer.appendChild(Frame); try{ Frame.contentWindow.stop(); } catch(e){ } Frame.contentWindow.document.write(''); try{ Frame.contentWindow.stop(); } catch(e){ } Frame.contentWindow.document.body.style.background ='transparent'; Frame.contentWindow.document.body.style.margin =0+'px'; Frame.contentWindow.document.body.style.cursor ='default'; this.Layer =Layer; this.Frame =Frame; this.Content=Frame.contentWindow.document; } window[this.Id] =this; this.Timer =setInterval(this.Id+'.Scroll()',50); } /*############################################*/ /*################# PUBLIC.HELP ##############*/ /*############################################*/ ////////////////////////////////// ///////// FUNCTION.ADD /////////// ////////////////////////////////// this.Add=function(Key,Src,Function) { this.PreItems.push(new JsScrollerItem(this,Key,Src,Function)); } ////////////////////////////////// //////// FUNCTION.SCROLL ///////// ////////////////////////////////// this.Scroll=function() { if(this.PreItems.length>0) { for(var a=0;a0 && !Item.Loaded) { Item.Insert(); this.Items.push(Item); this.PreItems.splice(a,1); } } } if(this.Items.length>0) { this.First=this.First?(this.Items[this.First]?this.First:0):0; if(this.Items[this.First].Holder) { var Move =this.Pause?0:(this.Speed*this.Direction); var FirstPos =this.Items[this.First].Position+Move; if(FirstPos+parseInt(this.Items[this.First].Holder.style.width)<0) { this.First=this.First+1'); try{ Frame.contentWindow.stop(); } catch(e){ } Frame.contentWindow.document.body.style.background ='transparent'; Frame.contentWindow.document.body.style.margin =0+'px'; Frame.contentWindow.document.body.style.cursor ='default'; this.Layer =Layer; this.Frame =Frame; this.Content=Frame.contentWindow.document; for(var a=0;a0) { this.Next=this.Next?this.Next:0; this.Last=this.Last?this.Last:0; var Move =this.Pause?0:this.Speed; var LastPos =this.Items[this.Last].Position+Move; var NextPos =this.Items[this.Next].Position+Move; var TNext =this.Next+1parseInt(this.Frame.style.height)) { this.Last=this.Last+1=0 && TNextPos=this.Delay) { var Count =0; var Number =this.Last; var Pos =this.Items[this.Last].Position+Move; while(Count0?(LPos<1?Math.round(LPos*100)/100:1):0; } if(Number==this.Last){ LPos =(parseInt(this.Frame.style.height)-Item.Position)/parseInt(Item.Holder.style.height); LPos =LPos*(this.MinSpeed/this.Speed); LAlpha =LPos>0?(LPos<1?Math.round(LPos*100)/100:1):0; } LAlpha =LAlpha<0.1?0.1:LAlpha; Item.Holder.style.filter ='alpha(enabled=true,opacity='+(LAlpha*100)+')'; Item.Holder.style.opacity =LAlpha+0.3; Item.Holder.style.MozOpacity =LAlpha+0.3; Item.Holder.style.KhtmlOpacity =LAlpha+0.3; Pos -=parseInt(Item.Holder.style.height)+this.Margin; Number =Number+1=0?0:-1*(this.Items[this.Next].Position); var Dir =NPos>parseInt(this.Items[this.Next].Holder.style.height)/2?1:-1; var Ax =(Dir==1?(this.MaxSpeed-this.Speed):(this.MinSpeed-this.Speed))/(NPos/(this.Speed*2)); this.Speed =this.Speed+Ax<=this.MaxSpeed?this.Speed+Ax:this.MaxSpeed; } else { this.DelayPause++; } } } /*############################################*/ /*############## PRIVATE.HELP ################*/ /*############################################*/ ////////////////////////////////// ///////// CALL.INITIALIZE //////// ////////////////////////////////// this.Initialize(arguments); } /////////////////////////////////////////////////////////////////// /*####################### CLASS.PROPERTIES ######################*/ /////////////////////////////////////////////////////////////////// function JsTextScrollerItem() { ////////////////////////////////// ///////// THIS.VARIABLES ///////// ////////////////////////////////// var Key,Parent,Function; var Holder,Content; var Position; var Title; /*############################################*/ /*############# PRIVATE.INITIALIZE ###########*/ /*############################################*/ ////////////////////////////////// ////// FUNCTION.INITIALIZE /////// ////////////////////////////////// this.Initialize=function(Args) { this.Parent =Args[0]; this.Key =Args[1]; this.Function =Args[2]; this.Title =Args[3]; this.Description=Args[4]; this.Position =parseInt(this.Parent.Frame.style.height); this.Insert(); } /*############################################*/ /*################# PUBLIC.HELP ##############*/ /*############################################*/ ////////////////////////////////// //////// FUNCTION.ROLLOVER /////// ////////////////////////////////// this.RollOver=function(){ //this.Parent.Pause=true; this.Content.style.background ='#ECF4FB'; this.Holder.style.background ='#DDEBF7'; } ////////////////////////////////// //////// FUNCTION.ROLLOUT //////// ////////////////////////////////// this.RollOut=function(){ //this.Parent.Pause=false; this.Content.style.background ='#F3F8FC'; this.Holder.style.background ='#E6F0F9'; } /*############################################*/ /*############## PRIVATE.HELP ################*/ /*############################################*/ ////////////////////////////////// //////// FUNCTION.INSERT ///////// ////////////////////////////////// this.Insert=function() { if(this.Parent.Content && !this.Loaded) { var Width =parseInt(this.Parent.Frame.style.width); var Height =Math.round(((parseInt(this.Parent.Frame.style.height)+this.Parent.Margin)/this.Parent.Parts)-this.Parent.Margin); var Holder =this.Parent.Content.createElement('div'); Holder.style.width =Width+'px'; Holder.style.height =Height+'px'; Holder.style.background ='#E6F0F9'; Holder.style.position ='absolute'; Holder.style.left ='0px'; Holder.style.top ='2000px'; Holder.style.cursor ='pointer'; Holder.Class =this; Holder.onmouseover =function(){ this.Class.RollOver(); }; Holder.onmouseout =function(){ this.Class.RollOut(); }; Holder.onclick =function(){ this.Class.Function(); }; var Content =this.Parent.Content.createElement('div'); Content.style.width =(Width-2)+'px'; Content.style.height =(Height-2)+'px'; Content.style.background ='#F3F8FC'; Content.style.margin ='1px'; var Title =this.Parent.Content.createElement('h2'); Title.style.fontWeight ='bold'; Title.style.fontSize ='11px'; Title.style.fontFamily ='verdana'; Title.style.color ='#517AA4'; Title.style.padding ='5px 5px 0px 5px'; Title.style.margin ='0px'; Title.innerHTML =this.Title.length<30?this.Title:this.Title.substr(0,30)+' ...'; var Descr =this.Parent.Content.createElement('div'); Descr.style.fontWeight ='bold'; Descr.style.fontSize ='10px'; Descr.style.fontFamily ='verdana'; Descr.style.color ='#868686'; Descr.style.padding ='4px 5px 4px 5px'; Descr.innerHTML =this.Description; this.Parent.Content.body.appendChild(Holder); Holder.appendChild(Content); Content.appendChild(Title); Content.appendChild(Descr); this.Holder =Holder; this.Content =Content; this.Position =this.Parent.Items.length==0?parseInt(this.Parent.Frame.style.height)-parseInt(Holder.style.height):this.Position; this.Parent.Items.push(this); } } ////////////////////////////////// ///////// CALL.INITIALIZE //////// ////////////////////////////////// this.Initialize(arguments); }