cur = 0;
function rot(){
	window.setInterval("fade('callout')",5000);
}

function chgText(){
	ar = Array('<p>"262 Five recently performed on-site post-production and encoding services for Netflix at Film Independent\'s Independent Spirit Awards, for which my site, Moviefone, was a media partner.</p>','<p>"It is truly a pleasure to write a note on behalf of Kyle and Brinson and the entire team at 262 Five. Over the past 3 plus years, 262 Five has impeccably executed the most extraordinary events that Netflix has ever done. Bringing the Netflix brand to life with the "LIVE! On Location" series, they helped take Netflix event production to a different level in terms of scale, creativity and professionalism. 262 Five has created first class experiences for not only for Netflix audiences, but..."</p>','<p>"I just wanted to call you and thank you sincerely for just such an incredible event.  I don’t even know where to start but I just wanted to let you guys know that I had easily the best time of my life performing like that and that is due in large part to you guys and everything you did.  Thank you very very much."</p>','<p>"Over the years we have worked with Kyle and Brinson, many times. We know that when they are going to be at any event we are involved in that everything will be perfect.  They are both true professionals and are..."</p>','<p>"As a company that has regularly produced large-scale, high-end concerts and events, we were looking for a company that provided turn-key management and execution of all facets of the production and talent acquisition..."</p>');
	ran = Math.floor(Math.random()*4);
	while(cur == ran){
		ran = Math.floor(Math.random()*4);	
	}
	cur = ran;
	document.getElementById('callout').innerHTML = ar[ran];
	fade('callout');
}

var TimeToFade = 1000.0;

function fade(eid)
{
  var element = document.getElementById(eid);
  if(element == null)
    return;
   
  if(element.FadeState == null)
  {
    if(element.style.opacity == null
        || element.style.opacity == ''
        || element.style.opacity == '1')
    {
      element.FadeState = 2;
    }
    else
    {
      element.FadeState = -2;
    }
  }
   
  if(element.FadeState == 1 || element.FadeState == -1)
  {
    element.FadeState = element.FadeState == 1 ? -1 : 1;
    element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft;
  }
  else
  {
    element.FadeState = element.FadeState == 2 ? -1 : 1;
    element.FadeTimeLeft = TimeToFade;
    setTimeout("animateFade(" + new Date().getTime() + ",'" + eid + "')", 33);
  }  
}

function animateFade(lastTick, eid)
{  
  var curTick = new Date().getTime();
  var elapsedTicks = curTick - lastTick;
 
  var element = document.getElementById(eid);
 
  if(element.FadeTimeLeft <= elapsedTicks)
  {
   	chgText();
    element.style.opacity = element.FadeState == 1 ? '1' : '0';
    element.style.filter = 'alpha(opacity = '
        + (element.FadeState == 1 ? '100' : '0') + ')';
    element.FadeState = element.FadeState == 1 ? 2 : -2;
    return;
  }
 
  element.FadeTimeLeft -= elapsedTicks;
  var newOpVal = element.FadeTimeLeft/TimeToFade;
  if(element.FadeState == 1)
    newOpVal = 1 - newOpVal;

  element.style.opacity = newOpVal;
  element.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')';
 
  setTimeout("animateFade(" + curTick + ",'" + eid + "')", 33);
}
