/**
 * 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">M Mcgeeod</td></tr><tr><td valign="right" class="tan">I stopped into Ira Nissan in Tewksbury and within a few minutes I remembered why I bought my Altima (Still in fantastic shape) there six years ago. No pressure. I had been there long enough to poke around and look at a few vehicles when a pleasant, polite, well-groomed young man introduced himself as Aurys and asked me my name and how he could be of service. I explained that I only had a few minutes but was planning to look at cars over the weekend with my wife. I asked a few questions about the Rogue, Murano, and Versa, but the black Rogue with the 360 package already seemed to have my name on it. He asked me to step inside, where he took my name and number and asked if he could follow up with me. Then he gave me his card and told me the hours he would be working. I was there fifteen minutes tops. The next day when I went with my wife and we started looking he was there within a few minutes and knew my name. Usually we go to two or three dealerships but we felt very comfortable at Ira. NO PRESSURE. My wife was not quite sure and the manager offered for us to take the car home and try it out. We opted for a second test drive instead and she drove this time. That is all it took. The rest was easy. Aurys handled the entire sale from start to finish in a polite, quietly professional manner! FIVE STARS!! If you live in the Merrimack Valley, do not waste time and gas driving fifty miles for a new Nissan. Aurys Pena and the team at Ira Nissan are in your own backyard.</td></tr></table>';
singletext[1]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">Sandra K, Andover MA</td></tr><tr><td valign="right" class="tan">"Leonard was very nice and thorough."</td></tr></table>';
singletext[2]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">Mark D, Methuen MA</td></tr><tr><td valign="right" class="tan">"The sales manager was very friendly and accommodating. I love my new Armada!"</td></tr></table>';
singletext[3]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">Deborah P, Salem NH</td></tr><tr><td valign="right" class="tan">"Neadson was outstanding. He worked quickly and covered everything."</td></tr></table>';
singletext[4]='<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">"Ira Nissan was very courteous and polite as well as knowledgable."</td></tr></table>';
singletext[5]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">David M, Dracut MA</td></tr><tr><td valign="right" class="tan">"Everyone made us feel very comfortable!"</td></tr></table>';
singletext[6]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td valign="right" class="tabb">Robert K, Groton MA</td></tr><tr><td valign="right" class="tan">"My salesperson was a pleasure to work with."</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 -->
