//-----------------------------------------------------------------------------

function GetId(ID)
{
  return document.getElementById(ID);
}

//-----------------------------------------------------------------------------

var WindowH, WindowW, WindowT, WindowL;

function GetWindowSize()
{
  if(window.innerHeight)
  {
		WindowH = window.innerHeight;
		WindowW = window.innerWidth;
    WindowT = window.pageYOffset;
    WindowL = window.pageXOffset;
  }
  else
  {
    var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body;

		WindowH = iebody.offsetHeight;
		WindowW = iebody.offsetWidth;
    WindowT = iebody.scrollTop;
    WindowL = iebody.scrollLeft;
  }
}

//-----------------------------------------------------------------------------

var AdvertI = 0;
var Advert  = null;
var Adverts  = 0;
var AdvTimr = null;
var AdvFade = 0;

function StartAdvert()
{
  do
  {
    Advert = GetId('logo_'+Adverts);
    if(Advert)
    {
      Advert.style.display = 'none';
      SetAlpha(0);
      Adverts++;
    }
  }
  while(Advert);

  if(Adverts)
  {
    Advert = GetId('logo_0');
    if(Adverts > 1)
    {
      AdvTimr = setInterval('FadeAdvert(0)', 100);
      SetAdvert();
    }
    else
    {
      Advert.style.display = '';
      AdvFade = 100;
      FadeAdvert(0);
    }
  }
}

//---
function NextFade()
{
  if(AdvTimr) clearInterval(AdvTimr);
  AdvTimr = setInterval('FadeAdvert(1)', 100);
}

//---
function SetAdvert()
{
  if(Advert)
  {
    var i;
    do
    {
      i = parseInt(Math.random() * Adverts);
    }
    while(i == AdvertI);

    Advert.style.display = 'none';
    AdvertI = i;
    Advert = GetId('logo_'+AdvertI);
    Advert.style.display = '';
  }
}

//---
function FadeAdvert(Fade)
{
  if(Advert)
  {
    if(Fade)  AdvFade = Math.max(  0, AdvFade - 10);
    else      AdvFade = Math.min( 99, AdvFade + 10);

    SetAlpha(AdvFade);

    if(AdvFade == 0)
    {
      SetAdvert();

      if(AdvTimr) clearInterval(AdvTimr);
      AdvTimr = setInterval('FadeAdvert(0)', 100);
    }
    else if(AdvFade == 99)
    {
      if(AdvTimr) clearInterval(AdvTimr);
      setTimeout('NextFade()', 1500);
    }
  }
  else
    if(AdvTimr) clearInterval(AdvTimr);
}

//---
function SetAlpha(Trans)
{
  if(Advert)
  {
    Advert.style.opacity = (Trans / 100);
    Advert.style.MozOpacity = (Trans / 100);
    Advert.style.KhtmlOpacity = (Trans / 100);
    Advert.style.filter = "alpha(opacity=" + Trans + ")";
  }
}

//----------------
function InsertFlashIndex()
{
  var el = document.getElementById('Flash_Logo');
  if(el)
  {
    el.style.display = 'none';
    el.innerHTML = '<object id="Flash_L" type="application/x-shockwave-flash" data="images/logo.swf" width="900" height="92">' +
                   '<param name="movie" value="images/logo.swf" />' +
                   '<param name="menu" value="false" />' +
                   '<param name="wmode" value="transparent"/>' +
                    el.innerHTML + '</object>';
    setTimeout("document.getElementById('Flash_Logo').style.display = ''", 1000);

    el = document.getElementById('HeaderTxt');
    if(el)  el.innerHTML = "<img src='images/mall_people.jpg' alt=''/>";
  }
}

InsertFlashIndex();


