var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
//var InternetExplorer = false;
var awleft=20;
var awtop=300;
var awwidth=150;
var awheight=50;
var gScrInterval;   
var gawl;
var gawld;
var gawcnt=20;
var gcuraw=0;
var gplaying = true;
var gctrlbtn;
var gInterruptPlay = false;
var gScrolling = false;

function initAw()
{
  if (InternetExplorer)
  {
    gawl = window.document.all["awardsl"];
    gawld = window.document.all["awardslc"];
  }
  else
  {
    gawl = window.document.getElementById("awardsl");
    gawld = window.document.getElementById("awardslc");
  }
  {
    if (gawl && gawld)
    {
      if (!gawl.style.overflow)
      {
        gawld.style.visibility = "hidden";
        gawld.display = false;
        return;
      }

      gctrlbtn = window.document.all["controlbtn"];
      if (gctrlbtn)
      {
        gctrlbtn.onclick = stopStartPlaying;
      }

      var clickl = window.document.all["awClick"];
      if (clickl)
        clickl.style.visibility = "hidden";

      gawl.style.display = "inline";
      gawld.style.display = "inline";
      gawld.style.pixelTop = 0;
      gawld.style.visibility = "visible";
      gawl.style.pixelLeft = awleft;
      gawl.style.pixelTop = awtop;
      gawl.style.pixelWidth = awwidth;
      gawl.style.pixelHeight = awheight;
      gawl.display = "yes";
      gawl.style.visibility = "visible";
      gScrInterval = setInterval("startScrollAw()", 2000);
    }
  }
}

function startScrollAw()
{
  clearInterval(gScrInterval);
  if (gInterruptPlay)
  {
    gInterruptPlay = false;
    return;
  }
  if (gcuraw >= gawcnt)
  {
    gcuraw=0;
    if (InternetExplorer)
    {
      gawld.style.pixelTop = 0;
    }
    else
    {
    }
  }

  gScrolling = true;
  gcuraw++;
  gScrInterval = setInterval("scrollAw()", 30);
}

function scrollAw()
{
  if (!gawld) return;
  if (InternetExplorer)
  {
    var y = gawld.style.pixelTop - 1;
    if (y < -gcuraw*awheight)
    {
      clearInterval(gScrInterval);
      gScrolling = false;
      gScrInterval = setInterval("startScrollAw()", 2000);
    }
    else
    {
      gawld.style.pixelTop = y;
      gScrolling = true;
    }
  }
  else
  {
  }
}

function stopStartPlaying()
{
  if (!gplaying && gScrolling)
    return;
  gplaying = !gplaying;
  if (!gplaying)
    stopAwPlay();
  else
    startAwPlay();
}

function stopAwPlay()
{
  if (gctrlbtn)
  {
    gctrlbtn.src="img/play.gif";
    gctrlbtn.alt="Start playing";
  }
  gInterruptPlay = true;
}

function startAwPlay()
{
  if (gctrlbtn)
  {
    gctrlbtn.src="img/pause.gif";
    gctrlbtn.alt="Stop playing";
  }
  gInterruptPlay = false;
  startScrollAw();
}
