/*CVS Add-ins*/
/*
$Revision: 1.14 $
$RCSfile: flashbehaviour.js,v $
author: JDE
*/

/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/*
    flashbehaviour.js (BF)
    21.11.2008  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;
  var reqVer = new Array;
  this.requiredVer = reqVerStr.split(".");
  this.url = swfUrlStr; this.width = widthStr; this.height = heightStr;


  /* hasRequiredFlashVersion + + + + + + + + + + + + + + */
  this.hasRequiredFlashVersion = function( reqVer ) {
    reqVer.major = reqVer[0]!=null?parseInt(reqVer[0]):0;
    if(this.pluginVer.major < reqVer.major){ return false; }
    if(this.pluginVer.major > reqVer.major){ return true;  }

    reqVer.minor = reqVer[1]!=null?parseInt(reqVer[1]):0;
    if(this.pluginVer.minor < reqVer.minor) { return false; }

    if(this.pluginVer.minor > reqVer.minor) { return true;  }

    reqVer.release = reqVer[2]!=null?parseInt(reqVer[2]):0;
    if(this.pluginVer.release < reqVer.release) { return false; }
    return true;

  }


  /* embed_youtube + + + + + + + + + + + + + + */
  this.embed_youtube = function(video_id, containerID) {
    if(this.hasRequiredFlashVersion(this.requiredVer)) { 
      $("#flashimg_"+containerID.substring(containerID.lastIndexOf("_")+1)).remove();
      swfobject.embedSWF(this.url.concat(video_id), containerID, this.width, this.height, reqVerStr);
      general_flashparams = {};
    }else{
      this.writeErrorMessage('.youtube .basic_txt .nonscript','.youtube .errortxt');
    }
  }


  /* embed_video + + + + + + + + + + + + + + */
  this.embed_video = function(still_url, video_url, containerID) {
    if(this.hasRequiredFlashVersion(this.requiredVer)) {
      var still = "#flashimg_"+containerID.substring(containerID.lastIndexOf("_")+1);
      var video_w = this.width;
      var video_h = this.height;
      $(still +" img")
        .wrap('<a href="#thema" title="Video starten" class="block"></a>')
        .attr("alt", function() { return "Video starten: "+ String(this.alt); });
      $("#"+containerID).removeClass("teaserflash");
      $("#"+containerID+" *").remove();
      $(still+" *")
        .click( 
          function() { 
            click_video(still, containerID, video_url, video_w, video_h);
          }
         );
       $(still+" a")	
         .focus( 
            function() { 
              this.keypress( function() { click_video(still, containerID, video_url, video_w, video_h); } );
            }
           );
    }else{
      this.writeErrorMessage('.video .basic_txt .nonscript','.video .errortxt');
    }
  }


   /* embed_audio + + + + + + + + + + + + + + */
  this.embed_audio = function(still_url, audio_url, containerID) {
    if(this.hasRequiredFlashVersion(this.requiredVer)) {
      var still = "#flashimg_"+containerID.substring(containerID.lastIndexOf("_")+1);
      var video_w = this.width;
      var video_h = this.height;
      $(still +" img")
        .wrap('<a href="#thema" title="Video starten" class="block"></a>')
        .attr("alt", function() { return "Video starten: "+ String(this.alt); });
      $("#"+containerID).removeClass("teaserflash");
      $("#"+containerID+" *").remove();
      $(still+" *")
        .click( 
          function() { 
            click_video(still, containerID, audio_url, video_w, video_h);
          }
         );
       $(still+" a")	
         .focus( 
            function() { 
              this.keypress( function() { click_video(still, containerID, audio_url, video_w, video_h); } );
            }
           );
    }else{
      this.writeErrorMessage('.audio .basic_txt .nonscript','.audio .errortxt');
    }
  }


   /* embed_application + + + + + + + + + + + + + + */
/*this.embed_application = function(still_url, app_url, containerID) {
    if(this.hasRequiredFlashVersion()) {
      var still = "#flashimg_"+containerID.substring(containerID.lastIndexOf("_")+1);
      var app_w = this.width;
      var app_h = this.height;
      $(still +" img")
        .wrap('<a href="#thema" title="Video starten" class="block"></a>')
        .attr("alt", function() { return "Video starten: "+ String(this.alt); });
      $("#"+containerID).removeClass("teaserflash");
      $("#"+containerID+" *").remove();
      $(still+" *")
        .click( 
          function() { 
            click_app(still, containerID, app_url, app_w, app_h);
          }
         );
       $(still+" a")	
         .focus( 
            function() { 
              this.keypress( function() { click_video(still, containerID, app_url, app_w, app_h); } );
            }
           );
    }else{
      this.writeErrorMessage('.pano .basic_txt .nonscript','.pano .errortxt');
    }
  }*/


  /* embed_movingimage + + + + + + + + + + + + + + */
   this.embed_movingimage = function(still_url, script_url, containerID) {
   var reqVerStr2 = '8.0.0';
   reqVer = reqVerStr2.split(".");
   
   if(this.hasRequiredFlashVersion(reqVer)) {
      var still = "#flashimg_"+containerID.substring(containerID.lastIndexOf("_")+1);

      $(still +" img")
        .wrap('<a href="#thema" title="Video starten" class="block"></a>')
        .attr("alt", function() { return "Video starten: "+ String(this.alt); });

      $("#"+containerID).removeClass("teaserflash");
      $("#"+containerID+" *").remove();

      $(still+" *")
        .click( 
          function() { 
           click_movingimage(still, containerID, script_url);
          }
         );

       $(still+" a")	
         .focus( 
            function() { 
              this.keypress( function() { click_movingimage(still, containerID, script_url); } );
            }
           );

    }else{
      this.writeErrorMessage('.movingimage .basic_txt .nonscript','.movingimage .errortxt');
    }
  }


  /* click_video + + + + + + + + + + + + + + */
  click_video = function(still, containerID, video_url, video_w, video_h) {
    $(still).remove();
    var flashparams = {};
    flashparams.allowFullScreen="true";
    flashparams.scale="noscale";
    flashparams.base="/start/_system/media";
    flashparams.flashvars = "normColor=ffffff&loaderColor=dadada&specialColor=FFDB00&backGroundColor=000000&fullSrceenSpecialColor=ffffff&autoplay=false&allowSmoothing=true&videoURL="+video_url;
    swfobject.embedSWF(swfUrlStr, containerID, video_w, video_h, reqVerStr, false, false , flashparams, false);
  }


  /* click_app + + + + + + + + + + + + + + */
/*click_app = function(still, containerID, app_url, app_w, app_h) {
    $(still).remove();
    var flashparams = {};
    flashparams.allowFullScreen="true";
    flashparams.base="/start/_system/media/pano/";
    flashparams.flashvars = "pano=pano.xml";
    swfobject.embedSWF(app_url, containerID, app_w, app_h, reqVerStr, false, false , flashparams, false);
  }*/


  /* click_movingimage + + + + + + + + + + + + + + */
  click_movingimage = function(still, containerID, script_url) {
    $(still).remove();
    $('#'+containerID).append(
      '<div class="frame"><div>'+
      '<p><a class="framelink" target="_blank" title="&ouml;ffnet sich in neuem Fenster" href="'+script_url+'">externes Video direkt aufrufen</a></p>'+
      '<iframe name="video'+containerID+'" title="externes Video" frameborder="0" scrolling="no" height="377" width="580" src="'+script_url+'"> </iframe>'+
      '</div></div>');
  }


      /* writeErrorMessage + + + + + + + + + + + + + + */
  this.writeErrorMessage = function(removetext,errortext) {
    $(removetext).remove();
    if (this.pluginVer.major != 0 || this.pluginVer.minor != 0 || this.pluginVer.release != 0) {
      $(errortext).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{
      $(errortext).html("Sie haben keinen Adobe&reg; Flashplayer installiert oder er ist deaktiviert. Die aktuelle Version ");
    }
  }


}


/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
var flashPlayer = new flashplayer("/start/_system/media/videoplayer.swf","580","327","9.0.115");

