/*CVS Add-ins*/
/*
$Revision: 1.10 $
$RCSfile: flashbehaviour.js,v $
author: JDE
*/

/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/*
    flashbehaviour.js 
    20.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)) {
      swfobject.embedSWF(this.url.concat(video_id), containerID, this.width, this.height, reqVerStr);
    }else{
      this.writeErrorMessage('.youtube .basic_txt','.youtube .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('.movingimage .basic_txt','.movingimage .errortxt');
    }
  }
  
    /* click_movingimage + + + + + + + + + + + + + + */
  click_movingimage = function(still, containerID, script_url) {
    $(still).remove();
    $('#'+containerID).removeClass('hint').addClass('obj');
    $('#'+containerID).append(
      '<div class="frame"><div>'+
      '<p><a class="framelink" target="_blank" title="ö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="234" width="327" src="'+script_url+'"> </iframe>'+
      '</div></div>');
  }


  /* embed_map + + + + + + + + + + + + + + */
  this.embed_map = function(containerID) {
    if(this.hasRequiredFlashVersion(this.requiredVer)) {
      $(".map img.noflash").remove();
      swfobject.embedSWF(this.url, containerID, this.width, this.height, reqVerStr);
    }else{
      this.writeErrorMessage('.map .basic_txt','.map .errortxt');
    }
  }


  /* embed_timeline + + + + + + + + + + + + + + */
  this.embed_timeline = function(containerID, moreparams) {
    if(this.hasRequiredFlashVersion(this.requiredVer)) {
      swfobject.embedSWF(this.url, containerID, this.width, this.height, reqVerStr, null, moreparams, { bgcolor: '#FFFFFF', menu: 'false' }, { id: 'timeline' });
    }else{
      this.writeErrorMessage('.timeline .basic_txt','.timeline .errortxt');
    }
  }


  /* embed_map added ihe, 15.06.09 + + + + + + + + + + + + + + */
  this.embed_btwmap = function(containerID, swfPath, pathXml, pathLink) {
    if(this.hasRequiredFlashVersion(this.requiredVer)) {
      swfobject.embedSWF(swfPath, containerID, this.width, this.height, reqVerStr, false, { xmlPath: pathXml, linkPath: pathLink }, { scale: 'noscale', allowfullscreen: 'false'}, {});
    }	
  }


  /* 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® 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® Flashplayer installiert oder er ist deaktiviert. Die aktuelle Version ");
    }
  }


}//flashplayer


/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
var btwPlayer = new flashplayer("http://www.youtube.com/v/","430","350","9.0.0");
var flashPlayer = new flashplayer("http://www.youtube.com/v/","327","266","9.0.0");
var candidates = new flashplayer("/_system/media/europakandidaten.swf","583","517","9.0.115");
var timelinePlayer = new flashplayer("/_system/media/zeitstrahl/1989/main.swf","516","200","9.0.28");
var btwcandis = new flashplayer("","583","517","9.0.0");