// JavaScript Document
function yourFlashPluginInfo() {
	var cls, infoEl, message, link = true;
	
	flashDetect.detect();
	message = ' ';
	switch (flashDetect.version) {
		case 8:
		case 9:
			cls = 'high';
			message += '!';
			link = false;
			break;
		case 7:
			cls = 'medium';
			message += '7<\/strong> Používáte starší verzi Flash Playeru. Pro upgrade klikni <b><a id = "flashlink">ZDE</a></b> .';
			var f = document.getElementById('flashIndex');
			f.style.display = "none";
			break;
		case 6 :
		case 5 :
		case 4 :
		case 3 :
		case 2 :
		case 1 :
			cls = 'low';
			message +=  flashDetect.version + '<\/strong> Používáte starší verzi Flash Playeru. Pro upgrade klikni <b><a id = "flashlink">ZDE</a></b> .';
			var f = document.getElementById('flashIndex');
			f.style.display = "none";
			break;
		case 0 :
		case -1 :
			cls = 'low';
			message = 'Ačkoli jsme se snažili co to šlo, nalezli jsme ve vašem počítači nainstalovaný Flash player pro přehrávání flashových animací. Po kliknutí <b><a id = "flashlink">ZDE</a></b> budete automaticky přesměrováni na stránky, kde se vám po krátkém nainstalování flashového přehrávače, otevře přístup k následujícím sekcím:';
			var f = document.getElementById('flashIndex');
			f.style.display = "none";
			break;
	}
	
	infoEl = document.getElementById('divflashcheck');
	/* infoEl.className += ' flash-' + cls; */
	infoEl.innerHTML = message;
	
	var objfl = document.getElementById('flashlink');
        objfl.href = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
}


var flashDetect =  {

	latestFlashVersion : 9,
	version 	: null,
	detect : function() {
		
		flashDetect.version = getFlashVersion();
		
		/* THIS PART IS BASED ON: */
		// Flash Version Detector  v1.2.1
		// documentation: http://www.dithered.com/javascript/flash_detect/index.html
		// license: http://creativecommons.org/licenses/by/1.0/
		// code by Chris Nott (chris[at]dithered[dot]com)
		// with VBScript code from Alastair Hamilton (now somewhat modified)
		
		function isDefined(property) {
		  return (typeof property != 'undefined');
		}
		
		function getFlashVersion() {
			var flashVersion = 0;
			var latestFlashVersion = 9;
			var agent = navigator.userAgent.toLowerCase(); 
			var reallyExistsPluginsArray = false;
			
			try {
				// IE vraci tvrdi, ze ma navigator.plugins, byt ho nema, otestujem metodu refresh
				if(navigator.plugins && navigator.plugins.refresh) {
					reallyExistsPluginsArray = true;
				}
			} catch(e) {}
			
			if (reallyExistsPluginsArray) {				
				// NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Flash plugin in plugin array
				var flashPlugin = navigator.plugins['Shockwave Flash'];
				if (typeof flashPlugin == 'object') { 
					 for (var i = flashDetect.latestFlashVersion; i >= 3; i--) {
						if (flashPlugin.description.indexOf(i + '.') != -1) {
						   flashVersion = i;
						   break;
						}
				 	}
				}				
			}		
			
			// IE4+ Win32:  attempt to create an ActiveX object using VBScript
			else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
			 var doc = '<scr' + 'ipt language="VBScript"\> \n';
			  doc += 'On Error Resume Next \n';
			  doc += 'Dim obFlash \n';
			  doc += 'For i = ' + latestFlashVersion + ' To 3 Step -1 \n';
			  doc += '   Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';
			  doc += '   If IsObject(obFlash) Then \n';
			  doc += '      ieFlashVersion = i \n';
			  doc += '      Exit For \n';
			  doc += '   End If \n';
			  doc += 'Next \n';
			  doc += '</scr' + 'ipt\> \n';
			  document.write(doc);
			}			  
			// WebTV 2.5 supports flash 3
			else if (agent.indexOf("webtv/2.5") != -1) {
			   flashVersion = 3;
			}		
			// older WebTV supports flash 2
			else if (agent.indexOf("webtv") != -1) {
			   flashVersion = 2;
			}		
			// Can't detect in all other cases
			else {
			  flashVersion = -1 // nepodarilo se zjistit verzi;
			}
			// pokud existuje window.ieFlashVersion - dekekovano pomoci VBscriptu (v IE)
			return (window.ieFlashVersion ? window.ieFlashVersion : flashVersion);
		}
		
	}
	
}
