﻿// Splash coding

var img;
var idInterval;
var Opacity;
var aSplash = new Array();
var nCurrent = 0;
function setOpacity(opacity)
{
  opacity = (opacity == 100) ? 99.999 : opacity;
  
  // IE/Win
  img.style.filter = "alpha(opacity:" + opacity + ")";
  
  // Safari<1.2, Konqueror
  img.style.KHTMLOpacity = opacity / 100;
  
  // Older Mozilla and Firefox
  img.style.MozOpacity = opacity / 100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  img.style.opacity = opacity / 100;
}
function fadeIn()
{
	if ( Opacity <= 100 )
	{
		setOpacity(Opacity);
		Opacity += 10;
	}
	else
	{
		if ( (Opacity += 10) > 400 )
		{
		    if ( aSplash[nCurrent].delay > 0 )
		    {
		        clearInterval(idInterval);
		        idInterval = setInterval("delay()", aSplash[nCurrent].delay);
		    }
		    else
		    {
			    if ( ++nCurrent >= aSplash.length )
			    {
				    nCurrent = 0;
			    }
    			
			    animate();
		    }
		}
	}
}
function delay()
{
    if ( ++nCurrent >= aSplash.length )
    {
        nCurrent = 0;
    }

    animate();
    if (aSplash[nCurrent].fade == false)
    {
        Opacity = 410;
        setOpacity(400);
    }
    clearInterval(idInterval);
    idInterval = setInterval("fadeIn()", 100);
}
function initSplash()
{
	img = document.getElementById("imgSplash");

	nCurrent = 0;
	animate();
	idInterval = setInterval("fadeIn()", 100);
}
function animate()
{
	img.src = aSplash[nCurrent].Image.src;
	img.style.cursor = aSplash[nCurrent].url == null ? 'default' : 'pointer';
	img.style.borderColor = "Black";
	img.style.borderWidth = "1px";
	img.style.borderStyle = "solid";
	setOpacity(0);
	img.style.visibility = 'visible';
	Opacity = 10;
}
function SplashImage(url, image, delay, fade)
{
	this.Image = new Image();
	this.Image.src  = image;
	this.url        = url;
	this.delay      = delay;
	this.fade       = fade;
}
function showProduct(url)
{
	if ( aSplash[nCurrent].url != null )
	{
		document.location.href = aSplash[nCurrent].url;
	}
}
function onMouseOverSplash()
{
	img.style.cursor = aSplash[nCurrent].url == null ? 'default' : 'pointer';
}
