//<!--

var currIdx = 0;
var testimonials = new Array();
var screens = new Array();
var rotateId;
var screenId;
var screenIdx = 0;

var setTestimonials = function(){
 testimonials[0] = '"I think FoodFacts is a great tool to help me see exactly what I\'m consuming on a daily basis, and monitor my progress! It helped me get my healthy eating (gluten-free diet) off to a good start!"<div class="quoteBy" style="clear:both;float:right;text-align:left;padding:10px 0px 0px 0px"><strong>-Carey W.</strong>, Boston, MA.<img src="/images/iconArrow.png" width="19" height="17" align="absmiddle" class="mouse" onclick="manualReload();return false;" /></div>';
 testimonials[1] = '"I really love this site. It has been very helpful in finding calories and Ingredients. There are many sites that only give partial info, like calories per serving, but not how many servings per container. I rely on Food Facts to provide the info I can\'t get anywhere else. Thank you, thank you, thank you!"<div class="quoteBy" style="clear:both;float:right;text-align:left;padding:10px 0px 0px 0px;"><strong>-Amy M.</strong>, Seattle, WA.<img src="/images/iconArrow.png" width="19" height="17" align="absmiddle" class="mouse" onclick="manualReload();return false;" /></div>';
 testimonials[2] = '"FoodFacts.com has proven to be an extremely valuable resource to my family. Now I\'m aware of food ingredients and I can intelligently plan meals based on our specific nutritional needs. I wouldn\'t be without it."<div class="quoteBy" style="clear:both;float:right;text-align:left;padding:10px 0px 0px 0px;"><strong>-Jane C.</strong>, Jersey City, NJ<img src="/images/iconArrow.png" width="19" height="17" align="absmiddle" class="mouse" onclick="manualReload();return false;" /></div>';
 testimonials[3] = '"FoodFacts makes it easy to figure out how you\'re doing with daily nutrition. I like how they have icons of pretty much every food I buy. All I have to do is click on a few pictures and I find out whether I\'m getting enough calcium or too many calories throughout the day."<div class="quoteBy" style="clear:both;float:right;text-align:left;padding:10px 0px 0px 0px;"><strong>-A. Middleton</strong>, New York, NY<img src="/images/iconArrow.png" width="19" height="17" align="absmiddle" class="mouse" onclick="manualReload();return false;" /></div>';
 testimonials[4] = '"The actual product label is displayed, so I can see nutrient analysis as well as ingredient list.  I work in a dialysis unit, so I am looking for phosphorus based additives in products. I appreciate the variety of products and brands that you have listed on the site.  I have introduced the site to other dietitians and to our dietetic interns."<div class="quoteBy" style="clear:both;float:right;text-align:left;padding:10px 0px 0px 0px;"><strong>-Dennis L.<strong>, Chicago, IL.<img src="/images/iconArrow.png" width="19" height="17" align="absmiddle" class="mouse" onclick="manualReload();return false;" /></div>';  
 reloadDiv();
}


var reloadDiv = function(){
 var oT = document.getElementById('divTestimonials');
 if(currIdx == testimonials.length){
  currIdx = 0;
 }
 oT.innerHTML = testimonials[currIdx];
 currIdx++;
 rotateId = setTimeout(reloadDiv,10000);
}

var manualReload = function(){
 clearTimeout(rotateId);
 reloadDiv();
}

var changeImg = function(idx){
 if(idx){
  screenIdx = idx-1;
 }

 if(screenIdx < 0 || screenIdx >= screens.length){
  screenIdx = 0;
 }
 document.getElementById('imgMain').src = '/images/' + screens[screenIdx];
 
 switch(screenIdx){
  case 0:
   document.getElementById('imgMain').useMap = "#slide1"
   break;
  case 1:
   document.getElementById('imgMain').useMap = "#slide2";
   break;
  case 2:
   document.getElementById('imgMain').useMap = "#learnMore1";
   break;
  default:
   document.getElementById('imgMain').useMap = "#learnMore2";
 }
 
 screenIdx++;
 screenId = setTimeout(changeImg,15000);
}

var manualReloadScreen = function(idx){
 clearTimeout(screenId);
 changeImg(idx);
}

var setScreens = function(){
 screens[0] = 'slide1.jpg';
 screens[1] = 'slide2.jpg';
 screens[2] = 'slide3.jpg';
 screens[3] = 'slide4.jpg';
 changeImg(1);
}

//-->