/*
Based on Carl S. Yestrau 's FlashDetect
Code By Adam Paller (c) 2008
*/


/*
Copyright (c) Copyright (c) 2007, Carl S. Yestrau All rights reserved.
Code licensed under the BSD License: http://www.featureblend.com/license.txt
Version: 1.0.2
*/

var VERSION=8;

function checkfv(){

	var FlashDetect = new function(){
		var self = this;
		self.installed = false;
		self.major = -1;
		self.minor = -1;
		self.revision = -1;
		self.revisionStr = "";
		self.activeXVersion = "";
		var activeXDetectRules = [
			{
				"name":"ShockwaveFlash.ShockwaveFlash.7",
				"version":function(obj){
					return getActiveXVersion(obj);
				}
			},
			{
				"name":"ShockwaveFlash.ShockwaveFlash.6",
				"version":function(obj){
					var version = "6,0,21";
					try{
						obj.AllowScriptAccess = "always";
						version = getActiveXVersion(obj);
					}catch(err){}
					return version;
				}
			},
			{
				"name":"ShockwaveFlash.ShockwaveFlash",
				"version":function(obj){
					return getActiveXVersion(obj);
				}
			}
		];
		var getActiveXVersion = function(activeXObj){
			var version = -1;
			try{
				version = activeXObj.GetVariable("$version");
			}catch(err){}
			return version;
		};
		var getActiveXObject = function(name){
			var obj = -1;
			try{
				obj = new ActiveXObject(name);
			}catch(err){}
			return obj;
		};
		var parseActiveXVersion = function(str){
			var versionArray = str.split(",");//replace with regex
			return {
				"major":parseInt(versionArray[0].split(" ")[1], 10),
				"minor":parseInt(versionArray[1], 10),
				"revision":parseInt(versionArray[2], 10),
				"revisionStr":versionArray[2]
			};
		};
		var parseRevisionStrToInt = function(str){
			return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision;
		};
		self.majorAtLeast = function(version){
			return self.major >= version;
		};
		self.FlashDetect = function(){
			if(navigator.plugins && navigator.plugins.length>0){
				var type = 'application/x-shockwave-flash';
				var mimeTypes = navigator.mimeTypes;
				if(mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description){
					var desc = mimeTypes[type].enabledPlugin.description;
					var descParts = desc.split(' ');//replace with regex
					var majorMinor = descParts[2].split('.');
					self.major = parseInt(majorMinor[0], 10);
					self.minor = parseInt(majorMinor[1], 10); 
					self.revisionStr = descParts[3];
					self.revision = parseRevisionStrToInt(self.revisionStr);
					self.installed = true;
				}
			}else if(navigator.appVersion.indexOf("Mac")==-1 && window.execScript){
				var version = -1;
				for(var i=0; i<activeXDetectRules.length && version==-1; i++){
					var obj = getActiveXObject(activeXDetectRules[i].name);
					if(typeof obj == "object"){
						self.installed = true;
						version = activeXDetectRules[i].version(obj);
						if(version!=-1){
							var versionObj = parseActiveXVersion(version);
							self.major = versionObj.major;
							self.minor = versionObj.minor; 
							self.revision = versionObj.revision;
							self.revisionStr = versionObj.revisionStr;
							self.activeXVersion = version;
						}
					}
				}
			}
		}();
	};

	if(document.cookie.indexOf('flashchecked')==-1){
		if(FlashDetect.majorAtLeast(VERSION)==false){
		
			wait_=50;
				
			var abox=document.createElement('DIV');
			with(abox.style){
				position='absolute'; width='320px'; height='120px'; border='2px solid #fff'; top='220px'; left='100px';
				fontFamily='arial,helvetica,sans-serif'; fontSize='12px'; color='#BBDF29';
			}
			abox.innerHTML=	'<span style="position:absolute;display:block;width:100%;height:120px;top:0px;left:0px;'+
							'background:#000;opacity:0.8;filter:alpha(opacity=80);"></span>'+
							'<div style="position:absolute;font-size:11px;padding:2px 3px 2px 3px;background:#fff;color:#000;'+
							'top:-2px;left:-2px;cursor:pointer;z-index:1000" onclick="this.parentNode.style.display=\'none\'">Bezárás'+
							'<div id="fvpb" style="position:absolute;bottom:0px;left:45px;height:2px;width:0px;'+
							'overflow:hidden;background:#fff"></div></div>'+
							'<div style="position:relative;top:20px;margin:10px;line-height:16px;">'+
							'Az Ön gépén található Flash lejátszó verziója valószinüleg nem a legfrissebb! Ez '+
							'befolyásolhatja az oldal egyes tartalmi elemeinek megjelenítését. <br/><br/>'+
							'A legfrissebb verziót innen telepítheti : <a href="http://www.adobe.com/shockwave/download/'+			
							'download.cgi?P1_Prod_Version=ShockwaveFlash" style="color:#6E61DF;text-decoration:none;'+
							'font-weight:bold">ADOBE.COM</a></div>';
			
			document.body.appendChild(abox);
			
			var fvpb=getId('fvpb');
			fvpb.w=window.setInterval(function(){
				fvpb.offsetWidth<280 ? fvpb.style.width=fvpb.offsetWidth+1+'px' : fvpb.w=window.clearInterval(fvpb.w);
				fvpb.offsetWidth==280 ? fvpb.parentNode.parentNode.style.display='none' : false;
			},wait_);
		}
	}

	var date = new Date(); date.setTime(date.getTime()+31536000000); var expires=date.toGMTString(); 
	document.cookie='flashchecked; expires='+expires+'; path=/;';
}


    

