var flowPlayerSrc={
    player:"flowplayer/flowplayer.commercial-3.2.5.swf",
    js1:"flowplayer/flowplayer-3.2.4.js",
    js2:"flowplayer/flowplayer.controls-3.0.2.js",
    google:"flowplayer/flowplayer.analytics-3.2.1.swf",
    debug:false
}

 
var flowPlayerSrcOld={
    player:"flowplayer/flowplayer.commercial-3.1.0.swf",
    js1:"flowplayer/flowplayer-3.1.0.min.js",
    js2:"flowplayer/flowplayer_api_3.1.0_NEW.js",
    google:false,//"flowplayer/flowplayer.analytics-3.2.1.swf",
    debug:true
}

 
                    
var html5player=Class.create({
       index:0,
       initialize: function() 
        {
              
        	this.options = Object.extend({
        	       renderTo:document.body,
        	       playlist:[{url:'404.mp4'}],
                   onError:function(){},
                   onPause:function(){},
                   onPlay:function(){}
                }, arguments[0] || { });
                
               this.render();
               this.video.src=this.options.playlist[this.index].url;
               this.video.observe("ended",function(){
                     try{ this.options.playlist[this.index].onFinish();
                     }catch(x){}
                    
                     this.next();
                 }.bind(this));
                    this.video.observe("playing",function(){
                    try{
                    this.options.playlist[this.index].onBegin();
                    }catch(x){ throw(x) }
                    }.bind(this));
                 
            return(this);
        },
        render:function(){
                            this.video = new Element("video",{"style":"position:absolute;z-index:990;background:#fff;width:100%;height:100%;"});
                            $(this.options.renderTo).insert(this.video);
                            this.video.autoplay=false;
                           
                            this.video.observe('canplay',function(){  this.video.controls=true; }.bind(this));
                            this.video.observe('pause',this.options.onPause);
                            this.video.observe('play',this.options.onPlay);
                            this.video.observe('error',function(e){
                                        this.pause();
                                        this.options.onError(e);
                                        this.next();
                                    }.bind(this));
                            
        },
        play:function(){
           this.video.controls=true;this.options.onPlay();
            this.video.play();
        },
        pause:function(){
        this.video.controls=false;
        this.options.onPause();
        this.video.pause();
        },
        next:function()
        {
            this.index++;
            if(typeof this.options.playlist[this.index]=="object")
            {
                 if( typeof this.options.playlist[this.index].onBegin=="function")
                 {
                    this.video.observe("playing", this.options.playlist[this.index].onBegin );
                 }
                
                this.video.observe("ended",function(){
                      if( typeof this.options.playlist[this.index].onFinish=="function")
                     {
                        this.options.playlist[this.index].onFinish();
                     }
                     this.next();
                 }.bind(this));
                 
                
                this.video.src=this.options.playlist[this.index].url;
                try{if(this.options.playlist[this.index].autoPlay){this.video.play();}}catch(x){}
            }
            else
            {
            this.options.onPause();
            }
        }
});

var ExpertPlayer=Class.create({
        debug:false,
        path:(function () { var js = /ExpertPlayer\.js(\?.*)?$/; return $$('head script[src]').findAll(function(s) { return s.src.match(js);})[0].src.replace(js,"")})(),
        include:function(mod)
        {
            document.write('<script type="text/javascript" src="'+this.path+mod+'"><\/script>');
            
        },
        index:0,
        paused:true,
/*!!!*/ flash:true,
        preroll:false,
        moviePlayed:false,
        stat:[],
       	initialize: function() 
        {
              
        	this.options = Object.extend({
        	       contentID:"12345",
        	       siteId:"666",
        	       cookieName:"expertad",
        	       renderTo:document.body,
        	       className:"ExpertVideo",
        	       img:this.path+"img/splash.png",
        	       width:500,
        	       height:280,
        	       getAdMethod:'POST',
        	       files:[],
        	       urls:false,
        	       /*urls:{
        	           getAd:this.path+"ad.json",
        	           adShown:"errorAdress",
        	           adClicked:"errorAdress"
        	       },*/
        	       autostart:false,
        	       showContrlosOnAd:false
                }, arguments[0] || { });
                this.files=this.options.files;
                this.flash=FlashDetect.installed;
                if(this.flash)
                {
                    //document.write('<link rel="stylesheet" type="text/css" href="'+this.path+'flowplayer/controls-hulu.css"/>	');
                    this.include(flowPlayerSrc.js1);
                    this.include(flowPlayerSrc.js2);
                }
                this.stat=this.readCookieObject(this.options.cookieName);
                this.playlist=[];
                this.files.each(function(f){
                    this.playlist.push({
                    url:f,
                    autoPlay:false,
                    scaling:"fit",
                    onBegin:function(){ if(this.flash){new Effect.BlindDown(this.controls);}}.bind(this)
                    });
                }.bind(this));
                this.badAd=false;
                this.flag=false;
                document.observe("dom:loaded", function() {
              //  try{ this.createPlayList(); }catch(x){ }
                    this.render();
                //    if(this.badAd){ (function(){ this.createPlayer();$(this.options.renderTo).show();}.bind(this)).delay(1);
                   // }
                }.bind(this));
                
        },
        __play:function(){
        if(!this.player){this.createPlayer();$(this.options.renderTo).show();}
        this.moviePlayed=false;this.paused=false;this.zIndex();
            this._play();
        },
        play:function(){
        if(this.flag)
        {
            this.__play();
           
         }
         else
         {
            this.flag=true;
             try{ this.createPlayList(); }catch(x){ }
             if(this.badAd){ (function(){ this.createPlayer();$(this.options.renderTo).show();this.__play();}.bind(this)).delay(1);}
            
         }
        
        },
        zIndex:function()
        {
        
            if(this.paused)
            {
                this.playerContainer.style.zIndex=990;
                if(this.moviePlayed)
                {
                this.image.style.zIndex=989;
                }
                
            }
            else
            {
                this.loadingstop();
                this.playerContainer.style.zIndex=994;          
            }
        },
        render:function()
        {
            
            this.container = new Element("div",{'class':this.options.className,style:"width:"+this.options.width+"px;height:"+this.options.height+"px;float:left;overflow:hidden;padding:-1px;"});
            $(this.options.renderTo).insert(this.container);
            
            this.playerContainer= new Element("div",{'class':this.options.className+"PlayerContainer",style:"position:absolute;z-index:990;width:"+this.options.width+"px;height:"+this.options.height+"px;"});
            this.container.insert(this.playerContainer);
            this.image= new Element("div",{style:"position:absolute;z-index:991;width:"+this.options.width+"px;height:"+this.options.height+"px;background:url("+this.options.img+") no-repeat center;"});
            this.container.insert(this.image);
            
            this.mask= new Element("div",{style:"position:absolute;z-index:992; background:#000;width:"+this.options.width+"px;height:"+this.options.height+"px;opacity:0.7; filter:Alpha(opacity=70); "});
            this.container.insert(this.mask);
            
            this.clicka= new Element("a",{href:'http://expert.ru',target:'_blank',style:"position:absolute;z-index:991; background:#000;width:"+this.options.width+"px;height:"+this.options.height+"px;opacity:0; filter:Alpha(opacity=0); "});
            this.container.insert(this.clicka);
            this.clicka.observe("click",this.adClicked.bind(this));
            this.playButton = new Element("div",{
                                                'class':this.options.className+"playButton",
                                                style:"cursor:pointer;background:url("+this.path+"img/play.png) center no-repeat;opacity:0.9;position:absolute;z-index:993;width:"+(this.options.width/3)+"px;height:"+(this.options.height/3)+"px; margin-top:"+(this.options.height/3)+"px; margin-left:"+(this.options.width/3)+"px; filter:'Alpha(opacity=90)';"
                                                });
            this.container.insert(this.playButton);
            this.playButton.observe('click',function(){
                if(this.paused)
                {
                    this.play();
                }
                else
                {
                     this.pause();
                }
            }.bind(this));  
             if(0&&this.flash)
                {
            this.controls= new Element("div",{'class':'hulu',style:'position:absolute;z-index:994; '});
            $(this.options.renderTo).insert(this.controls); 
            this.controls.update('<a class="play">play</a><div class="track"><div class="buffer" style="width: 183px; "></div><div class="progress"></div><div class="playhead"></div></div><div class="time"><span>00:00</span> <strong>00:25</strong></div><a class="mute">mute</a>');  
            this.controls.clonePosition(this.container,{setHeight:false,offsetTop:this.container.getHeight()});
            this.container.style.marginBottom=this.controls.getHeight()+"px";
            }
            
           // $(this.options.renderTo).hide();
        },
        Prerolls:[],
        Postrolls:[],
        getPreroll:function(ind){
            
            if (typeof this.options.urls!= "object" || typeof this.options.urls.getAd != "string"){  this.badAd=true; return; }
            var hour={};
            var day={};
            var week={};
            var month={};
            this.stat.each(function(o){
                    hour[o.id]=o.counters.hour;
                    day[o.id]=o.counters.day;
                    week[o.id]=o.counters.week;
                    month[o.id]=o.counters.month;
                }.bind(this));
            var hour2={};
            var day2={};
            var week2={};
            var month2={};
            this.stat.each(function(o){
                    hour2[o.order_id]=o.counters.hour;
                    day2[o.order_id]=o.counters.day;
                    week2[o.order_id]=o.counters.week;
                    month2[o.order_id]=o.counters.month;
                }.bind(this));
            var dat='["'+this.options.contentID+'",{"bandwidth":500,"site":'+this.options.siteId+',"previous_videos":{"day":'+Object.toJSON(day)+',"month":'+Object.toJSON(month)+',"hour":'+Object.toJSON(hour)+',"week":'+Object.toJSON(week)+'},"previous_orders":{"day":'+Object.toJSON(day2)+',"month":'+Object.toJSON(month2)+',"hour":'+Object.toJSON(hour2)+',"week":'+Object.toJSON(week2)+'}}]';
             new Ajax.Request(this.options.urls.getAd, { 
                        method: this.options.getAdMethod, 
                        parameters: {
                                params:dat,
                                method:"da.content.get_adv"
                                },
                                onFailure:function(){
                                this.createPlayer();$(this.options.renderTo).show();
                                },
                        on200: function(transport)
                        {
                         
                          try{ var re=transport.responseText.evalJSON(true).result; }catch(x){ this.createPlayer();$(this.options.renderTo).show();this.__play();return; }
                          
                          if(typeof re != "object" || re == null){
                          this.createPlayer();$(this.options.renderTo).show();return;
                          }
                          
                          for (var i = 0; i < re.length; i++)
                          {
                            if(re[i].type=="preroll")
                            {
                                var res=re[i];
                            }
                            if(re[i].type=="postroll")
                            {
                                var res1=re[i];
                            }
                          }
                          var src=false;
                          var src1=false;
                          try{
                          if(!this.flash)
                          {
                              for (var i = 0; i < res.files.length; i++) 
                                {
                                        if(res.files[i].content_format=="iPad")
                                        {
                                            src=res.files[i].url;
                                        }
                                }
                                for (var i = 0; i < res1.files.length; i++) 
                                {
                                        if(res1.files[i].content_format=="iPad")
                                        {
                                            src1=res1.files[i].url;
                                        }
                                }
                            }
                            else
                            {
                                for (var i = 0; i < res.files.length; i++) 
                               {
                                       if(res.files[i].content_format=="FLV-lo")
                                       {
                                           src=res.files[i].url;
                                       }
                               }
                               for (var i = 0; i < res1.files.length; i++) 
                               {
                                       if(res1.files[i].content_format=="FLV-lo")
                                       {
                                           src1=res1.files[i].url;
                                       }
                               }
                            }
                            }catch(x){}
                           if(src)
                           {
                               this.Prerolls[ind]={
                                    url:src,
                                    duration:res.duration,
                                    hr:res['link'],
                                    id:res.id,
                                    order_id:res.order_id,
                                    pixel:res.px_audit
                                    };
                                   
                            }
                           if(src1)
                           {
                               this.Postrolls[ind]={
                                    url:src1,
                                    duration:res1.duration,
                                    hr:res1['link'],
                                    id:res1.id,
                                    order_id:res1.order_id,
                                    pixel:res1.px_audit
                                    };
                            }
                                
                                 this.addAd();
                                 this.createPlayer();
                                $(this.options.renderTo).show();
                                this.__play();
                            }.bind(this)
                    });
                   
        },
        createPlayList:function()
        {
            for (var i = 0; i < this.files.length; i++) 
            {
                this.getPreroll(i);
            }
        },
        addAd:function()
        {
            this.playlist=[];
            for (var i = 0; i < this.files.length; i++) 
            {
                if( typeof this.Prerolls[i] != "undefined")
                {
                        eval('var pr={url:"'+this.Prerolls[i].url+'",scaling:"fit",autoPlay:'+((i==0)?"false":"true")+''+((this.Prerolls[i].duration>1)?",duration:"+this.Prerolls[i].duration:"1")+', linkWindow:"_blank",onFinish:function(){ this.clicka.href="http://expert.ru";this.clicka.style.zIndex=991;}.bind(this),onBegin:function(){ this.advId="'+this.Prerolls[i].id+'";  this.adShown("'+this.Prerolls[i].id+'","'+this.Prerolls[i].pixel+'","'+this.Prerolls[i].order_id+'");if(this.flash){ this.player.getPlugin("controls").hide(); }; this.clicka.href="'+this.Prerolls[i].hr+'";this.clicka.style.zIndex=999;}.bind(this)};');
                        this.playlist.push(pr);
                }
                var c={
                            url:this.files[i],
                            autoPlay:true,
                            scaling:"fit",
                            autoBuffering:true,
                            onBegin:function(){ if(this.flash){ $f().getPlugin("controls").show(); }}.bind(this)
               };
                this.playlist.push(c);
                if( typeof this.Postrolls[i] != "undefined")
                        {
                                        eval('var pr={url:"'+this.Postrolls[i].url+'",scaling:"fit",autoPlay:true '+((this.Postrolls[i].duration>1)?",duration:"+this.Postrolls[i].duration:"1")+', linkWindow:"_blank",onLastSecond:function(){this.moviePlayed=false;this.paused=true; this.zIndex(); try{this.clicka.href="http://expert.ru";this.clicka.style.zIndex=991;}catch(x){ }}.bind(this),onBegin:function(){ this.advId="'+this.Postrolls[i].id+'";  this.adShown("'+this.Postrolls[i].id+'","'+this.Postrolls[i].pixel+'","'+this.Postrolls[i].order_id+'");if(this.flash){ this.player.getPlugin("controls").hide(); }; this.clicka.href="'+this.Postrolls[i].hr+'";this.clicka.style.zIndex=999;}.bind(this)};');
                                        this.playlist.push(pr);
                                        
                        }
                        
			}
		      
		      top.videosrcstr=this.playlist.toJSON();
		
        },
        advId:"not setted",
        adShown:function(id,pix,order_id){
            if(typeof this.options.urls.adShown=="undefined"){return;}
        	       new Ajax.Request(this.options.urls.adShown, { 
        	                   method: 'post', 
        	                   parameters: {
                                params:'['+this.options.contentID+','+id+',{"site":'+this.options.siteId+'}]',
                                method:"da.content.adv_watched"
                                }, 
        	                   onSuccess: function(transport) {} 
        	                   });
        	        if( pix != null && pix !="null" ){    
        	           
        	       var pixelaudit = new Image();
        	       pixelaudit .src=pix;
                        }
            var now = new Date();
            var test=false;
            for (var i = 0; i < this.stat.length; i++) 
            {
                if(this.stat[i].id==id)
                {
                    test=true;
                    var lshDate=new Date(this.stat[i].last_shown_at);
                    
                    this.stat[i].last_shown_at=now.getTime();
                    
                    if(now.getMonth()==lshDate.getMonth())
                    {
                        this.stat[i].counters.month++;
                            if(now.getDate()==lshDate.getDate())
                            {
                                this.stat[i].counters.day++;
                            }
                         if(now.getHours() ==lshDate.getHours())
                        {
                            this.stat[i].counters.hour++;
                        }
                        if(now.getDate()<=lshDate.getDate()+7 )
                        {
                            this.stat[i].counters.week++;
                        }
                        
                    }
                }
            }
           
           if(!test)
           {
           var t=now.getTime();
                this.stat.push({
                    id:id,
                    order_id:order_id,
                    last_shown_at:t,
                      counters: {
                            hour:1,
                            day:1,
                            week:1,
                            month:1}
                });
           }            
            
            this.writeCookieObject(this.stat,this.options.cookieName,365);
        	       
        },
        adClicked:function(){
        
            if(typeof this.options.urls.adClicked=="undefined"){return;}
                new Ajax.Request(this.options.urls.adClicked, { 
        	                   method: 'post', 
        	                   parameters:{
                                params:'['+this.options.contentID+','+this.advId+',{"site":'+this.options.siteId+'}]',
                                method:"da.content.adv_clicked"
                                }, 
        	                   onSuccess: function(transport) {} 
        	                   });
        },
        createPlayer:function()
        {
         
            if(this.flash)
            {
                if(flowPlayerSrc.google){
                var plug={
                		
                		gatracker: {
                			url: this.path+flowPlayerSrc.google,
                			labels: {
                				start: "Start",	
                				play: "Play",	
                				pause: "Pause",	
                				resume: "Resume",	
                				seek: "Seek",	
                				stop: "Stop",	
                				finish: "Finish",	
                				mute: "Mute",	
                				unmute: "Unmute",	
                				fullscreen: "Full Screen",	
                				fullscreenexit: "Full Screen Exit"	
                			},
                			debug: flowPlayerSrc.debug,
                			trackingMode: "AS3",
                			googleId: "UA-274162-13" // your Google Analytics id here
                		}
                		
	               }
                }
                else
                {
                var plug={}
                }
                this.player = $f(this.playerContainer.identify(), this.path+flowPlayerSrc.player,{
               
                plugins:plug,/**/
                key:"#$24cf90f721b72ddc379",
                logo:{
                    
                },
                play: {
                url:this.path+"img/play.png",
		width: 1,
		height: 1
                },
                contextMenu: [
/*
	// 1. "About Flowplayer...";  selecting this item goes to our homepage
	{'Expert' : function() {
		location.href = "http://expert.ru";
	}}*/
            ],
            buffering :true,
            showErrors: false,
                onError:function(a,b){
                    //this.player.play(this.files);
                }.bind(this),
                
                    onPause:function(){
                       this.moviePlayed=true;
                       this.paused=true;
                       this.zIndex();
                        }.bind(this),
                        playlist:this.playlist,
                        scaling:'fit',
                        canvas: {

	// use a wicked backgound color
	//backgroundImage:this.options.img,
	backgroundColor: '#ffffff'}
	                   })
	                 
            }
            else
            {
                   this.player = new html5player({
                                renderTo:this.playerContainer,
                                playlist:this.playlist,
                                onError:function(e){
                                     if(this.debug){  switch (e.target.error.code) {
                 case e.target.error.MEDIA_ERR_ABORTED:
                   alert('You aborted the video playback.');
                   break;
                 case e.target.error.MEDIA_ERR_NETWORK:
                   alert('A network error caused the video download to fail part-way.');
                   break;
                 case e.target.error.MEDIA_ERR_DECODE:
                   alert('The video playback was aborted due to a corruption problem or because the video used features your browser did not support.');
                   break;
                 case e.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:
                   alert('The video could not be loaded, either because the server or network failed or because the format is not supported.'+e.target.src);
                   break;
                 default:
                   alert('An unknown error occurred.');
                   break;
                }
                }
                                    }.bind(this)
                        });
            }
        },
        pause:function(){
        this.moviePlayed=true;this.paused=true;this.zIndex();
        this.player.pause();
        },
        _play:function(i)
        {
            if(typeof i == "number"){this.index=i;this.moviePlayed=false;}
            this.paused=false;
           this.loadingstop();
           this.player.play();            
        },
        loadingstart:function()
        {
            this.mask.style.background="#000 url("+this.path+"img/loading.gif) center no-repeat";
        },
        loadingstop:function()
        {
            this.mask.style.background="#000";
        },
        createCookie:function(name,value,days) 
        {
        	if (days) {
        		var date = new Date();
        		date.setTime(date.getTime()+(days*24*60*60*1000));
        		var expires = "; expires="+date.toGMTString();
        	}
        	else var expires = "";
        	document.cookie = name+"="+value+expires+"; path=/";
    },
    readCookie:function(name) 
    {
        	var nameEQ = name + "=";
        	var ca = document.cookie.split(';');
        	for(var i=0;i < ca.length;i++) {
        		var c = ca[i];
        		while (c.charAt(0)==' ') c = c.substring(1,c.length);
        		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
        	}
        	return null;
    },
    eraseCookie:function(name) 
    {
	   this.createCookie(name,"",-1);
    },
    readCookieObject:function(name)
    {
            try{
                
                return (this.readCookie(name).evalJSON());
            }
            catch(e)
            {
                var o=[];return (o);
            }
    },
    writeCookieObject:function(obj,name,days)
    {
          if(!days){days=365;}
            try{
                this.createCookie(name,obj.toJSON(),days);
                return true;
            }
            catch(e)
            {
                return false;
            }
    }

        
        
        
});   
   
   
   
   
  /*
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.4
*/
var FlashDetect = new function(){
    var self = this;
    self.installed = false;
    self.raw = "";
    self.major = -1;
    self.minor = -1;
    self.revision = -1;
    self.revisionStr = "";
    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);
            }
        }
    ];
    /**
     * Extract the ActiveX version of the plugin.
     * 
     * @param {Object} The flash ActiveX object.
     * @type String
     */
    var getActiveXVersion = function(activeXObj){
        var version = -1;
        try{
            version = activeXObj.GetVariable("$version");
        }catch(err){}
        return version;
    };
    /**
     * Try and retrieve an ActiveX object having a specified name.
     * 
     * @param {String} name The ActiveX object name lookup.
     * @return One of ActiveX object or a simple object having an attribute of activeXError with a value of true.
     * @type Object
     */
    var getActiveXObject = function(name){
        var obj = -1;
        try{
            obj = new ActiveXObject(name);
        }catch(err){
            obj = {activeXError:true};
        }
        return obj;
    };
    /**
     * Parse an ActiveX $version string into an object.
     * 
     * @param {String} str The ActiveX Object GetVariable($version) return value. 
     * @return An object having raw, major, minor, revision and revisionStr attributes.
     * @type Object
     */
    var parseActiveXVersion = function(str){
        var versionArray = str.split(",");//replace with regex
        return {
            "raw":str,
            "major":parseInt(versionArray[0].split(" ")[1], 10),
            "minor":parseInt(versionArray[1], 10),
            "revision":parseInt(versionArray[2], 10),
            "revisionStr":versionArray[2]
        };
    };
    /**
     * Parse a standard enabledPlugin.description into an object.
     * 
     * @param {String} str The enabledPlugin.description value.
     * @return An object having raw, major, minor, revision and revisionStr attributes.
     * @type Object
     */
    var parseStandardVersion = function(str){
        var descParts = str.split(/ +/);
        var majorMinor = descParts[2].split(/\./);
        var revisionStr = descParts[3];
        return {
            "raw":str,
            "major":parseInt(majorMinor[0], 10),
            "minor":parseInt(majorMinor[1], 10), 
            "revisionStr":revisionStr,
            "revision":parseRevisionStrToInt(revisionStr)
        };
    };
    /**
     * Parse the plugin revision string into an integer.
     * 
     * @param {String} The revision in string format.
     * @type Number
     */
    var parseRevisionStrToInt = function(str){
        return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision;
    };
    /**
     * Is the major version greater than or equal to a specified version.
     * 
     * @param {Number} version The minimum required major version.
     * @type Boolean
     */
    self.majorAtLeast = function(version){
        return self.major >= version;
    };
    /**
     * Is the minor version greater than or equal to a specified version.
     * 
     * @param {Number} version The minimum required minor version.
     * @type Boolean
     */
    self.minorAtLeast = function(version){
        return self.minor >= version;
    };
    /**
     * Is the revision version greater than or equal to a specified version.
     * 
     * @param {Number} version The minimum required revision version.
     * @type Boolean
     */
    self.revisionAtLeast = function(version){
        return self.revision >= version;
    };
    /**
     * Is the version greater than or equal to a specified major, minor and revision.
     * 
     * @param {Number} major The minimum required major version.
     * @param {Number} (Optional) minor The minimum required minor version.
     * @param {Number} (Optional) revision The minimum required revision version.
     * @type Boolean
     */
    self.versionAtLeast = function(major){
        var properties = [self.major, self.minor, self.revision];
        var len = Math.min(properties.length, arguments.length);
        for(i=0; i<len; i++){
            if(properties[i]>=arguments[i]){
                if(i+1<len && properties[i]==arguments[i]){
                    continue;
                }else{
                    return true;
                }
            }else{
                return false;
            }
        }
    };
    /**
     * Constructor, sets raw, major, minor, revisionStr, revision and installed public properties.
     */
    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 version = mimeTypes[type].enabledPlugin.description;
                var versionObj = parseStandardVersion(version);
                self.raw = versionObj.raw;
                self.major = versionObj.major;
                self.minor = versionObj.minor; 
                self.revisionStr = versionObj.revisionStr;
                self.revision = versionObj.revision;
                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(!obj.activeXError){
                    self.installed = true;
                    version = activeXDetectRules[i].version(obj);
                    if(version!=-1){
                        var versionObj = parseActiveXVersion(version);
                        self.raw = versionObj.raw;
                        self.major = versionObj.major;
                        self.minor = versionObj.minor; 
                        self.revision = versionObj.revision;
                        self.revisionStr = versionObj.revisionStr;
                    }
                }
            }
        }
    }();
};
FlashDetect.JS_RELEASE = "1.0.4";              