/***********************************************
* 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 = 4000; //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(53,53,53); // end color (red, green, blue)

var fcontent=new Array();
begintag='<div>'; //set opening tag, such as font declarations
fcontent[0]="We came to this hospital under recommendations of our friends for by-pass surgery. We have found this as an excellent hospital. Technical abilities and knowledge of the doctors and attached staff is superb...<br>- <b>P K Vatsyayan, IRS, Commissioner of Income Tax III, Rajkot</b>";
fcontent[1]="I must congratulate the staff and management of SAL hospital for achieving a fine balance between professional medical care and the human touch. The staff is professional and courteous and the knowledge of doctors...<br>- <b>Vimal Ambani, S/O Mr. Natubhai Ambani</b>";
fcontent[2]="I was admitted to SAL for emergency medical treatment. Words will fall short to describe how you feel at home even under the situation which might be a cause for a lot of anxiety...<br>- <b>Jay Narayan Vyas, Hon. Health Minister, Govt. of Gujarat, Gandhinagar</b>";
fcontent[3]="From ward boys, sisters, other staff members and doctors, everybody was excellent in delivering medical service, human approach as well as medical competence. I request the hospital to keep encouraging...<br>- <b>Dr. Prahalad Togadiya, Ahmedabad</b>";
fcontent[4]="I leave this hospital today with nice memory of wonderful treatment given to us by all the staff in the entire hospital. Starting fro the PRO to the staff in Cath. Labs, ICU and the private rooms was extremely prompt...<br>- <b>Mr. Ravi Saxena, IAS, Principal Secretary, Govt. Of Gujarat</b>";
fcontent[5]="Bye pass surgery has been conducted in SAL hospital. In spite of my father being old, Dr. Anil Jain and his team did excellent job. Professional competence was shown at its best. Mr Rajendrabhai shah and his team took extreme personal care that will...<br>- <b>Pankaj Kumar, APS to Cm, Gandhinagar</b>";
fcontent[6]="We have just visited SAL Hospital. Let me congratulate you for your great achievement in medical industry. As per my observation & feeling despite of heavy expenses, your organization have achieved significant goal...<br>- <b>Mr. Pranav J Maniyar, Ami Trading Co., Bhavnagar</b>";
fcontent[7]="I came here very sick. I saw the best human touch of each and every member of the SAL family. I went back fully recovered with a great feeling of well being, a boon of the SAL humane touch...<br>- <b>Keshav Kumar, IPS, DIG, Gujarat state, Gandhinagar</b>";
fcontent[8]="I observed that the hospital authority, medical staff and other supporting staff are very committed and courteous. This behavior should be continued and eve improved upon. Thanks a lot for everything. God bless your hospital.<br>- <b>Mrs. Habiba Imani, South Africa</b>";
fcontent[9]="I believe when it comes to medical-surgical treatment FAITH matters a lot and after that medical science & treatment. We always had the same FAITH in SAL Hospital, its team & doctors & other staff and once again...<br>- <b>Mr. Bhavin B. Mavani, Ahmedabad</b>";
fcontent[10]="I am extremely delighted with all aspects of treatment and hospitality at SAL Hospital, while my mother underwent open heart bypass surgery by Dr. Anil Jain & team...<br>- <b>Mr. Upendra Vasishth, Kandla Special Economic Zone, GOI, Gandhidham, Gujarat</b>";
fcontent[11]="Yes, I got new life. Just in time. Thanks to SAL Hospitals facility and all staff members. To start with, accommodating for angiography with short notice. Doctors and their team members did great Job and through analysis...<br>- <b>Mr. Niranjan Shah, Michigan, USA</b>";
closetag='</div>';

var fwidth='263px'; //set scroller width
var fheight='105px'; //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" style="border:0px solid black;width:'+fwidth+';height:'+fheight+'"></div>');

if (window.addEventListener)
window.addEventListener("load", changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent)
else if (document.getElementById)
window.onload=changecontent
