/*CVS Add-ins*/
/*
$Revision: 1.18 $
$RCSfile: flashbehaviour.js,v $
author: JDE
*/

/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/*
    flashbehaviour.js (AJ)
    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 +" .arrow")
        .addClass("fullheight")
        .append('<a href="#thema" title="Video starten" class="block"><span class="out">Video starten</span></a>');
      $("#"+containerID).removeClass("teaserflash");
      $("#"+containerID+" *").remove();

      $(still+" *")
        .click( 
          function() { 
            click_video(still, containerID, video_url, video_w, video_h);
          }
         );

       $(still+" .arrow a")	
         .focus( 
            function() { 
              $(still+" .arrow a").keypress( function() { click_video(still, containerID, video_url, video_w, video_h); } );
            }
           );

    }else{
      this.writeErrorMessage('.video .basic_txt .nonscript','.video .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 +" .arrow")
        .addClass("fullheight")
        .append('<a href="#thema" title="Video starten" class="block"><span class="out">Video starten</span></a>');
      $("#"+containerID).removeClass("teaserflash");
      $("#"+containerID+" *").remove();
      $(still+" *")
        .click( 
          function() { 
            click_app(still, containerID, app_url, app_w, app_h);
          }
         );
       $(still+" .arrow a")	
         .focus( 
            function() { 
              $(still+" .arrow a").keypress( function() { click_app(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 +" .arrow")
        .addClass("fullheight")
        .append('<a href="#thema" title="Video starten" class="block"><span class="out">Video starten</span></a>');
      $("#"+containerID).removeClass("teaserflash");
      $("#"+containerID+" *").remove();
      $(still+" *")
        .click( 
          function() { 
            click_movingimage(still, containerID, script_url);
          }
         );
       $(still+" .arrow a")	
         .focus( 
            function() { 
              $(still+" .arrow a").keypress( function() { click_movingimage(still, containerID, script_url); } );
            }
           );
    }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 +" .arrow")
        .addClass("fullheight")
        .append('<a href="#thema" title="Video starten" class="block"><span class="out">Video starten</span></a>');
      $("#"+containerID).removeClass("teaserflash");
      $("#"+containerID+" *").remove();
      $(still+" *")
        .click( 
          function() { 
            click_video(still, containerID, audio_url, video_w, video_h);
          }
         );
       $(still+" .arrow a")	
         .focus( 
            function() { 
              $(still+" .arrow a").keypress( function() { click_video(still, containerID, audio_url, video_w, video_h); } );
            }
           );
    }else{
      this.writeErrorMessage('.audio .basic_txt .nonscript','.audio .errortxt');
    }
  }


  /* click_video + + + + + + + + + + + + + + */
  click_video = function(still, containerID, video_url, video_w, video_h) {
    stop_sliding();
    $(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) {
    stop_sliding();
    $(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) {
    stop_sliding();
    $(still).remove();
    $('#'+containerID).append('<div class="frame"><div><iframe scrolling=no height=309 width=459 frameborder=0 src="'+script_url+'"> </iframe></div></div>');
  }


  /* writeErrorMessage + + + + + + + + + + + + + + */
  this.writeErrorMessage = function(removetext,errortext) {
    $(removetext).remove();
  }

}


var flashPlayer = new flashplayer("/start/_system/media/videoplayer.swf","580","328","9.0.115");