﻿var text = new Array(); 
var txtcnt = 0; 
var thistxt = 0;

text[txtcnt++] = "79,400,000 Americans have one or more forms of cardiovascular disease.<br />";

text[txtcnt++] = "According to recent estimates, nearly one in three U.S. adults has high blood pressure.<br />";

text[txtcnt++] = "An estimated 371 billion cigarettes were consumed in the United States in 2006.<br />";

text[txtcnt++] = "The total economic costs associated with cigarette smoking are estimated at $7.18 per pack of cigarettes sold in the United States.<br />";

text[txtcnt++] = "In 2003, 181,646 women and 1,826 men developed breast cancer.<br />"; 

text[txtcnt++] = "Cervical cancer can usually be treated and prevented if women are screened regularly with a test called the Pap test.<br />";

text[txtcnt++] = "When it is found early and treated, cervical cancer is highly curable.<br />";

text[txtcnt++] = "Physically inactive people are twice as likely to develop coronary heart disease as regularly active people.<br />";

text[txtcnt++] = "The cost of overweight and obesity to the economy is $117 billion annually in direct and indirect medical costs.<br />";

text[txtcnt++] = "Six million workers suffer non-fatal workplace injuries at an annual cost to U.S. businesses of more than $125 billion. <br />";

text[txtcnt++] = "Establish a Transitional Work Program for your organization, the cost savings can be enormous, ask us how!<br />";

text[txtcnt++] = "Diabetes is an UNDER diagnosed killer, come in today for your screening. Effective treatment means decreased risk and good health.<br />";

text[txtcnt++] = "Every 9 minutes, someone is injured at work - learn how to decrease this rate in your place of business-<br />";

text[txtcnt++] = "The American Heart association defines HYPERTENSION as a blood pressure reading above 120/80.  What is your blood pressure?<br />";

text[txtcnt++] = "There are 20.8 million children and adults in the United States with Diabetes, what about you?<br />";

text[txtcnt++] = "Pinnacle Healthcare provides Urgent care, Primary care, Specialty care as well as Workers- Compensation care.<br />";

var displaytext = text[1];
var didyouknowtag = "<span class='boldred'>Did You Know?</span><br />";


function MakeArray(n){
    this.length=n;
    for(var i=1; i<=n; i++) this[i]=i-1;
    return this
  }

hex=new MakeArray(16);
hex[11]="A"; hex[12]="B"; hex[13]="C"; hex[14]="D"; 
hex[15]="E"; hex[16]="F";

function ToHex(x){   // Changes a int to hex (in the range 0 to 255)
  var high=x/16;
  var s=high+"";        //1
  s=s.substring(0,2);   //2 the combination of these = trunc funct.
  high=parseInt(s,10);  //3
  var left=hex[high+1]; // left part of the hex-value
  var low=x-high*16;    // calculate the rest of the values
  s=low+"";             //1
  s=s.substring(0,2);   //2 the combination of these = trunc funct.
  low=parseInt(s,10);   //3
  var right=hex[low+1]; // right part of the hex-value
  var string=left+""+right; // add the high and low together
  return string;
}

function rotate() {
	thistxt++;
	if (thistxt >= txtcnt) thistxt = 0;
	displaytext = text[thistxt];
	document.getElementById('DidYouKnow').innerHTML=didyouknowtag+displaytext;
	//fadeIn('DidYouKnow', 2000);
	setTimeout("rotate();",7000);
	fadeIn('DidYouKnow', 2000);
}

function fadeOut(thisId, speed) {
    var thisE = document.getElementById(thisId);
    thisE.style.zoom = 1; //needed for IE
    speed = speed/20;
    var i = 100;
    var intervalId = setInterval(function() {
        if(i>=0) {
            thisE.style.opacity = i/100;
            thisE.style.filter = 'alpha(opacity='+i+')';
            i -= 5;
        } else {
            setTimeout(function() {thisE.style.display = "none";}, speed);
            clearInterval(intervalId);
            return false;
        }
    }, speed);
}

function fadeIn(thisId, speed) {
    var thisE = document.getElementById(thisId);
    thisE.style.display = "block";
    thisE.style.zoom = 1; //needed for IE
    thisE.style.opacity = 0;
    thisE.style.filter = "alpha(opacity = 0)";
    speed = speed/20;
    var i = 0;
    var intervalId = setInterval(function() {
        if(i <= 100) {
            thisE.style.opacity = i/100;
            thisE.style.filter = 'alpha(opacity='+i+')';
            i += 5;
        } else {
            clearInterval(intervalId);
            return false;
        }
    }, speed);
}

setTimeout("rotate();",0);

