function ColorizeSwitches(a) {
     if (document.getElementById) {
          var spnSwitches = new Array();
               spnSwitches[0] = document.getElementById('s1'),
               spnSwitches[1] = document.getElementById('s2'),
               spnSwitches[2] = document.getElementById('s3'),
               spnSwitches[3] = document.getElementById('s4');
          for (i=0;i<=3;i++) {
               spnSwitches[i].setAttribute("class", "off");
               spnSwitches[i].setAttribute("className", "off"); // MSIE
          }
          
          spnSwitches[a].setAttribute("class", "on");
          spnSwitches[a].setAttribute("className", "on"); // MSIE
          
     }
}
function SwitchFacts(n) {
     if (document.getElementById) { 
          var spnFacts = document.getElementById('Facts'),
               strFact = new Array();
               strFact[0] = "Secondhand smoke causes between 35,000 and 40,000 deaths from heart disease every year nationwide.",
               strFact[1] = "12,000 otherwise healthy nonsmokers will die of some form of cancer&mdash;3,000 specifically because of the exposure to secondhand smoke.",    
               strFact[2] = "Secondhand smoke is the third leading preventable cause of death in the United States, killing 38,000 to 65,000 nonsmokers every year.",    
               strFact[3] = "Smoking kills more people each year than alcohol, AIDS, car crashes, illegal drugs, murders and suicides combined."
          spnFacts.removeChild(spnFacts.firstChild);
          spnFacts.appendChild(document.createTextNode(strFact[n]));
          ColorizeSwitches(n);
     }
}
function isEmail(elm){ 
     if (elm.value.indexOf("@") != "-1" &&
          elm.value.indexOf(".") != "-1" &&
          elm.value != "")
     return true;
     else return false;
}
function isFilled(elm){
     if (elm.value == "" ||
          elm.value == null)
     return false;
     else return true;
}
function displayError(err,label,input,reveal) {
     if (reveal==1) {
          document.getElementById(err).style.display = "block";
          document.getElementById(label).style.color = "#C03";
          document.getElementById(input).style.borderColor = "#C03";
     } else {
          document.getElementById(err).style.display = "none";
          document.getElementById(label).style.color = "#039";
          document.getElementById(input).style.borderColor = "#039";
     }
}

function isReady(contact){  // Contact Us Page    
     if (isFilled(contact.cname) == false){
          displayError("errName","labelName","inputName",1);
          contact.cname.focus();
          return false;
     } else {
          displayError("errName","labelName","inputName",0);
     }
     if (isEmail(contact.cemail) == false){
          displayError("errEmail","labelEmail","inputEmail",1);
          contact.cemail.focus();
          return false;
     } else {
          displayError("errEmail","labelEmail","inputEmail",0);
     }
     if (isFilled(contact.ccomments) == false){
          displayError("errComments","labelComments","inputComments",1);
          contact.ccomments.focus();
          return false;
     } else {
          displayError("errComments","labelComments","inputComments",0);
     }
return true;
}
function resetError() { // Contact Us Page
     arrReset = new Array ("Name","Email","Comments");
     for (i=0; i<=2; i++) {
          var errReset = "err"+arrReset[i];
          var labelReset = "label"+arrReset[i];
          var inputReset = "input"+arrReset[i];
          document.getElementById(errReset).style.display = "none";
          document.getElementById(labelReset).style.color = "#039";
          document.getElementById(inputReset).style.borderColor = "#039";
     }
}