//configure the below variable to change the contents of the scroller

var messages=new Array()
var news=new Array();



// Copy and paste the line below to create a new quote (do not copy the "//")
// messages[0]="“Place Quote Here”"
messages[0]="“Great program – lots of great tools to use right away.”"
messages[1]="“The time just flew by! Terrific trainers and real-world material.”"
messages[2]="“What a great way to learn some valuable skills! Can’t wait to get back and try them.”"
messages[3]="“The real-world examples made practicing the new skills very natural; the models will make it all very easy to remember and to use. Thanks for an awesome experience.”"
messages[4]="“We now have a common language and a solid framework to build upon. Our team will undoubtedly profit from the experience.”"
messages[5]="“So simple, yet so effective. I wish I had this class twenty years ago!”"
messages[6]="“(You) customized the program perfectly to our business so the transition from classroom to the street was smooth and very quick. Thank you so much!”"
messages[7]="“That was the most fun I’ve had learning since Mr. Geraci's Civics class sophomore year!! You guys rock!”"

news[0]="<p>For a revolutionary way to boost employee engagement and productivity, call or write for info on <b>The Dream Life</b> program.</p>";
news[1]="<p>Want to receive our monthly newsletter <b>“Journey Notes”</b>?  Send us a message at info@journey-learning.com and request it.</p>";
news[2]="<p><b>Journey Learning</b> is excited to announce a new partnership with <b>The Rapid Learning Institute</b>.</p>";
news[3]="<p>Reinforcement and Coaching are the keys to behavioral change!  Contact us for exciting and practical ways to achieve performance improvement!</p>";
news[4]="<p>Be sure to ask for information on our <b>blended learning</b> resources.</p>";
                                
///////Do not edit pass this line///////////////////////
closetag='</div>';
var months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December") 
var todaysdate = new Date()
var tmonth = months[todaysdate.getMonth()]
var tyear = todaysdate.getYear()

begintag='<div><p align="center"><strong>'+tmonth+'&nbsp;'+tyear+'</strong></p>'; //set opening tag, such as font declarations
//configure the below five variables to change the style of the scroller
var scrollerwidth='134px'
var scrollerheight='150px'
var scrollerbgcolor='white'
//set below to '' if you don't wish to use a background image
var scrollerbackground=''

var ie=document.all
var dom=document.getElementById

if (messages.length>2)
i=2
else
i=0

function move1(whichlayer){
	tlayer=eval(whichlayer)
	if (tlayer.top>0&&tlayer.top<=5){
		tlayer.top=0
		setTimeout("move1(tlayer)",9000)
		setTimeout("move2(document.main.document.second)",9000)
		return
	}
	if (tlayer.top>=tlayer.document.height*-1){
		tlayer.top-=5
		setTimeout("move1(tlayer)",50)
	}
	else{
		tlayer.top=parseInt(scrollerheight)
		tlayer.document.write(messages[i])
		tlayer.document.close()
		if (i==messages.length-1)
			i=0
		else
		i++
	}
}

function move2(whichlayer){
	tlayer2=eval(whichlayer)
	if (tlayer2.top>0&&tlayer2.top<=5){
		tlayer2.top=0
		setTimeout("move2(tlayer2)",9000)
		setTimeout("move1(document.main.document.first)",9000)
		return
	}
	if (tlayer2.top>=tlayer2.document.height*-1){
		tlayer2.top-=5
		setTimeout("move2(tlayer2)",50)
	}
	else{
		tlayer2.top=parseInt(scrollerheight)
		tlayer2.document.write(messages[i])
		tlayer2.document.close()
		if (i==messages.length-1)
			i=0
		else
			i++
	}
}

function move3(whichdiv){
	tdiv=eval(whichdiv)
	if (parseInt(tdiv.style.top)>0&&parseInt(tdiv.style.top)<=5){
		tdiv.style.top=0+"px"
		setTimeout("move3(tdiv)",9000)
		setTimeout("move4(second2_obj)",9000)
		return
	}
	if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1){
		tdiv.style.top=parseInt(tdiv.style.top)-5+"px"
		setTimeout("move3(tdiv)",50)
	}
	else{
		tdiv.style.top=parseInt(scrollerheight)
		tdiv.innerHTML=messages[i]
		if (i==messages.length-1)
			i=0
		else
			i++
	}
}

function move4(whichdiv){
	tdiv2=eval(whichdiv)
	if (parseInt(tdiv2.style.top)>0&&parseInt(tdiv2.style.top)<=5){
		tdiv2.style.top=0+"px"
		setTimeout("move4(tdiv2)",9000)
		setTimeout("move3(first2_obj)",9000)
		return
	}
	if (parseInt(tdiv2.style.top)>=tdiv2.offsetHeight*-1){
		tdiv2.style.top=parseInt(tdiv2.style.top)-5+"px"
		setTimeout("move4(second2_obj)",50)
	}
	else{
		tdiv2.style.top=parseInt(scrollerheight)
		tdiv2.innerHTML=messages[i]
		if (i==messages.length-1)
			i=0
		else
			i++
	}
}



function startscroll(){
	if (ie||dom){
		first2_obj=ie? first2 : document.getElementById("first2")
		second2_obj=ie? second2 : document.getElementById("second2")
		move3(first2_obj)
		second2_obj.style.top=scrollerheight
		second2_obj.style.visibility='visible'
		
	}
	else if (document.layers){
		document.main.visibility='show'
		move1(document.main.document.first)
		document.main.document.second.top=parseInt(scrollerheight)+5
		document.main.document.second.visibility='show'
			
	}

    if( typeof window.init == "function" ) 
    // Call the local init function, if present
		init();
}





var delay = 5000; //set delay between message change (in miliseconds)
var maxsteps=30; // number of steps to take to change from start color to endcolor
var stepdelay=40; // time in miliseconds of a single step
//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
var startcolor= new Array(255,255,255); // start color (red, green, blue)
var endcolor=new Array(0,0,0); // end color (red, green, blue)




var fwidth='150px'; //set scroller width
var fheight='150px'; //set scroller height

var fadelinks=1;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.

///No need to edit below this line/////////////////


var ie4=document.all&&!document.getElementById;
var DOM2=document.getElementById;
var faderdelay=0;
var index=0;


/*Rafael Raposo edited function*/
//function to change content
function changecontent(){
  if (index>=news.length)
    index=0
  if (DOM2){
    document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
    document.getElementById("fscroller").innerHTML=begintag+news[index]+closetag
    if (fadelinks)
      linkcolorchange(1);
    colorfade(1, 15);
  }
  else if (ie4)
    document.all.fscroller.innerHTML=begintag+news[index]+closetag;
  index++
}

// colorfade() partially by Marcio Galli for Netscape Communications.  ////////////
// Modified by Dynamicdrive.com

function linkcolorchange(step){
  var obj=document.getElementById("fscroller").getElementsByTagName("A");
  if (obj.length>0){
    for (i=0;i<obj.length;i++)
      obj[i].style.color=getstepcolor(step);
  }
}

/*Rafael Raposo edited function*/
var fadecounter;
function colorfade(step) {
  if(step<=maxsteps) {	
    document.getElementById("fscroller").style.color=getstepcolor(step);
    if (fadelinks)
      linkcolorchange(step);
    step++;
    fadecounter=setTimeout("colorfade("+step+")",stepdelay);
  }else{
    clearTimeout(fadecounter);
    document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
    setTimeout("changecontent()", delay);
	
  }   
}

/*Rafael Raposo's new function*/
function getstepcolor(step) {
  var diff
  var newcolor=new Array(3);
  for(var i=0;i<3;i++) {
    diff = (startcolor[i]-endcolor[i]);
    if(diff > 0) {
      newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);
    } else {
      newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);
    }
  }
  return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}

window.onload=startscroll





