/***********************************************
* 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 delay = 8000; //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(077,077,077); // start color (red, green, blue)
var endcolor=new Array(255,255,255); // end color (red, green, blue)

var fecha       = new Date();
var diaActual   = fecha.getDate();
var mesActual   = fecha.getMonth();
var anyoActual  = fecha.getFullYear();

var diaNoticia1 = 20;
var diaNoticia2 = 21;
var diaNoticia3 = 22;

if ( diaNoticia3 > diaActual )
{
    diaNoticia3 = diaActual;
}

if ( diaNoticia3.toString().length == 1 )
{
    diaNoticia3 = "0" + diaNoticia3;
}

if ( ( diaNoticia2 > (diaActual - 1) ) && ( (diaActual - 1) > 0 ) )
{
    diaNoticia2 = diaActual - 1;
}
else
{
    diaNoticia2 = diaActual;
}

if ( diaNoticia2.toString().length == 1 )
{
    diaNoticia2 = "0" + diaNoticia2;
}

if ( ( diaNoticia1 > (diaActual - 2) ) && ( (diaActual - 2) > 0 ) )
{
    diaNoticia1 = diaActual - 2;
}
else
{
    diaNoticia1 = diaActual;
}

if ( diaNoticia1.toString().length == 1 )
{
    diaNoticia1 = "0" + diaNoticia1;
}

var mesNoticia = 8;

if ( mesNoticia > mesActual )
{
    mesNoticia = mesActual;
    mesNoticia++;
}

if ( mesNoticia.toString().length == 1 )
{
    mesNoticia = "0" + mesNoticia;
}

var fcontent=new Array();
begintag='<div>'; //set opening tag, such as font declarations
fcontent[0]="<div><a href='#' class='txtOrange'><strong class='txtOrange'>" + diaNoticia3 + "." + mesNoticia + "." + anyoActual + "</strong><br /><span class='txtOrange'>Filiaciones Internacionales.</span></a><br>La Escuela Oficial de Hipnosis Clínica Directa está afiliada a la Sociedad de Hipnosis Clínica. La <strong>SHC</strong> acredita a todos los alumnos de la escuela que hayan finalizado su ciclo formativo.</div>";
fcontent[1]="<div><a href='#' class='txtOrange'><strong class='txtOrange'>" + diaNoticia2 + "." + mesNoticia + "." + anyoActual + "</strong><br /><span class='txtOrange'>Filiaciones Extrangeras.</span></a><br>La Escuela Oficial de Hipnosis Clínica Directa está afiliada a más de veinte organizaciones profesionales internacionales de reconocido prestigio en el ámbito de la hipnosis clínica.</div>";
fcontent[2]="<div><a href='#' class='txtOrange'><strong class='txtOrange'>" + diaNoticia1 + "." + mesNoticia + "." + anyoActual + "</strong><br /><span class='txtOrange'>Asesoría de Postgrado.</span></a><br>La Escuela Oficial de Hipnosis Clínica Directa es el único centro de formación en hipnosis que ofrece asesoría de postgrado a los alumnos que hayan finalizado el ciclo formativo.</div>";
closetag='</div>';

var fwidth='100%'; //set scroller width
var fheight='100%'; //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>=fcontent.length)
index=0
if (DOM2){
document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
if (fadelinks)
linkcolorchange(1);
colorfade(1, 15);
}
else if (ie4)
document.all.fscroller.innerHTML=begintag+fcontent[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] + ")");
}

if (ie4||DOM2)
document.write('<div id="fscroller"></div>');

if (window.addEventListener)
window.addEventListener("load", changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent)
else if (document.getElementById)
window.onload=changecontent

