//Variable that determines the length of time between transitions //in seconds var fundtransitionTime = 5; //Variable the determines how many FundManagers are on screen at once //NOTE: The number of
elements has to be a multiple of this value //Even if the last few are simply empty tags!! var numOfFundManagersOnShow = 2; //################################## DO NOT AMEND AFTER THIS POINT ############################# var fundx = fundtransitionTime; var fundy = 1; var fundManagers; var fundManagerCount = 0; var position = 1; function startClock(){ //Get the count of fundManagers fundManagers = document.getElementById('fundManagers'); fundManagerCount = fundManagers.getElementsByTagName('dl').length; addToFundManagerList(); //We need to display the first set of FundManagers for( var i = 0; i < numOfFundManagersOnShow; i++ ){ //This is the element we are going to make Appear var q = position + i; new Effect.Appear('fundManager' + q, {}); } fundx = fundx-fundy; setTimeout("startClock()", 1000); if(fundx==0){ changeManagers(); fundx=fundtransitionTime; } } //This function will as empty FundManager elements where required //so as to keep the number displayed nicely formatted function addToFundManagerList(){ //If we have no fund managers then simply return if( fundManagerCount <= 0 ){ return; } //Reset the count here, as we will make this function recusive fundManagerCount = fundManagers.getElementsByTagName('dl').length; //alert(fundManagerCount); //Is fundManagerCount divisible by numOfFundManagersOnShow? var a = fundManagerCount/numOfFundManagersOnShow; if(a > Math.floor(a)){ //alert("Not an even number"); //So we need to add some empty elements on the end //Clone the first fundManager element var fundManager = document.getElementById('fundManager1').cloneNode(true); //Give the element a new Id fundManager.id='fundManager' + (fundManagerCount + 1); //Hide the element fundManager.style.display = 'none'; //Blank the value of the dt element fundManager.getElementsByTagName('dt')[0].firstChild.nodeValue=''; fundManager.getElementsByTagName('a')[0].firstChild.nodeValue=''; fundManager.getElementsByTagName('a')[1].firstChild.nodeValue=''; //Finally tack the element onto the end of the FundManagers list fundManagers.appendChild(fundManager); //Recurse, in case we need more values addToFundManagerList(); }//else if(a = Math.ceil(a)){ //alert("An even number"); //} } function changeManagers(){ for( var i = 0; i < numOfFundManagersOnShow; i++ ){ //This is the element we are going to Fade var x = position + i; new Effect.Fade('fundManager'+ x, { duration: 1.0 } ); } //increment the position position = position + numOfFundManagersOnShow; if(position > fundManagerCount){ position = 1; } for( var i = 0; i < numOfFundManagersOnShow; i++ ){ //This is the element we are going to make Appear var x = position + i; new Effect.Appear('fundManager' + x, { delay: 1.0 } ); } } function originalChangeManagers(){ var nodeObj = document.getElementById('fundManager' + position); nodeObj.style.display = 'none'; nodeObj = document.getElementById('fundManager' + (position + 1)); nodeObj.style.display = 'none'; //increment the position position = position + 2; if(position > fundManagerCount){ position = 1; } nodeObj = document.getElementById('fundManager' + position); nodeObj.style.display = 'block'; nodeObj = document.getElementById('fundManager' + (position + 1)); nodeObj.style.display = 'block'; }