﻿/*CVS Add-ins*/
/*
$Revision: 1.2 $
$RCSfile: flashbehaviour.js,v $
author: JDE
*/

/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/*
    flashbehaviour.js 
    15.01.2009 JDE
*/
/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */

/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/*Copyright (c) A&B FACE2NET GmbH*/

function check(){ alert("JS eingebunden"); }

if (typeof flashplayer == "undefined") { 
    var flashplayer = new Object(); 
}



flashplayer = function(swfUrlStr, widthStr, heightStr, reqVerStr) {
    
    this.pluginVer = swfobject.getFlashPlayerVersion();
    var requiredVer = new Array;
    this.requiredVer = reqVerStr.split(".");
    this.url = swfUrlStr; 
    this.width = widthStr;
    this.height = heightStr;
    
    this.embed_youtube = function(video_id, containerID) {
        if(this.hasRequiredFlashVersion()) {
        	swfobject.embedSWF(this.url.concat(video_id), containerID, this.width, this.height, reqVerStr);
        }else{
      	  this.writeErrorMessage(0);
        }
    }
		
		this.embed_spdtv = function(video_id, containerID) {
        if(this.hasRequiredFlashVersion()) {
        	
        }else{
      	  this.writeErrorMessage(1);
        }
    }
		    
    this.hasRequiredFlashVersion = function() {
        this.requiredVer.major = this.requiredVer[0]!=null?parseInt(this.requiredVer[0]):0;
        if(this.pluginVer.major < this.requiredVer.major){ return false; }
        if(this.pluginVer.major > this.requiredVer.major){ return true;  }
        
        this.requiredVer.minor = this.requiredVer[1]!=null?parseInt(this.requiredVer[1]):0;
        if(this.pluginVer.minor < this.requiredVer.minor) { return false; }
        
        if(this.pluginVer.minor > this.requiredVer.minor) { return true;  }
        
        this.requiredVer.release = this.requiredVer[2]!=null?parseInt(this.requiredVer[2]):0;
        if(this.pluginVer.release < this.requiredVer.release) { return false; }
        return true;
        
    }
    
    this.writeErrorMessage = function(n) {
			switch(n) { 
				case 0: //Youtube   		
        	$(".youtube .basic_txt").remove();
         	if (this.pluginVer.major != 0 || this.pluginVer.minor != 0 || this.pluginVer.rev != 0) {
          	$(".youtube .errortxt").html("Sie haben den Adobe&reg; Flashplayer in der Version " + this.pluginVer.major + "." + this.pluginVer.minor + "." + this.pluginVer.release + ". Bitte aktualisieren Sie ihn. Die aktuelle Version");
         	}else{
          	$(".youtube .errortxt").html("Sie haben keinen Adobe&reg; Flashplayer installiert oder er ist deaktiviert. Die aktuelle Version");
         	}
				 	break;
				case 2: //SPD.tv
					break;
				default: 
					break;
			}
    }
   
}

var flashPlayer = new flashplayer("http://www.youtube.com/v/","327","266","9.0.0");

