/* v 1.0.1 */

var SwfReplacement = function(){return {

  containerSwf: "",
  id: "",
  upgradeSwf: "",
  startupScene: 1,

  version: "9.0.0",
  bgcolor: "#ffffff",
  wmode: "opaque",
  quality: "high",
  serverUrl: "",
  fileUrl: "",

  configUrl: "",
  flashId: "noid",
  flashName: "",
  flashWidth: 500,
  flashHeight: 300,
  flashVersion: "9.0.0",
  callbackFn: "",
  trackingName: "",
  trackingEnabled: false,
  repeatUser: 0,

  c: "",
  p: "assets/xml/",
  pn: "",


  /**
   * Parameter for SWF Container
   */
  getParams: function(){
      var params = {
        menu: "false",
        scale: "noScale",
        allowFullscreen: "true",
        allowScriptAccess: "always",
        bgcolor: this.getBgColor(),
        wmode: this.getWMode(),        
        quality: this.getQuality()

      };
      return( params );
  },

  /**
   * Triggers embedding
   */
  embed: function( elem ){

      var flashvars = {

        serverUrl: this.getServerUrl(),
        fileUrl: this.getFileUrl(),
        path: this.getConfigUrl(),
        autoplay: "true",
        startupScene: this.getStartupScene(),
        trackingEnabled: this.getTrackingEnabled(),
        trackingName: this.getTrackingName(),
        repeatUser: this.getRepeatUser(),
        c: this.getCValue(),
        p: this.getPValue(),
        pn: this.getPnValue()
      };

      var attributes = {
        id: this.getFlashId(),
        name: this.getFlashName()
      };

      swfobject.embedSWF(
          this.getContainerSwf(),
          typeof elem === 'undefined' ? this.getAltContentId() : elem,
          this.getFlashWidth(),
          this.getFlashHeight(),
          this.getFlashVersion(),
          this.getUpgradeSwf(),
          flashvars,
          this.getParams(),
          attributes,
          this.getCallbackFunction()
        );
  },
  
  remove: function(){
      $( this.getFlashId() ).replace('<div id="' + this.getAltContentId() + '">&nbsp;</div>');
  },

  setConfigUrl: function( value ){
      this.configUrl = value;
  },

  getConfigUrl: function(){
      return( this.configUrl );
  },

  setStartupScene: function( value ){
      this.startupScene = value;
  },

  getStartupScene: function(){
      return( this.startupScene );
  },

  setUpgradeSwf: function( value ){
      this.upgradeSwf = value;
  },

  getUpgradeSwf: function(){
      return( this.upgradeSwf );
  },

  setContainerSwf: function( value ){
      this.containerSwf = value;
  },

  getContainerSwf: function(){
      return( this.containerSwf );
  },

  setFlashId: function( value ){
      this.flashId = value;
  },

  getFlashId: function(){
      return( this.flashId );
  },

  setFlashName: function( value ){
      this.flashName = value;
  },

  getFlashName: function(){
      return( this.flashName );
  },

  setFlashWidth: function( value ){
      this.flashWidth = value;
  },

  getFlashWidth: function(){
      return( this.flashWidth );
  },

  setFlashHeight: function( value ){
      this.flashHeight = value;
  },

  getFlashHeight: function(){
      return( this.flashHeight );
  },

  setBgColor: function( value ){
      this.bgcolor = value;
  },

  getBgColor: function(){
      return( this.bgcolor );
  },

  setWMode: function( value ){
      this.wmode = value;
  },

  getWMode: function(){
      return( this.wmode );
  },

  setQuality: function( value ){
      this.quality = value;
  },

  getQuality: function(){
      return( this.quality );
  },

  setServerUrl: function( value ){
      this.serverUrl = value;
  },

  getServerUrl: function(){
      return( this.serverUrl );
  },


  setFileUrl: function( value ){
      this.fileUrl = value;
  },

  getFileUrl: function(){
      return( this.fileUrl );
  },

  setFlashVersion: function( value ){
      this.flashVersion = value;
  },

  getFlashVersion: function(){
      return( this.flashVersion );
  },
  
  setTrackingEnabled: function( value ){
      this.trackingEnabled = value;
  },

  getTrackingEnabled: function(){
      return( this.trackingEnabled );
  },

  setTrackingName: function( value ){
      this.trackingName = value;
  },

  getTrackingName: function(){
      return( this.trackingName );
  },

  setAltContentId: function( value ){
      this.altContentId = value;
  },

  getAltContentId: function(){
      return( this.altContentId );
  },

  setCallbackFunction: function(  value ){
      this.callbackFn = value;
  },

  getCallbackFunction: function(){
      return( this.callbackFn );
  },

  setRepeatUser: function(  value ){
    this.repeatUser = value;
  },

  getRepeatUser: function(){
    return( this.repeatUser );
  },

  setCValue: function(  value ){
    this.c = value;
  },

  getCValue: function(){
    return( this.c );
  },

  setPValue: function(  value ){
    this.p = value;
  },

  getPValue: function(){
    return( this.p );
  },
  
  setPnValue: function(  value ){
    this.pn = value;
  },

  getPnValue: function(){
    return( this.pn );
  }



};};


//Vorteilsmodul
SwfReplacement.vorteilsmodulFactory = function() {
       var result = new SwfReplacement();
       result.setConfigUrl( "richmedia/vorteilsmodul/config/" );
       result.setContainerSwf( "richmedia/vorteilsmodul/swf/vorteilsmodul.swf" );
       result.setUpgradeSwf( "richmedia/expressInstall.swf" );
       result.setStartupScene( 1 );
       result.setFlashId( "Advantage" );
       result.setFlashName( "Advantage" );
       result.setFlashWidth( 1000 );
       result.setFlashHeight( 419 );
       result.setAltContentId( "AltContentLayer" );
       result.setTrackingEnabled( true );
       return( result );
};

//Guided Tour
SwfReplacement.gudedTourFactory = function() {
       var result = new SwfReplacement();
       result.setConfigUrl( "richmedia/guidedtour/config/configGuidedTour.xml" );
       result.setContainerSwf( "richmedia/20100707/swf/guidedtour.swf" );
       result.setUpgradeSwf( "richmedia/expressInstall.swf" );
       result.setStartupScene( 1 );
       result.setFlashId( "Guidedtour" );
       result.setFlashName( "Guidedtour" );
       result.setFlashWidth( 940 );
       result.setFlashHeight( 510 );
       result.setAltContentId( "altContent" );
       result.setTrackingEnabled( true );
       return( result );
};

//Inline Filme
SwfReplacement.flexContainer = function() {
       var result = new SwfReplacement();
       result.setContainerSwf( "richmedia/videoplayer/swf/videoplayer.swf" );
       result.setUpgradeSwf( "richmedia/expressInstall.swf" );
       result.setFlashVersion("9.0.115.0");
       result.setBgColor("#000000");
       result.setFlashId( 'Flashname' );
       result.setFlashName( 'Flashname' );
       result.setAltContentId("altContent");
       result.setFlashWidth( 376 );
       result.setFlashHeight( 278 );
       result.setQuality("best");
       result.setWMode("transparent");
       result.setTrackingEnabled( true );
       result.setCValue("");
       result.setPValue("");
       result.setPnValue("");

       return( result );
};

//Clickdummy / Flash-Tutorial
SwfReplacement.ePostClickdummy = function() {
       var result = new SwfReplacement();
       result.setConfigUrl( "richmedia/flashtutorial/config/configClickdummy.xml" );
       result.setContainerSwf( "richmedia/flashtutorial/swf/epostbrief-clickdummy.swf" );
       result.setUpgradeSwf( "richmedia/expressInstall.swf" );
       result.setFlashVersion("9.0.115.0");
       result.setStartupScene( 0 );
       result.setFlashId( "epostbrief" );
       result.setFlashName( "epostbrief" );
       result.setFlashWidth( 980 );
       result.setFlashHeight( 540 );
       result.setAltContentId( "altContent" );
       return( result );
};

SwfReplacement.flash = function() {
       var result = new SwfReplacement();
       result.setConfigUrl( "" );
       result.setContainerSwf( "" );
       result.setUpgradeSwf( "" );
       result.setFlashVersion("9.0.0.0");
       result.setFlashId( "thFlash" );
       result.setFlashName( "theFlash" );
       result.setFlashWidth( 400 );
       result.setFlashHeight( 300 );
       result.setAltContentId( "altContentFlash" );
       return( result );
};
