// JavaScript Document

/***********************************************
* Fading Scroller- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var qdelay = 4000; //set delay between message change (in miliseconds)								//changed all variables from "delay"
var qmaxsteps=30; // number of steps to take to change from start color to endcolor		//changed all variables from "maxsteps
var qstepdelay=40; // time in miliseconds of a single step														//changed all variables from "qstepdelay
//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
var qstartcolor= new Array(255,255,255); // start color (red, green, blue)						//changed all variables from "startcolor"
var qendcolor=new Array(0,0,0); // end color (red, green, blue)												//changed all variables from "endcolor"

var qcontent=new Array();																															//changed all variables from "fcontent"
qbegintag='<div align="center" style="font: normal 15px Arial; padding: 8px; text-align: center;">'; //set opening tag, such as font declarations
//changed all variables from "begintag"
qcontent[0]="&quot;Ahora se que es lo que mis hijos quieren de mi en vez de lo que yo quiero de ellos. PAP&Aacute;S me ayudo mucho.&quot;";
qcontent[1]="&quot;Fue una experiencia muy bonita, aprendí algunas cosas hermosas, como valorar la amistad.&quot;";
qcontent[2]="&quot;Ahora soy un mejor padre para mis hijos, me ayudo mucho porque pude poner en practica lo que aprendí.&quot;";

qclosetag='</div>';																																		//changed all variables from "closetag"

var qwidth='195px'; //set scroller width																							//changed all variables from "fwidth"
var qheight='100px'; //set scroller height																						//changed all variables from "fheight"

var qfadelinks=1;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.
//changed all variables from "fadelinks"

///No need to edit below this line/////////////////


var qie=document.all&&!document.getElementById;																				//changed from "ie"
var qDOM2=document.getElementById;																										//changed from "DOM2"
var qfaderdelay=0;																																		//changed from "faderdelay"
var qindex=0;																																					//changed from "index"

/*Rafael Raposo edited function*/
//function to change content
function qchangecontent(){													//changed from "changecontent()"
  if (qindex>=qcontent.length)
    qindex=0
  if (qDOM2){
    document.getElementById("qscroller").style.color="rgb("+qstartcolor[0]+", "+qstartcolor[1]+", "+qstartcolor[2]+")"
    document.getElementById("qscroller").innerHTML=qbegintag+qcontent[qindex]+qclosetag
    if (qfadelinks)
      qlinkcolorchange(1);
    qcolorfade(1, 15);
  }
  else if (qie)
    document.all.qscroller.innerHTML=qbegintag+qcontent[qindex]+qclosetag;
  qindex++
}

// colorfade() partially by Marcio Galli for Netscape Communications.  ////////////
// Modified by Dynamicdrive.com

function qlinkcolorchange(step){											//changed from "linkcolorchange(step)"
  var obj=document.getElementById("qscroller").getElementsByTagName("A");
  if (obj.length>0){
    for (i=0;i<obj.length;i++)
      obj[i].style.color=qgetstepcolor(step);
  }
}

/*Rafael Raposo edited function*/
var qfadecounter;
function qcolorfade(step) {														//changed from "colorfade(step)"
  if(step<=qmaxsteps) {	
//alert("step = " + step + " qmaxsteps = " + qmaxsteps);
    document.getElementById("qscroller").style.color=qgetstepcolor(step);
    if (qfadelinks)
      qlinkcolorchange(step);
    step++;
    qfadecounter=setTimeout("qcolorfade("+step+")",qstepdelay);
  }else{
//alert("step = " + step + " qmaxsteps = " + qmaxsteps);
    clearTimeout(qfadecounter);
    document.getElementById("qscroller").style.color="rgb("+qendcolor[0]+", "+qendcolor[1]+", "+qendcolor[2]+")";
    setTimeout("qchangecontent()", qdelay);
  }   
}

/*Rafael Raposo's new function*/
function qgetstepcolor(step) {													//changed from "getstepcolor(step)"
  var diff
  var newcolor=new Array(3);
  for(var i=0;i<3;i++) {
    diff = (qstartcolor[i]-qendcolor[i]);
    if(diff > 0) {
      newcolor[i] = qstartcolor[i]-(Math.round((diff/qmaxsteps))*step);
    } else {
      newcolor[i] = qstartcolor[i]+(Math.round((Math.abs(diff)/qmaxsteps))*step);
    }
  }
  return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}

if (qie||qDOM2)
  document.write('<div id="qscroller" style="border:0px solid black;width:'+qwidth+';height:'+qheight+'"></div>');

if (window.addEventListener) {
window.addEventListener("load", qchangecontent, false);
//alert("calling qchangecontent from bottom 1");
}
else if (window.attachEvent) {
window.attachEvent("onload", qchangecontent);
//alert("calling qchangecontent from bottom 2");
}
else if (document.getElementById) {
window.onload=qchangecontent;
//alert("calling qchangecontent from bottom 1");
}
