<!--
//document.write('<script language="javascript" src="/images/vapeeShout.js"></script>');
function start()
{
  checkImagePreload();
  document.getElementById('imgPlay').title = '自动播放/暂停';
  document.getElementById('imgStop').title = '停止播放';
}

function isImagePreloaded()
{
  return imagePreloaded == imageCount;
}
function checkImagePreload()
{
  if (!isImagePreloaded()) setTimeout('checkImagePreload();', 150);
  else
  {
    hidePreloadDiv();
    isPlaying = true;
    document.getElementById('indexLabel').innerHTML = '页次：';
   if (!isIE)
   {
     document.getElementById('soundMsg').style.marginRight = 
       80+'px';
   }
    document.getElementById('soundMsg').innerHTML = isText?'请手工翻页观看':'自动播放';
    document.getElementById('indexMsg').innerHTML = 1 + ' / ' + setsLength;
//    timer = setTimeout("autoPlay()", 100);
  }
}
function msg(m)
{
  document.getElementById("soundMsg").innerHTML = m;
}

function nextIndex(index)
{
  return (index >= setsLength-1) ? 0 : index+1;
}
function getPreIndex(index)
{
  return (index == 0) ? setsLength-1 : index-1;
}
function getTimeout(action)
{
  return window.setTimeout(action, getTime(curIndex));
}
function getTime(index)
{
  return index == 0 ? timeList[0] : (timeList[index] - timeList[index-1]);
}
function checkTurn()
{
  turnBack = document.getElementById('turnChk').checked;
  if (turnBack) autoPlay();
}
function autoPlay()
{
  if ((!isPlaying&&!isPaused) || (!isText&&preOrNextPressed))
  {
    return;
  }
  document.getElementById("imgPlay").src = IMG_PLAY_1;
  if (curIndex == setsLength)
  {
    if (turnBack) setTimeout('autoPlay();', 100);
    else if (isPaused)
    {
  displayCurSet();
  timer = getTimeout('autoPlay();');
  curIndex = nextIndex(curIndex);
    }
    else
    {
      isPlaying = false;
      document.getElementById("imgPlay").src = IMG_PLAY_0;
      msg('停止');
    }
    curIndex = 0;
    return;
  }
  isPaused = false;
  displayCurSet();
  timer = getTimeout('autoPlay();');
  curIndex = curIndex + 1;
}
function pause()
{
  if (timer != null)
  {
    window.clearTimeout(timer);
    timer = null;
  }
  isPlaying = false;
  document.getElementById('imgPlay').src = IMG_PLAY_0;
  isPaused = true;
  msg('暂停');
}
function play()
{
  if (isImagePreloaded())
  {
    if (preOrNextPressed)
    {
      alert('现在处于手工翻页状态，如果要自动播放，请先按停止键！');
      return false;
    }
    if (isPlaying) // isPlaying
      pause();
    else
    {
      isPlaying = true;
      document.getElementById('soundMsg').innerHTML = '自动播放';
      autoPlay();
    }
  }
  else
    alertDowning();
}
function stop()
{
  if (!isImagePreloaded())
  {
    alertDowning();
    return;
  }
  if (timer != null)
  {
    window.clearTimeout(timer);
    timer = null;
  }
  preOrNextPressed = false;
  document.getElementById('imgPlay').src = IMG_PLAY_0;
  isPlaying = false;
  isStopped = true;

  curIndex = 0;
//  curIndex = setsLength;  preIndex = setsLength-1;
  displayCurSet();
  msg('停止');
//    popMessage(300, 150, '请稍候，下载完以后再点击！');
}
function pre()
{
  if (!isImagePreloaded())
  {
    alertDowning();
    return;
  }
  if (isPlaying)
  {
    if (timer != null)
    {
      window.clearTimeout(timer);
      timer = null;
    }
    pause();
    curIndex = getPreIndex(preIndex);
    autoPlay();
  }
  else
  {
    curIndex = getPreIndex(preIndex);
    displayCurSet();
    curIndex = nextIndex(curIndex);
  }
  preOrNextPressed = true;
  isStopped = false;
  msg('手工翻页');
  document.getElementById('imgPlay').src = IMG_PLAY_0;
}
function next()
{
  if (!isImagePreloaded())
  {
    alertDowning();
    return;
  }
  if (isText && firstClick)
  {
    curIndex = 1;
    firstClick = false;
  }

  if (isPlaying)
  {
    if (timer != null)
    {
      window.clearTimeout(timer);
      timer = null;
    }
    pause();
    displayCurSet();
    curIndex = nextIndex(curIndex);
  }
  else
  {
    if (isStopped) curIndex = nextIndex(curIndex);
//    if (curIndex == setsLength) curIndex = 0;
    displayCurSet();
    curIndex = nextIndex(curIndex);
  }
  preOrNextPressed = true;
  isStopped = false;//+preIndex+' '+curIndex
  msg('手工翻页');
  document.getElementById('imgPlay').src = IMG_PLAY_0;
}
var hide = false;
function hidePreloadDiv()
{
doHidePreloadDiv()
}


//-->
