﻿var topPixUrls=null,topPixDelay=null,topPixUrlsSwapper=null;
function _init()
{
	var L=document.getElementById("ulTopMenu").getElementsByTagName("li"),k;
	for(k=0;k<L.length;k++)
	{
		L[k].onmouseover=function(){this.className+=" tmOver";};
		L[k].onmouseout=function(){this.className=this.className.replace(new RegExp("\\btmOver\\b"), "");}
	}
	if(topPixUrls)
		new topPixUrlsSwapperB();
	if(window["init"])init();
}
function topPixUrlsSwapperB()
{
	topPixUrlsSwapper=this;
	this.Index=0;
	this.I=document.getElementById("imgTopPix");
	try
	{
		this.UseFilter=false;
		if(document.all && this.I.filters && (typeof(this.I.filters.length)=="number") && this.I.filters.length)
			this.UseFilter=true;
	}
	catch(e)
	{}
	setInterval("topPixUrlsSwapper.Next()",topPixDelay?topPixDelay:4000);
}
topPixUrlsSwapperB.prototype=
{
	FILTER_DELAY:0.8,
	FILTERS:
	[
		"Barn(orientation='horizontal' motion='in',%d%)",
		"Barn(orientation='horizontal' motion='out',%d%)",
		"Barn(orientation='vertical' motion='in',%d%)",
		"Barn(orientation='vertical' motion='out',%d%)",
		"Checkerboard(Direction='down',%d%)",
		"Checkerboard(Direction='left',%d%)",
		"Checkerboard(Direction='right',%d%)",
		"Checkerboard(Direction='up',%d%)",
		"Inset(%d%)",
		"Iris(irisStyle='circle', motion='in',%d%)",
		"Iris(irisStyle='cross', motion='out',%d%)",
		"Iris(irisStyle='diamond', motion='in',%d%)",
		"Iris(irisStyle='plus', motion='in',%d%)",
		"Iris(irisStyle='square', motion='out',%d%)",
		"Iris(irisStyle='star', motion='out',%d%)",
		"Pixelate(%d%)",
		"RandomBars(motion='horizontal',%d%)",
		"RandomBars(motion='vertical',%d%)",
		"RandomDissolve(%d%)",
		"Slide(bands=5, slidestyle='hide',%d%)",
		"Slide(bands=5, slideStyle='push',%d%)",
		"Slide(bands=5, slidestyle='swap',%d%)",
		"Spiral(%d%)",
		"Stretch(stretchStyle='push',%d%)"
	],
	Next:function()
	{
		if(++this.Index>=topPixUrls.length)
			this.Index=0;
		if(this.UseFilter)
		{
			this.I.style.filter="progid:DXImageTransform.Microsoft."+this.FILTERS[Math.round(Math.random()*(this.FILTERS.length-1))].replace("%d%","duration="+this.FILTER_DELAY);
			this.I.filters[0].apply();
		}
		this.I.src=topPixUrls[this.Index];
		if(this.UseFilter)
			this.I.filters[0].play();
	}
}
