/**
 * scrollingtext
 * 
 * Javascript to run the scroller
 * 
 * @version		
 * 
 * @author		vbarsan.com
 * @copyright		Copyright vbarsan.com
 */

/**************************************
* http://vertical-scroller.vbarsan.com/
*    This notice may not be removed 
**************************************/

//-- Begin Scroller's Parameters and messages -->
//scroller's width - set from XML
var swidth=180;

//scroller's height- set from XML
var sheight=150;


//scroller's speed 
var sspeed=2;
var restart=sspeed;
var rspeed=sspeed;

//scroller's pause 
var spause=2000;

//scroller's background - set from XML
//var sbcolor="#ffffff";
var sbcolor="";

//messages - set from XML
var singletext=new Array();
singletext[0]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">Brant C, Marblehead MA</td></tr><tr><td valign="right" class="tan">"We both appreciate the low key manner in which you provided the list of BMW services."</td></tr></table>';
singletext[1]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">SD, Windham NH</td></tr><tr><td valign="right" class="tan">"I really appreciate how well I was treated at Ira Audi."</td></tr></table>';
singletext[2]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">Rudolph L, Methuen MA</td></tr><tr><td valign="right" class="tan">"After recently purchasing my 8th Lexus from your dealership I cannot tell you enough how pleased I was with the overall experience at IRA Lexus in Danvers."</td></tr></table>';
singletext[3]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">Hollis P, Manchester NH</td></tr><tr><td valign="right" class="tan">"I am definitely going to recommend Lexus of Manchester to all of my friends."</td></tr></table>';
singletext[4]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">Nancy C, Peabody MA</td></tr><tr><td valign="right" class="tan">"This was my 4th purchase from Ira Subaru. I have always been treated with professional service by all departments."</td></tr></table>';
singletext[5]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">Susan L, Plymouth MA</td></tr><tr><td valign="right" class="tan">"My experience was so easy and painless, it did not even feel like I bought a new car. Ira Toyota of Milford could change the whole car buying experience sterotype."</td></tr></table>';
singletext[6]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">Nancy K, Wilmington MA</td></tr><tr><td valign="right" class="tan">"Everyone was so nice at Ira Toyota of Tewksbury.  Wonderful dealership.  All sales people and staff were great!"</td></tr></table>';
singletext[7]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">Leslie T, Amesbury MA</td></tr><tr><td valign="right" class="tan">"I have purchased 3 vehicles from Ira Mazda in Danvers and I am very satisfied with the service."</td></tr></table>';
singletext[8]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">Keith L, Lawrence MA</td></tr><tr><td valign="right" class="tan">"Everyone at Ira Nissan of Tewksbury was very courteous and polite as well as knowledgable."</td></tr></table>';
singletext[9]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">Heather C, Methuen MA</td></tr><tr><td valign="right" class="tan">"My visit to Ira Nissan of Woburn was the first time I ever felt comfortable and relaxed working with a dealership."</td></tr></table>';
singletext[10]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">Robin M, Peabody MA</td></tr><tr><td valign="right" class="tan">"My hat goes off to everyone at IRA Toyota in Danvers! I would never go to another Toyota dealer."</td></tr></table>';
singletext[11]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">Jay F, Wellesley MA</td></tr><tr><td valign="right" class="tan">"I finally found the exact car I was looking for at Ira Porsche in Danvers."</td></tr></table>';
singletext[12]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">John H, Bedford NH</td></tr><tr><td valign="right" class="tan">"Everyone was great at Ira Toyota of Manchester, your entire organization should take credit."</td></tr></table>';

//singletext[...]='...';
//-- end Parameters and message -->


//-- begin: Scroller's Algorithm -->
var ii=0;
function goup(){if(sspeed!=rspeed*16){sspeed=sspeed*2;restart=sspeed;}}

function startscrolling(){
if(document.getElementById){ns6div=document.getElementById('iens6div');ns6div.style.top=sheight+"px";ns6div.innerHTML=singletext[0];sizeup=ns6div.offsetHeight;ns6scroll();}
else 
if(document.layers){ns4layer=document.ns4div.document.ns4div1;ns4layer.top=sheight;ns4layer.document.write(singletext[0]);ns4layer.document.close();sizeup=ns4layer.document.height;ns4scroll();}
else 
if(document.all){iediv=iens6div;iediv.style.pixelTop=sheight+"px";iediv.innerHTML=singletext[0];sizeup=iediv.offsetHeight;iescroll();}}
function iescroll(){if(iediv.style.pixelTop>0&&iediv.style.pixelTop<=sspeed){iediv.style.pixelTop=0;setTimeout("iescroll()",spause);}else 
if(iediv.style.pixelTop>=sizeup*-1){iediv.style.pixelTop-=sspeed+"px";setTimeout("iescroll()",100);}else{if(ii==singletext.length-1)ii=0;else ii++;iediv.style.pixelTop=sheight+"px";iediv.innerHTML=singletext[ii];sizeup=iediv.offsetHeight;iescroll();}}
function ns4scroll(){if(ns4layer.top>0&&ns4layer.top<=sspeed){ns4layer.top=0;setTimeout("ns4scroll()",spause);}else 
if(ns4layer.top>=sizeup*-1){ns4layer.top-=sspeed;setTimeout("ns4scroll()",100);}else{if(ii==singletext.length-1)ii=0;else ii++;ns4layer.top=sheight;ns4layer.document.write(singletext[ii]);ns4layer.document.close();sizeup=ns4layer.document.height;ns4scroll();}}
function ns6scroll(){if(parseInt(ns6div.style.top)>0&&parseInt(ns6div.style.top)<=sspeed){ns6div.style.top=0;setTimeout("ns6scroll()",spause);}else 
if(parseInt(ns6div.style.top)>=sizeup*-1){ns6div.style.top=parseInt(ns6div.style.top)-sspeed+"px";setTimeout("ns6scroll()",100);}
else{if(ii==singletext.length-1)ii=0;else ii++;
ns6div.style.top=sheight+"px";ns6div.innerHTML=singletext[ii];sizeup=ns6div.offsetHeight;ns6scroll();}}
//-- end Algorithm -->
