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

/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/*
    flashbehaviour.js 
    03.06.2009 JDE
*/
/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */

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

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

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

flashobj = 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.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.release != 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");
				}//else
				break;
			
				default: 
				break;
		}//switch
	}//writeErrorMessage
	
}//flashplayer

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

