﻿var IS_NN = (document.all) ? false : true;
var IS_IE = !IS_NN;

var playCount = 0;

function playTheSplashIE() {
	//searchSplash.style.posTop = 250 + (Math.random() - 0.5) * 5;
	//searchSplash.style.posLeft = 250+ (Math.random() - 0.5) * 5;
	searchSplash.style.posTop = document.body.scrollTop + document.body.clientHeight / 2 - 150 / 2 + (Math.random() - 0.5) * 5;
	searchSplash.style.posLeft = document.body.scrollLeft + document.body.clientWidth / 2 - 250 / 2 + (Math.random() - 0.5) * 5;
	if (playCount < 30) {
		playCount++;
		setTimeout("playTheSplashIE()",40);
	} else {
		playCount = 0;
		setTimeout("playTheSplashIE()",6000);
	}
}

function showSearchSplash() {
	if (IS_IE) {
		//searchSplash.style.posTop = 250;
		//searchSplash.style.posLeft = 250;
		searchSplash.style.posTop = document.body.scrollTop + document.body.clientHeight / 2 - 150 / 2;
		searchSplash.style.posLeft = document.body.scrollLeft + document.body.clientWidth / 2 - 250 / 2;
		searchSplash.style.display = "block";
		setTimeout("playTheSplashIE()",3000);
		return;
	}
	/*
	if (IS_NN) {
		document.searchSplash.top = 180;
		document.searchSplash.left = 180;
		document.searchSplash.width = 349;
		document.searchSplash.height = 250;
		document.searchSplash.zIndex = 3;
		document.searchSplash.visibility = "show";
	}
	*/
}

/**
 * now show splash layer
 */
// NB: it's strange but the first layer not correctly displayed in NN,
// so the empty layer is introduced to fix this situation
var splashHTML = "";
if (IS_IE) {
	splashHTML = "<div id=\"searchSplash\" style=\"position: absolute; display: none; z-index: 3;\"><iframe src=\"http://www.unifest.ru/rus/searchsplash.html\" scrolling=\"No\"  frameborder=\"0\" width=\"250\" height=\"142\"></iframe></div>";

} else if (IS_NN) {
	//splashHTML = "<layer bgcolor=\"white\" id=\"searchSplash\" src=\"" + homeUrl + "common/searchsplash.asp\" z-index=\"5\" left=\"0\" top=\"0\" width=\"0\" height=\"0\" visibility=\"hide\"> </layer>";
}
//var splashHTML = "<span style=\"background-color: black; color: white; width: 349px; height: 200px; font-size: 32pt;\">Now searching... Now searching... Now searching... Now searching... Now searching...</span>";
document.writeln(splashHTML);
