<!--
window.addEventListener?window.addEventListener('load',startRecipeFrame,false):window.attachEvent('onload',startRecipeFrame);
//window.onload = function() {};

//Setup variables
var rf = '', xPage = 0, d = document, playing = false, delay = 4000; //milli sec to delay
//Load up array
recipePages = new Array("recipes/burry_me_alive_licuado.html","recipes/strawberry_sorts_fizz.html","recipes/apple_pie_in_a_glass.html","recipes/at_home_cappuccino.html","recipes/banana_breakfast_shake.html","recipes/berry_dairy_dream.html","recipes/chocolate_peanut_butter_cup.html","recipes/citrus_fizz.html","recipes/cookies_and_cream_smoothie.html","recipes/power_orange_smoothie.html","recipes/purple_cow.html","recipes/mocha_eggnog.html");

//other arry defined example
//recipePages[0] = 'recipes/file_name.html';

//new
recipes = d.getElementById('recipes');

function loadPage(playing)
{
  if(xPage < recipePages.length - 1) // -1
  {
    ++xPage;
    //getFrameSrc(recipePages[++xPage]);
  }
  else if(xPage == recipePages.length - 1)
  {
    xPage = 0;
  }
  else
  {
    xPage = 0;
  }

  if(playing == false)
  {
    pageFrameSrc('start'); //run once
  }
  else
  {
    getFrameSrc(recipePages[xPage]);
  }
}

function getFrameSrc(PageRef)
{
  displayRecipe();

  sT = setTimeout('loadPage(playing)', delay); //increment the xPage value
  rf.location.href = PageRef;
}

function playFrameSrc(PageRef)
{
  if(!playing)
  {
  	playing = true;
    getFrameSrc(recipePages[xPage]);
  }
  else
  {
    //dont play
  }
}

function pageFrameSrc(otherPage)
{
  //Cancel auto playing
  if(playing == true) //otherPage == 'next' || otherPage == 'prev')
  {
    pauseFrameSrc();
  }

  if(otherPage == 'next')
  {
    if (xPage == 0)
    {
      xPage = xPage + 1;
    }
    else if (xPage < recipePages.length - 1)
    {
      xPage = xPage + 1;
    }
    else if (xPage == recipePages.length - 1)
    {
      xPage = 0;
    }
  }
  else if(otherPage == 'prev')
  {
    if(xPage < 0)
    {
      xPage = recipePages.length - 1;
    }
    else if (xPage == 0)
    {
      xPage = recipePages.length - 1;
    }
    else if (xPage <= recipePages.length - 1)
    {
      xPage = xPage - 1;
    }
  }
  else if(otherPage == 'start')
  {
    xPage = 1;
  }

  displayRecipe(); // get the next recipe

  rf = frames['recipeFrame'];
  rf.location.href = recipePages[xPage];
}

// Set frame ref, show default DIV recipe
function startRecipeFrame()
{
  rf = frames['recipeFrame'];
  playing = false;
  loadPage(playing);
  displayRecipe();
}

function displayRecipe()
{
// GET the frame source
  var DocText = rf.document.all[0].innerHTML;
  //var DocText = document.getElementById('recipeFrame').innerHTML;
  var recipeText = DocText;
// SET the recipe text
  document.getElementById('recipes').innerHTML = recipeText;

//displayInfo();
}

function pauseFrameSrc()
{
  if(playing)
  {
    clearTimeout(sT);
    playing = false;
  }

//displayInfo();
}

//Debugging
function displayInfo()
{
  //Info only
  document.getElementById('info').innerHTML = "playing="+ playing + " xPage="+ xPage +" array.length="+ recipePages.length +" recipePage="+recipePages[xPage];
  //if(recipePages.length - 1 <= xPage ) xPage = 0;
}
//-->
