/*CVS Add-ins*/
/*
$Revision: 1.10 $
$RCSfile: flashbehaviour.js,v $
author: JDE

*/

/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/*
    flashbehaviour.js 
    16.06.2008 JDE
*/
/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */


/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/*Copyright (c) A&B FACE2NET GmbH*/

/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */

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 = function(video_id, containerID) {
        if(this.hasRequiredFlashVersion()) {
        	swfobject.embedSWF(this.url.concat(video_id), containerID, this.width, this.height, reqVerStr);
        }else{
      	  this.writeErrorMessage(1);
        }
    }
		
		this.show= function(subdir,containerID, foren_id ) {
        if(this.hasRequiredFlashVersion()) {
				  var error_num = 3; //Fehlerhandling Startseite
				  if(subdir=="sub"){ 
						var flashdir="sub"; 
						var error_num = 2; 	//Fehlerhandling Unterseite				 					  
					}else{ 
						var flashdir="start"; 
						this.width = "834";
					}
					
					var attributes = {};
					var flashvars = {
					};
					var params = {
						menu: "false",
						scale: "noscale",
						base: "/_system/media/".concat(flashdir)
					};
					
					swfobject.embedSWF(this.url.concat(flashdir+"/header_forenbrowser.swf"), containerID, this.width, this.height, reqVerStr, false, flashvars, params, attributes);
        }else{
            this.writeErrorMessage(error_num);
        }
    }
    
    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 1: //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: //Unterseite
					break;
				case 3: //Startseite
					break;
				default: 
					break;
			}
    }
   
}

var flashPlayer = new flashplayer("http://www.youtube.com/v/","275","225","9.0.0");
var flashHeader = new flashplayer("/_system/media/","570","146","9.0.0");

