attachHandler(window, 'load', {
		handleEvent: function(event)
		{
			init();
		}
	});

function createFlashElement__W3C(id, data, width, height, flashVars)
{
	var attributes = {
				id: id,
				type: 'application/x-shockwave-flash',
				style: 'width: '+ width +'; height: '+ height +';',
				data: data,
				flashVars: flashVars
			},
		parameters = {
				allowScriptAccess: 'always',
				swLiveConnect: 'true',
				wmode: 'opaque'
			},
		flashElement = HTMLObjectElementWrapper.CreateObjectElement(document, attributes, parameters);
	return flashElement;
}

function createFlashElement__MS(id, data, width, height, flashVars)
{
	var attributes = {
				id: id,
				width: width,
				height: height,
				type: 'application/x-shockwave-flash',
				flashVars: flashVars
			},
		parameters = {
				movie: data,
				allowScriptAccess: 'always',
				swLiveConnect: 'true'
			},
		flashElement = HTMLObjectElementWrapper.CreateObjectElement(document, attributes, parameters);
	return flashElement;
}

switch(BROWSER_TYPE)
{
	case BrowserType.MSIE:
		createFlashElement = createFlashElement__MS;
		break;

	default:
		createFlashElement = createFlashElement__W3C;
		break;
}

function getCatalogFilename()
{
	return (window.screen.width < 1280 || window.screen.height < 1024) ? 'Interactive_catalog_1024.swf' : 'Interactive_catalog.swf';
}

function createFlashCatalog__W3C()
{
	var flashElement = createFlashElement('Interactive_catalog', getCatalogFilename(), '100%', '100%');
	flashElement.setAttribute('tabIndex', '0');
	document.body.appendChild(flashElement);
	return flashElement;
}

function createFlashCatalog__MS()
{
	var flashElement = createFlashElement('Interactive_catalog', getCatalogFilename(), '100%', '100%');
	document.body.appendChild(flashElement);
	flashElement.outerHTML = flashElement.outerHTML;
	flashElement = document.getElementById('Interactive_catalog');
	return flashElement;
}

switch(BROWSER_TYPE)
{
	case BrowserType.MSIE:
		createFlashCatalog = createFlashCatalog__MS;
		break;

	default:
		createFlashCatalog = createFlashCatalog__W3C;
		break;
}

function init()
{
	var hasProductInstall = DetectFlashVer(6, 0, 65),
		requiredMajorVersion = 9,
		requiredMinorVersion = 0,
		requiredRevision = 124,
		hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

	if(hasProductInstall && !hasRequestedVersion)
	{
		/*
		 * neni dostupna pozadovana verze flashe,
		 * dostupna verze podporuje upgrade instalace;
		 * vytvorime "upgrader"
		 */
		var MMPlayerType = (BROWSER_TYPE == BrowserType.MSIE) ? "ActiveX" : "PlugIn",
			MMredirectURL = location,
			flashVars = "MMredirectURL="+ MMredirectURL +'&MMplayerType='+ MMPlayerType,
			flashElement = createFlashElement('playerProductInstall', 'playerProductInstall.swf', 640, 480, flashVars);

		document.body.appendChild(flashElement);
		if(BROWSER_TYPE == BrowserType.MSIE)
			/*
			 * v MSIE je nutno flashovy object po vlozeni takto "aktivovat" 
			 */
			flashElement.outerHTML = flashElement.outerHTML;
	}
	else
		if(hasRequestedVersion)
		{
			/*
			 * je dostupna pozadovana verze flashe
			 */
			var flashElement = createFlashCatalog();

			attachHandler(document.body, 'help', {
					handleEvent: function(event)
					{
						event.returnValue = false;
						event.cancelBubble = true;
					}
				});
			try
			{
				flashElement.focus();
			}
			catch(e)
			{
				alert(e.message);
			}
		}
		else
		{
			/*
			 * neni dostupna pozadovana verze flashe
			 */
			var messageBoard = document.getElementById('messageBoard');
			if(messageBoard)
				messageBoard.style.display = '';
		}
}

