/*
 * jack4flash
 *
 * Copyright (c) A&B One Digital GmbH
 * version 0.4 (08-MAR-2010)
 * Requires jQuery v1.3.2, jQuery UI 1.7.2, SWFObject v2.1
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Author: Jana Deutschlaender
 */

/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/* jQuery PlugIn: jack4flash */
/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */

;jQuery.jack4flash || (function($){ 

  /* browser detection */
  var agt = navigator.userAgent.toLowerCase();
  var op = (agt.indexOf("opera") != -1); /* opera */
  var win_ie = (agt.indexOf("msie") != -1);


  /* declaration of global flashrelated objects and variables */
  var f2n = new Object(); 
  f2n.utils = new Object();
  f2n.defaults = new Object();
  f2n.currentSettings = new Object();
  f2n.acon = new Object();
  f2n.acoff = new Object();
  f2n.ccon = new Object();
  f2n.ccoff = new Object();
  var options_error = false;
  var func_error = false;
  var active_slider = true;

/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */

  $.fn.loadPlayer = function(options) {
    
    /* + + + + + + + + + + + + + + + + + */
    /* error handling */
    /* + + + + + + + + + + + + + + + + + */

    if( options && options.version && options.lang && options.video && options.player && options.pid && options.objid ) { 
      if( !f2n.utils.has_regVersion(options.version) ){
        f2n.utils.writeErrorMsg('#'+options.pid+' .error', options.lang); /* does not have required flash version */
        return this;
      }
    }else{
      var clang = 'de'; if( options.lang ){ clang = options.lang }
      f2n.utils.writeOptionsMsg('#'+options.pid, clang); /* main param is missing */
      return this;
    }

    /* + + + + + + + + + + + + + + + + + */
    /* global params */
    /* + + + + + + + + + + + + + + + + + */

    var gl = { flashparams: { }, flashattr: { }, flashvars: { } };

    /* + + + + + + + + + + + + + + + + + */
    /* mandatory params */

    gl.flashvars.file = options.video;
    gl.flashvars.id = options.objid;
    gl.flashattr.name = options.objid;
    gl.flashattr.id = options.objid;
    gl.flashattr.lang = options.lang;

    /* + + + + + + + + + + + + + + + + + */
    /* optional params */

    /* preview (poster) image */
    if(options.still) {
      gl.flashvars.image = options.still;
      if( (options.still).indexOf('/') < 0 ) gl.flashvars.image = ''+f2n.defaults.pathToStill+options.still;
    }

    /* base param */
    if(options.base) gl.flashparams.base = options.base;
    if(options.show_controls){
      var styleclasses = 'player_';
      for (func in options.show_controls){
          if(options.show_controls[func]) {
            styleclasses += ' '+func;
          }
      }
      gl.flashattr['class'] = styleclasses;
    }

    /* streaming service */
    if(options.streaming){
      if(options.streaming.provider) gl.flashvars.provider = options.streaming.provider;
      if(options.streaming.streamer) gl.flashvars.streamer = options.streaming.streamer;
    }

    /* caption / audiodescription */
    if(options.plugins){ 
      gl.flashvars.plugins = '';
      var numplug = 0;
 
      if(options.plugins.captions){
        gl.flashvars.plugins += 'captions-1';
        gl.flashvars['captions.file'] = options.plugins.captions;
        if(options.plugstate && options.plugstate['captions.state']){
          gl.flashvars['captions.state'] = options.plugstate['captions.state'];
        }else{
          gl.flashvars['captions.state'] = f2n.defaults.plugstate.dstate;
        } /* else */
        numplug++;
      } /* if */
      if(options.plugins.audiodescription){
        if(numplug > 0) gl.flashvars.plugins += ',';
        gl.flashvars.plugins += 'audiodescription-1';
        gl.flashvars['audiodescription.file'] = options.plugins.audiodescription;
        if(options.plugstate && options.plugstate['audiodescription.state']){
          gl.flashvars['audiodescription.state'] = options.plugstate['captions.state'];
        }else{
          gl.flashvars['audiodescription.state'] = f2n.defaults.plugstate.dstate;
        } /* else */
      } /* if */
    } /* if */
    

    f2n.currentSettings[options.objid] = $.extend(true, options, gl); 
    if(options.show_controls){ $.extend(true, options, { 'flashvars': { 'controlbar': 'none' } } ); }
      f2n.utils.loadPlayer(options);


    /* + + + + + + + + + + + + + + + + + */
    /* markup control settings */
    /* + + + + + + + + + + + + + + + + * */

    if(options.show_controls){

      var jcontainer = $('#'+options.pid);
      var conid = options.pid;
      var dcontainer = document.getElementById(conid);
      
      var pLang = options.lang;

      $('#'+conid+' .zoomlevel').prepend('<h3 class="out">'+f2n.utils.getLangOptions('playerhead', pLang, false)+'</h3>');


      /* + + + + + + + + + + + + + + + + */
      /* zoomsettings: 0,1 or 2 */
      if(options.show_controls.zoom && options.show_controls.zoom > 0){

        var zoomsettings = {
          'controlclass': 'zoom',
          'prefix': 'flashcontrol',
          'intro': ''+f2n.utils.getLangOptions('zoom_legend', pLang, false),
          'elements': {
            'zoom0': {
              'button': ''+f2n.utils.getLangOptions('zoom0', pLang, false),
              'title': ''+f2n.utils.getLangOptions('zoom0title', pLang, false),
              'display': 'block'
            },
            'zoom1': {
              'button': ''+f2n.utils.getLangOptions('zoom1', pLang, false),
              'title': ''+f2n.utils.getLangOptions('zoom1title', pLang, false),
              'display': 'block',
              'attr': 'disabled'
            }
          }
          };

          if(options.show_controls.zoom > 1){
            $.extend(zoomsettings.elements,
            {
                'zoom2': {
                'button': ''+f2n.utils.getLangOptions('zoom2', pLang, false),
                'title': ''+f2n.utils.getLangOptions('zoom2title', pLang, false),
                'display': 'block'
                }
            });
          }//if

          $('#'+conid+' .formatcontrols').append(f2n.utils.controlset(zoomsettings));
          $('#'+conid+' .formatcontrols').wrap('<form class="formatcontrols"></form>');

        }/* if(options.show_controls.zoom) */

      /* + + + + + + + + + + + + + + + + + */
      /* basicsettings: play, pause, stop  */
      if(options.show_controls.basic){
        var basicsettings = {
          'controlclass': 'basic',
          'prefix': 'flashcontrol',
          'intro': ''+f2n.utils.getLangOptions('basic_legend', pLang, false),
          'elements': {
            'play': {
              'button': ''+f2n.utils.getLangOptions('play', pLang, false),
              'title': ''+f2n.utils.getLangOptions('playtitle', pLang, false),
              'display': 'block'
            },
            'pause': {
              'button': ''+f2n.utils.getLangOptions('pause', pLang, false),
              'title': ''+f2n.utils.getLangOptions('pausetitle', pLang, false),
              'display': 'none'
            },
            'stop': {
              'button': ''+f2n.utils.getLangOptions('stop', pLang, false),
              'title': ''+f2n.utils.getLangOptions('stoptitle', pLang, false),
              'display': 'block',
              'attr': 'disabled',
              'class': 'disabled'
            }
          }
        };
        $('#'+conid+' .basiccontrols').append(f2n.utils.controlset(basicsettings));
        $('#'+conid+' .basiccontrols').wrap('<form class="basiccontrols"></form>');
      } /* if(options.show_controls.basic) */


        /* + + + + + + + + + + + + + + + + + + + + + + */
        /* playbacksettings:  */

        if(options.show_controls.time || options.show_controls.timeslider || options.show_controls.skip ){

          var playbacksettings = {
            'controlclass': 'playback',
            'prefix': 'flashcontrol',
            'intro': ''+f2n.utils.getLangOptions('playback_legend', pLang, false)
          };

          /* current time, total time */
          if(options.show_controls.time){
          $.extend(playbacksettings,
            {
            'selements':{
              'currenttime': {
                'label': ''+f2n.utils.getLangOptions('currenttime', pLang, false),
                'value': '00:00'
              },
              'totaltime': {
                'label': ''+f2n.utils.getLangOptions('totaltime', pLang, false),
                'value': '00:00'
              }
              }
            });
          }/* if(options.show_controls.time) */

          /* fast-forward, rewind   */
          if( options.show_controls.skip ){
            $.extend(playbacksettings,
              {
              'elements': {
                'rew': {
                  'button': '<span class="seek_0">'+f2n.utils.getLangOptions('rew', pLang, false)+'</span>',
                  'title': ''+f2n.utils.getLangOptions('rewtitle', pLang, false),
                  'display': 'block',
                  'attr': 'disabled'
                },
                'ff': {
                  'button': '<span class="seek_0">'+f2n.utils.getLangOptions('ff', pLang, false)+'</span>',
                  'title': ''+f2n.utils.getLangOptions('fftitle', pLang, false),
                  'display': 'block',
                  'attr': 'disabled'
                }
              }
            });
          }/* if(options.show_controls.skip) */

          /* time slider / trail */
          if(options.show_controls.timeslider){
            $.extend(playbacksettings,
            {
              'slider': {
                'scrubber': {
                  'display': 'block'
                }
               }
            });
          }/* if(options.show_controls.timeslider) */


          $('#'+conid+' .playbackcontrols').append(f2n.utils.controlset(playbacksettings));
          $('#'+conid+' .playbackcontrols').wrap('<form class="playbackcontrols"></form>');
        }/* if(options.show_controls.playback) */


        /* + + + + + + + + + + + + + + + + + + + + + + */
        /* soundsettings: Lautstaerkeauswahl, 
           aktuelle Lautst&aumlaerke, Ton aus, Ton an */
        if(options.show_controls.sound){
        
          var soundsettings = {
            'controlclass': 'sound',
            'prefix': 'flashcontrol',
            'intro': ''+f2n.utils.getLangOptions('sound_legend', pLang, false),
             'selements': {
              'currentvolume': {
                'label': ''+f2n.utils.getLangOptions('currentvolume', pLang, false),
                'value': ''
              }
            },
            'elements': {
              'mute': {
                'button': ''+f2n.utils.getLangOptions('mute', pLang, false),
                'title': ''+f2n.utils.getLangOptions('mutetitle', pLang, false),
                'display': 'block'
              },
              'unmute': {
                'button': ''+f2n.utils.getLangOptions('unmute', pLang, false),
                'title': ''+f2n.utils.getLangOptions('unmutetitle', pLang, false),
                'display': 'none'
              }
            }
          };

          if(options.show_controls.volume){
            $.extend(soundsettings,
              {
              'lelements': {
                'pvolume': {
                  'label': ''+f2n.utils.getLangOptions('pvolume', pLang, false),
                  'prefix':''+f2n.utils.getLangOptions('pvolprefix', pLang, false),
                  'id': 'pvolume',
                  'sound_volume':{
                    '0' :''+f2n.utils.getLangOptions('sound_volume0', pLang, false),
                    '1' :''+f2n.utils.getLangOptions('sound_volume1', pLang, false),
                    '2' :''+f2n.utils.getLangOptions('sound_volume2', pLang, false),
                    '3' :''+f2n.utils.getLangOptions('sound_volume3', pLang, false)
                  }
                }
              }
            });
          }/* if(options.show_controls.volume) */
          $('#'+conid+' .soundcontrols').append(f2n.utils.controlset(soundsettings));
          $('#'+conid+' .soundcontrols').wrap('<form class="soundcontrols"></form>');
        }/* if(options.show_controls.sound) */

        if(options.show_controls.help){
          var helpsettings = {
            'controlclass': 'help',
            'prefix': 'flashcontrol',
            'intro': ''+f2n.utils.getLangOptions('help_legend', pLang, false),
            'elements': {
              'ihelp': {
                'button': ''+f2n.utils.getLangOptions('ihelp', pLang, false),
                'title': ''+f2n.utils.getLangOptions('ihelptitle', pLang, false),
                'display': 'block'
              }
            }
          };
          $('#'+conid+' .helpcontrols').append(f2n.utils.controlset(helpsettings));
          $('#'+conid+' .helpcontrols').wrap('<form class="helpcontrols"></form>');
        } /* if(options.show_controls.help) */

        /* + + + + + + + + + + + + + + + + + + + + + + */
        /* synchsettings: Untertitel, Audiodescription  */
        
        if(options.show_controls.audiodescription || options.show_controls.captions){

          var captionsettings = {};
          var audiosettings = {}

          if(options.show_controls.captions){
            captionsettings = {
              'controlclass': 'synch',
              'prefix': 'flashcontrol',
              'intro': ''+f2n.utils.getLangOptions('caption_legend', pLang, false),
              'elements': {
              'cc': {
                'buttonprefix': ''+f2n.utils.getLangOptions('ccprefix', pLang, false),
                'button': ''+f2n.utils.getLangOptions('cc', pLang, false),
                'title': ''+f2n.utils.getLangOptions('cctitle', pLang, false),
                'display': 'block'
              },
              'ccoff': {
                'button': ''+f2n.utils.getLangOptions('ccoff', pLang, false),
                'title': ''+f2n.utils.getLangOptions('ccofftitle', pLang, false),
                'display': 'block',
                'attr': 'disabled'
              }
            }
           }
          } /* if(options.show_controls.captions) */

          if(options.show_controls.audiodescription){
            audiosettings = {
              'controlclass': 'synch',
              'prefix': 'flashcontrol',
              'intro': ''+f2n.utils.getLangOptions('audiodescription_legend', pLang, false),
              'elements': {
                'ac': {
                  'buttonprefix': ''+f2n.utils.getLangOptions('acprefix', pLang, false),
                  'button': ''+f2n.utils.getLangOptions('ac', pLang, false),
                  'title': ''+f2n.utils.getLangOptions('actitle', pLang, false),
                  'display': 'block'
                },
                'acoff': {
                  'button': ''+f2n.utils.getLangOptions('acoff', pLang, false),
                  'title': ''+f2n.utils.getLangOptions('acofftitle', pLang, false),
                  'display': 'block',
                  'attr': 'disabled'
                }
               }
              }
          } /*  if(options.show_controls.audiodescription) */

          $('#'+conid+' .synchcontrols').append(f2n.utils.controlset(captionsettings)).append(f2n.utils.controlset(audiosettings)).append('<div class="clearBoth"></div>');
          $('#'+conid+' .synchcontrols').wrap('<form class="synchcontrols"></form>');

        } /* options.show_controls.audiodescription || options.show_controls.captions) */

    } /* if(options.show_controls) */
    


    /* + + + + + + + + + + + + + + + + */
    /* initial player load */
    return this.each(function() {
      $(this).addClass('jack4flash');
    });
 
  }; /* $.fn.loadPlayer  */


/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/* local static functions */
/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */

  jQuery.reloadPlayer = function(options){ 
    f2n.utils.loadPlayer(options);
  };
  
  jQuery.zoomPlayer = function(num, player_id, player_width, player_height, options){
    switch(num){
      case 1:
        $('body').removeClass('fullscreen');
        $('.videoplayer').attr('id', 'zoom'+num);
        $('.videoplayer .inner').removeAttr('style');
        $.reloadPlayer(options);
        break;
      case 2:
        $('body').addClass('fullscreen');
        $('.videoplayer').attr('id', 'zoom'+num);
        $('.videoplayer .inner').removeAttr('style');
        $.reloadPlayer(options);
        break;
      case 0:
        $('body').removeClass('fullscreen');
        $('.videoplayer').attr('id', 'zoom'+num);
        $('.videoplayer .inner').removeAttr('style');
        $.reloadPlayer(options);
        break;
      default:
        break;
    }
    return false;
}

  jQuery.asTracker = {

    resizeTracker: function(obj){
      //alert(obj.height+'\n'+obj.width);
    },

    timeTracker: function(obj){
      var objid = obj['id'];
      var conid = 'pid_'+parseInt(objid.substring(objid.lastIndexOf("_")+1));
      var percentComplete = Math.round(100000 * obj.position / obj.duration);
      var pLang = $('#'+objid).attr('lang');

      var scrubberaccess = $('#'+conid+' .scrubber .ui-slider-range');
      var scrubberanker = $('#'+conid+' .scrubber .ui-slider-handle');
      scrubberanker.attr('title', ''+f2n.utils.formatTime(obj.position));
      scrubberaccess.attr('aria-valuemax', ''+f2n.utils.formatTime(obj.duration));
      scrubberaccess.attr('aria-valuenow', ''+f2n.utils.formatTime(obj.position));
      scrubberaccess.attr('aria-valuetext', f2n.utils.formatTime(obj.position)+' '+f2n.utils.getLangOptions('aria-valuetext', pLang, false));

      if(!f2n.currentSettings.user['buffered'] && obj.position >= obj.duration/100 ){
        f2n.currentSettings.user['buffered'] = true;
        $('#'+conid+' .playback button').removeAttr('disabled').removeClass('disabled');
        f2n.utils.checkDisabled();
        f2n.utils.setButtonHover('#'+conid+' .playback button');
      }
      if(f2n.currentSettings.user['buffered'] == true){
        scrubberanker.html(f2n.utils.getLangOptions('aria-ankertext2', pLang, false));
      }

      $('#'+conid+' .scrubber').slider('option', 'value', percentComplete);
      $('#'+conid+' .currenttime').html(f2n.utils.formatTime(obj.position));
      $('#'+conid+' .totaltime').html(f2n.utils.formatTime(obj.duration));
      if(f2n.currentSettings.user['totaltime'] < 10) {
        f2n.currentSettings.user['totaltime'] = parseInt(obj.duration);
      }

      $('#'+conid+' .ff span').removeAttr('class').addClass('seek_'+f2n.utils.set_seektime(obj.position));
      $('#'+conid+' .rew span').removeAttr('class').addClass('seek_'+f2n.utils.set_seektime(obj.position));
    },

    playTracker: function(obj){
      var objid = obj['id'];
      var conid = 'pid_'+parseInt(objid.substring(objid.lastIndexOf("_")+1));
      var player = $("#"+objid);

      if (obj.newstate == "PLAYING"){
        $('#'+conid+' .pause').css("display","block");
        $.setFocus($('#'+conid+' .pause'));
        //if(f2n.currentSettings.user.event =='zoom3') $.setFocus($('#'+conid+' .zoom0'));
        if(f2n.currentSettings.user.event =='ac') $.setFocus($('#'+conid+' .acoff'));
        else if(f2n.currentSettings.user.event =='cc') $.setFocus($('#'+conid+' .ccoff'));
        $('#'+conid+' .play').css("display","none");
        $('#'+conid+' .stop').removeClass('disabled').removeAttr('disabled');
        if(f2n.currentSettings.user['buffered']){
          $('#'+conid+' .playback button').removeClass('disabled').removeAttr('disabled');
          f2n.utils.checkDisabled();
        }
        
      } else{

        $('#'+conid+' .pause').css("display","none");
        $('#'+conid+' .play').css("display","block");
        $('#'+conid+' .stop').each(function() {
          $(this).addClass('disabled');
          this.disabled = true;
          f2n.utils.checkDisabled();
        });

        $.setFocus($('#'+conid+' .play'));
        $('#'+conid+' .playback button').each(function() {
          $(this).addClass('disabled');
          this.disabled = true;
          f2n.utils.checkDisabled();
        });
      }
    },
  
    muteTracker: function(obj){
      var objid = obj['id'];
      var conid = 'pid_'+parseInt(objid.substring(objid.lastIndexOf("_")+1));
      var player = document.getElementById(objid);
      //alert('mutetracker \nmute: '+obj.state +' \ngetConfig[Mute]: '+player.getConfig()['mute'] );
        if (!obj.state){ 
          $('#'+conid+' .unmute').css("display","none");
          $('#'+conid+' .mute').css("display","block");
          $.setFocus($('#'+conid+' .mute'));
          var jplayer = $("#"+objid);
          if(!f2n.currentSettings.user.volume) f2n.currentSettings.user.volume = f2n.defaults.flashvars.volume; 
          var currentvolume = f2n.currentSettings.user.volume; 
          $('#'+conid+' .currentvolume').empty().append(f2n.utils.volpad(currentvolume));
          f2n.utils.setVolumeList(f2n.utils.volpad(currentvolume));
        } else { 
          $('#'+conid+' .unmute').css("display","block");
          $('#'+conid+' .mute').css("display","none");
          $.setFocus($('#'+conid+' .unmute'));
          $('#'+conid+' .currentvolume').empty().append(f2n.utils.volpad('0'));
          f2n.utils.setVolumeList(f2n.utils.volpad('0'));
        }
    },
  
    volumeTracker: function(obj){
      var objid = obj['id'];
      var conid = 'pid_'+parseInt(objid.substring(objid.lastIndexOf("_")+1));
      var player = $("#"+objid);
      var is_muted = false;
      if(!f2n.currentSettings.user.volume) {
        f2n.currentSettings.user.volume = f2n.defaults.flashvars.volume; 
      }
      if(!f2n.currentSettings.user.mute){
        f2n.currentSettings.user.mute = f2n.defaults.flashvars.mute;
      }
      is_muted = f2n.currentSettings.user.mute;
      var currentvolume = f2n.currentSettings.user.volume; 

      if(!is_muted) f2n.utils.setVolumeList(f2n.utils.volpad(currentvolume));
      //alert(currentvolume);
      f2n.defaults.flashvars.volume = currentvolume;
      $('#'+conid+' .currentvolume').empty().append(f2n.utils.volpad(currentvolume));
      //alert('volumetracker \nis_muted: ' + is_muted + ' \nf2n.defaults.flashvars.mute: '+f2n.defaults.flashvars.mute +' \ngetConfig[Mute]: '+player.getConfig()['mute']  );
    }
  };

  jQuery.addListeners  = function (player){
    if (player) { 
      player.addModelListener("TIME","jQuery.asTracker.timeTracker");
      player.addModelListener("STATE","jQuery.asTracker.playTracker");
      player.addControllerListener("MUTE","jQuery.asTracker.muteTracker");
      player.addControllerListener("VOLUME","jQuery.asTracker.volumeTracker");
    } else {
      setTimeout("addListeners()",200);
    }
  };
  jQuery.loadVideo = function(player){
    var currentPlayer = ($(player).attr('id'));
    var options = f2n.currentSettings[currentPlayer];
  };

  jQuery.setFocus= function(jobj){
      var focusobj = jobj[0];
      if(focusobj) focusobj.focus();
  };

  jQuery.setControls = function(player){
   if(player){

    var currentPlayer = ($(player).attr('id'));
    var options = f2n.currentSettings[currentPlayer];
    var objid = options.objid;
    var jplayer = $('#'+options.objid);
    var dplayer = document.getElementById(options.objid);
    var conid = options.pid;

    var zoom0 = $('#'+conid+' .zoom0');
    zoom0.unbind();
    zoom0.bind('click', function() {
     f2n.currentSettings.user.event = 'zoom0';
      f2n.currentSettings.user.mute = String(f2n.utils.getMuteState(dplayer));
      f2n.utils.changeImage(this,/_hover./,"_default.");
      $('#'+conid+' .formatcontrols .flashcontrol.disabled').removeAttr('disabled').removeClass('disabled').removeClass('fokus');
      $(this).addClass('disabled');
      this.disabled = true;
      f2n.utils.checkDisabled();
     var lo = $.extend(true, {}, f2n.defaults, options, f2n.currentSettings.user, f2n.zoom0, { 'flashvars': {'mute': ''+String(f2n.utils.getMuteState(dplayer)) }});
     $.zoomPlayer(0, options.objid, '100%', '100%', lo);
    });

    var zoom1 = $('#'+conid+' .zoom1');
    zoom1.unbind();
    zoom1.bind('click', function() {
     f2n.currentSettings.user.event = 'zoom1';
     f2n.currentSettings.user.mute = String(f2n.utils.getMuteState(dplayer));
     f2n.utils.changeImage(this,/_hover./,"_default.");
     $('#'+conid+' .formatcontrols .flashcontrol.disabled').removeAttr('disabled').removeClass('disabled').removeClass('fokus');
      $(this).addClass('disabled');
      this.disabled = true;
      f2n.utils.checkDisabled();
     var lo = $.extend(true, {}, f2n.defaults, options, f2n.currentSettings.user, f2n.zoom0, { 'flashvars': {'mute': ''+String(f2n.utils.getMuteState(dplayer)) }});
     $.zoomPlayer(1, options.objid, '100%', '100%', lo);
    });
    

    var zoom2 = $('#'+conid+' .zoom2');
    zoom2.unbind();
    zoom2.bind('click', function() {
      f2n.currentSettings.user.event = 'zoom2';
      f2n.currentSettings.user.mute = String(f2n.utils.getMuteState(dplayer));
      f2n.utils.changeImage(this,/_hover./,"_default.");
      $('#'+conid+' .formatcontrols .flashcontrol.disabled').removeAttr('disabled').removeClass('disabled').removeClass('fokus');
      $(this).addClass('disabled');
      this.disabled = true;
      f2n.utils.checkDisabled();
      var lo = $.extend(true, {}, f2n.defaults, options, f2n.currentSettings.user, f2n.zoom, { 'flashvars': {'mute': ''+String(f2n.utils.getMuteState(dplayer)) }});
      $.zoomPlayer(2, options.objid, '100%', '100%', lo);
    });

    var play = $('#'+conid+' .play');
    play.unbind();
    play.bind('click', function() {
      dplayer.sendEvent("PLAY", true);
      var current_mute = dplayer.getConfig()['mute'];
      if(current_mute){
        currentvolume.empty().append(f2n.utils.volpad('0'));
        f2n.utils.setVolumeList(f2n.utils.volpad('0'));
      }
      return false;
    });

    var pause = $('#'+conid+' .pause');
      pause.unbind();
      pause.bind('click', function() {
      var dplayer = document.getElementById(options.objid);
      dplayer.sendEvent("PLAY", false);
      return false;
    });

    var stop = $('#'+conid+' .stop');
    stop.unbind();
    stop.bind('click', function() {
      dplayer.sendEvent("STOP");
      $('#'+conid+' .scrubber').slider('option', 'value', 0);
      $('#'+conid+' .currenttime').html('00:00');
      return false;
    });

    var mute = $('#'+conid+' .mute');
    var unmute = $('#'+conid+' .unmute');
    var currentvolume = $('#'+conid+' .currentvolume');
    var cvlabel = $('#'+conid+' .wrappercurrentvolume .label');
    cvlabel.attr('id','cvl_'+conid);
    currentvolume.attr('role','status').attr('aria-labelledby','cvl_'+conid);
    var pvolume = $('#pvolume .pvolume button');
    
    if(!f2n.currentSettings.user.volume){
      f2n.currentSettings.user.volume = f2n.defaults.flashvars.volume;
    }else{ 
    }
    if(f2n.utils.getMuteState(dplayer)) f2n.utils.setVolumeList(0);
    else f2n.utils.setVolumeList(f2n.currentSettings.user.volume/20);
    //alert('initial: \nmute: '+ f2n.utils.getMuteState(dplayer));

    pvolume.unbind();
    pvolume.bind('click', function(event) {
      event.preventDefault();
      var cid = String($(this).parent('li').attr('id'));
      var cvol = parseInt(cid.substring(cid.lastIndexOf("_")+1));
      var pid = $(this).parent('li').siblings('.active');
      var pvol = parseInt(String( $(pid[0]).attr('id').substring(cid.lastIndexOf("_")+1) ));
      if(('NaN' != cvol) ){ 
        if(cvol == 0){
          dplayer.sendEvent("MUTE", true);
          //alert('pvolume \ncvol==0\nsend event mute: true\ngetConfig[Mute]'+dplayer.getConfig()['mute']);
          
        }else{
          //alert(cvol*33);
          dplayer.sendEvent("VOLUME", cvol*33 );
          dplayer.sendEvent("MUTE", false);
          f2n.currentSettings.user.volume = cvol*33;
          f2n.currentSettings.user.flashvars.volume = cvol*33;
          /* debug: version 5.1.897  */
          if(('NaN' != pvol) && pvol > 0 ){ dplayer.sendEvent("MUTE", false); }
          //alert('pvolume \ncvol!=0: '+cvol+'\ncid: '+cid+'\nsend event mute: false\ngetConfig[Mute]'+dplayer.getConfig()['mute']);
        }
        
        f2n.utils.setVolumeList(cvol);
      }
      //alert('pvolume \nString(f2n.utils.getMuteState(dplayer))'+String(f2n.utils.getMuteState(dplayer)));
      return false;
    });

    mute.unbind();
    mute.bind('click', function() {
      dplayer.sendEvent("MUTE", true);
      f2n.currentSettings.user.mute = 'true';
      return false;
    });

    unmute.unbind();
    unmute.bind('click', function() {
        dplayer.sendEvent("MUTE", false);
        f2n.currentSettings.user.mute = 'false';
        return false;
    });

    var ff = $('#'+conid+' .ff');
    ff.unbind();
    ff.bind('click', function() {
      var currentClass = $('#'+conid+' .ff span').attr('class');
      var currentPosition = parseInt(currentClass.substring(currentClass.lastIndexOf("_")+1));
      if(('NaN' != currentPosition) ){
        //var ffPosition = currentPosition+ 10;
        dplayer.sendEvent('SEEK', f2n.utils.fastforward(currentPosition,f2n.currentSettings.user['totaltime']));
      }
      return false;
    });

    
    var rew = $('#'+conid+' .rew');
    rew.unbind();
    rew.bind('click', function() {
      var currentClass = $('#'+conid+' .rew span').attr('class');
      var currentPosition = parseInt(currentClass.substring(currentClass.lastIndexOf("_")+1));
      if(('NaN' != currentPosition) ){
        //dplayer.sendEvent('SEEK', currentPosition-10);
        dplayer.sendEvent('SEEK', f2n.utils.reward(currentPosition,f2n.currentSettings.user['totaltime']));
      }
      return false;
    });

    
    var scrubber = $('#'+conid+' .scrubber');
    scrubber.slider({
      range: "min",
      min: 0,
      max: 100000,
      step: 100,
      slide: function(event, ui) {
        if(f2n.currentSettings.user['buffered']){
        var player = document.getElementById(options.objid);
        var duration = player.getPlaylist()[player.getConfig()['item']].duration;
        var seekTime = Math.round(duration * ui.value / 100000);
        player.sendEvent("SEEK", seekTime);
        }
      }
    });
    var scrubberaccess = $('#'+conid+' .scrubber .ui-slider-range');
    scrubberaccess.attr('role', 'progressbar');
    scrubberaccess.attr('aria-valuemin', '00:00');
    
    var scrubberanker = $('#'+conid+' .scrubber .ui-slider-handle');
    scrubberanker.html(f2n.utils.getLangOptions('aria-ankertext1', options.lang, false));
    
    var currenttime = $('#'+conid+' .currenttime');
    var ctlabel = $('#'+conid+' .wrappercurrenttime .label');
    ctlabel.attr('id','ctl_'+conid);
    currenttime.attr('role','status').attr('aria-labelledby','ctl_'+conid);
    
    
    
    var ac = $('#'+conid+' .ac');
    ac.unbind();
    ac.bind('click', function() {
      f2n.currentSettings.user.event = 'ac';
      f2n.currentSettings.user.flashvars['audiodescription.state'] = 'true';
      f2n.currentSettings.user.acbutton = 'none';
      f2n.currentSettings.user.mute = String(f2n.utils.getMuteState(dplayer));
      var lo = $.extend(true, {}, f2n.defaults, options, f2n.currentSettings.user, f2n.acon, { 'flashvars': {'mute': ''+String(f2n.utils.getMuteState(dplayer)) }});
      $.reloadPlayer(lo);
    });


    var acoff = $('#'+conid+' .acoff');
    acoff.unbind();
    acoff.bind('click', function() {
      dplayer.sendEvent("STOP");
      $('#'+conid+' .scrubber').slider('option', 'value', 0);
      $('#'+conid+' .currenttime').html('00:00');
      f2n.currentSettings.user.event = 'acoff';
      f2n.currentSettings.user.flashvars['audiodescription.state'] = 'false';
      f2n.currentSettings.user.acbutton = 'block';
      f2n.currentSettings.user.mute = String(f2n.utils.getMuteState(dplayer));
      var lo = $.extend(true, {}, f2n.defaults, options, f2n.currentSettings.user, f2n.acoff, { 'flashvars': {'mute': ''+String(f2n.utils.getMuteState(dplayer)) }});
      $.reloadPlayer(lo);
      
    });
    
    

    var cc = $('#'+conid+' .cc');
    cc.unbind();
    cc.bind('click', function() {
      f2n.currentSettings.user.event = 'cc';
      f2n.currentSettings.user.flashvars['captions.state'] = 'true';
      f2n.currentSettings.user.ccbutton = 'none';
      f2n.currentSettings.user.mute = String(f2n.utils.getMuteState(dplayer));
      var lo = $.extend(true, {}, f2n.defaults, options, f2n.currentSettings.user, f2n.ccon, { 'flashvars': {'mute': ''+String(f2n.utils.getMuteState(dplayer)) }});
      $.reloadPlayer(lo);
    });

    var ccoff = $('#'+conid+' .ccoff');
    ccoff.unbind();
    ccoff.bind('click', function() {
      dplayer.sendEvent("STOP");
      $('#'+conid+' .scrubber').slider('option', 'value', 0);
      $('#'+conid+' .currenttime').html('00:00');
      f2n.currentSettings.user.event = 'ccoff';
      f2n.currentSettings.user.flashvars['captions.state'] = 'false';
      f2n.currentSettings.user.ccbutton = 'block';
      f2n.currentSettings.user.mute = String(f2n.utils.getMuteState(dplayer));
      var lo = $.extend(true, {}, f2n.defaults, options, f2n.currentSettings.user, f2n.ccoff, { 'flashvars': {'mute': ''+String(f2n.utils.getMuteState(dplayer)) }});
      $.reloadPlayer(lo);
    });

    var ihelp = $('#'+conid+' .ihelp');
    ihelp.unbind();
    ihelp.bind('click', function() {
      f2n.utils.get_target(options.help, '1024', '768', false);
      return false;
    });

    if(f2n.currentSettings.user.event != 'load'){

      if(f2n.currentSettings.user.acbutton){
        if(f2n.currentSettings.user.acbutton == 'none'){ 
          ac.each(function() {
            $(this).addClass('disabled');
            this.disabled = true;
            
          });
          acoff.removeClass('disabled').removeAttr('disabled');
          f2n.utils.checkDisabled();
        }
        else{
          acoff.each(function() {
            $(this).addClass('disabled');
            this.disabled = true;
            
          });
          ac.removeClass('disabled').removeAttr('disabled'); 
          f2n.utils.checkDisabled();
        }
      }
      if(f2n.currentSettings.user.ccbutton){
       if(f2n.currentSettings.user.ccbutton == 'none'){ 
         cc.each(function() {
            $(this).addClass('disabled');
            this.disabled = true;
            
         });
         ccoff.removeClass('disabled').removeAttr('disabled');
         f2n.utils.checkDisabled();
       }
       else{ 
         ccoff.each(function() {
            $(this).addClass('disabled');
            this.disabled = true;
            
         });
         cc.removeClass('disabled').removeAttr('disabled'); 
         f2n.utils.checkDisabled();
       }
      }
      
    }

 
    if(win_ie){
      var pLang = $('#'+conid+' object').attr('lang');
      $('#'+conid+' .topskip').append('<a class="to_controls zoom_link" id="zoom_link_'+conid+'" name="zoom_link_'+conid+'" href="#basic_link_'+conid+'">'+f2n.utils.getLangOptions('zoom_link', pLang, false)+'</a>');
      $('#'+conid+' .bottomskip').append('<a class="to_controls basic_link" id="basic_link_'+conid+'" name="basic_link_'+conid+'" href="#zoom_link_'+conid+'">'+f2n.utils.getLangOptions('basic_link', pLang, false)+'</a>');
    }
    f2n.utils.checkDisabled();
    f2n.utils.setButtonHover('#'+conid+' button');
    

  } else {
      setTimeout("setControls()",200);      
    }
  };


/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
  f2n.defaults = {
    'lang': 'de',
    'width': "100%",
    'height': "100%",
    'help': location.href,
    'disabled': '_gray',
    'plugstate': { 
      'dstate': 'false'
    },
    flashparams: {
      'allowfullscreen': 'true',
      'allowscriptaccess': 'always',
      'scale': 'scale',
      'quality': 'high',
      'bgcolor': '#C3D6DD'
    },
    flashattr: {
    },
    flashvars: {
      'mute': 'false',
      'volume': '60',
      'screencolor': '#C3D6DD',
      'stretching': 'uniform',
      'playerready': 'playerReadyCallback',
      'autostart': 'false',
      'dock': 'false',
      'icons': 'false'
    }
  }; /* f2n.defaults */
  
  f2n.currentSettings = {
    'user':{
      'event': 'load',
      'totaltime': 1,
      'buffered': false,
      'flashvars': {
      
      }
    }
  };/* f2n.currentSettings */
  

  f2n.acon = {
    flashvars: {
      'audiodescription.state': 'true',
      'autostart': 'true'
    }
  }; /* f2n.acon */

  f2n.acoff = {
    flashvars: {
      'audiodescription.state': 'false',
      'autostart': 'false'
    }
  }; /* f2n.acoff */

  f2n.ccon = {
    flashvars: {
      'captions.state': 'true',
      'autostart': 'true'
    }
  }; /* f2n.ccon */

  f2n.ccoff = {
    flashvars: {
      'captions.state': 'false',
      'autostart': 'false'
    }
  }; /* f2n.ccoff */
  
  f2n.zoom = {
    'width': '100%',
    'height': '100%',
    'flashvars': {
      'autostart': 'true'
    }
  }; /* f2n.zoom */
  

  f2n.zoom0 = {
    'flashvars': {
      'autostart': 'true'
    }
  }; /* f2n.zoom */

/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */  
  f2n.utils = {

    /* + + + + + + + + + + + + + + + + */
    /* hasRequiredFlashVersion */
    has_regVersion: function(reqVer){

    var pluginVer = this.getSWFObject().getFlashPlayerVersion();
    if ('string' == typeof(reqVer)) { reqVer = reqVer.split('.'); }

    reqVer.major = reqVer[0] != null ? parseInt(reqVer[0]) : 0;
    if (pluginVer.major < reqVer.major) { return false; }
    if (pluginVer.major > reqVer.major) { return true;  }

    reqVer.minor = reqVer[1] != null ? parseInt(reqVer[1]) : 0;
    if (pluginVer.minor < reqVer.minor) { return false; }
    if (pluginVer.minor > reqVer.minor) { return true;  }

    reqVer.release = reqVer[2] != null ? parseInt(reqVer[2]) : 0;
    if (pluginVer.release < reqVer.release) { return false; }

    return true;
  },  /* has_regVersion */

  /* + + + + + + + + + + + + + + + + */
  /* getSWFObject */
  getSWFObject: function(){
    if ('object' == typeof(f2n.HELPER) || 'function' == typeof(f2n.HELPER)) { 
      return f2n.HELPER;
    }
    return ('object' == typeof(swfobject) || 'function' == typeof(swfobject)) ? swfobject : null;
  },  /* getSWFObject */

  /* + + + + + + + + + + + + + + + + */
  /* writeErrorMsg */
  writeErrorMsg: function(errortext, pLang){
    if(errortext){
      var pluginVer = this.getSWFObject().getFlashPlayerVersion();
      
      var msg = " "+ f2n.utils.getLangOptions('errorFlash', pLang, false) + " ";
      $(errortext).html(msg);
      var msgSuffix = (pluginVer.major != 0 || pluginVer.minor != 0 || pluginVer.release != 0)
        ? f2n.utils.getLangOptions('errorFlashversion', pLang, false) + " "+ pluginVer.major + "." + pluginVer.minor + "." + pluginVer.release + ". "+f2n.utils.getLangOptions('errorFlashupdate', pLang, false)
        : f2n.utils.getLangOptions('errorNoflash', pLang, false);
      $(errortext).after('<p class="error errorsuffix">'+msgSuffix+'</p>');
    }
  },  /* writeErrorMessage */

  /* + + + + + + + + + + + + + + + + */
  /* writeOptionsMsg */
  writeOptionsMsg: function(container, pLang){
    var msg = f2n.utils.getLangOptions('errorOptions', pLang, false);
    if(container){
      $(container+' p:not(.error)').remove();
    }
    $(container+' p.error').replaceWith('<p class="error optionserror">'+msg+'</p>');
  },  /* writeOptionsMessage */

  /* + + + + + + + + + + + + + + + + */
  /* getVideoOptions */
    getVideoOptions: function(key, options, is_basic){
      var result = null;
      if ('object' == typeof(options)) {
        result = options[key];
      }/* if */
      if (!result) {
        if(is_basic) options_error = true;
        return "";
      }
        return result;
    },  /* getVideoOption */

  /* + + + + + + + + + + + + + + + + */
  /* getVideoFuncs */
    getVideoFuncs: function(key, settings, is_basic){
      var result = null;
      if ('object' == typeof(settings)) {
        result = settings.show_funcs[key];
      }/* if */
      if (!result) {
        if(is_basic) 
          funcs_error = true;
          result = false;
      }
        return result;
    },  /* getVideoFuncs */

  /* + + + + + + + + + + + + + + + + */
  /* getLangOptions */
    getLangOptions: function(key, pLang, is_basic){
      if('en' == pLang.toLowerCase()){ 
       return f2n.utils.getVideoOptions(key,langEN, is_basic);
      }else{
       return f2n.utils.getVideoOptions(key,langDE, is_basic);
      }
    },  /* getLangOptions */


  /* + + + + + + + + + + + + + + + + */
  /* little helpers */
    volpad: function(value){
      return Math.round(value/33);
    },

    getMuteState: function(dplayer){
      return dplayer.getConfig()['mute'];
    },

    numpad: function(s,l) {
      return( l.substr(0, (l.length-s.length) )+s );
    },

    play: function(obj){
      obj.sendEvent("PLAY");
      return false;
    },

    stop: function(obj){
      obj.sendEvent("STOP");
      return false;
    },

    setVolume: function(slider, value){
      slider.slider('option', 'value', value);
    },

    setVolumeList: function(value){
      $("#pvolume li").removeClass('active');
      $("#pvolume li#pvolume_"+value).addClass('active');
    },

    formatTime: function(seconds){
      var result = "";
      var remaining = Math.floor(seconds);
      
      if (seconds > 3600){
        result += f2n.utils.numpad((Math.floor(remaining/3600)).toString(),"00")+":";
        remaining = remaining % 3600;
      }
      
      result += f2n.utils.numpad((Math.floor(remaining/60)).toString(),"00")+":";
      remaining = remaining % 60;
    
      result += f2n.utils.numpad(remaining.toString(),"00")+"";
      
      return result;
    },

    set_seektime: function(seconds){
      return ( (11 < Math.floor(seconds)) ? Math.floor(seconds) : 11 );
    },  

    fastforward: function(currenttime,totaltime){
      var jump = (totaltime/5);
      if(currenttime > (totaltime - jump +5)) return totaltime-3;
      else return currenttime+jump;
    },

    reward: function(currenttime,totaltime){
      var jump = (totaltime/5);
      if(currenttime < jump) { return 1; }
      else if (currenttime > jump) { return currenttime-jump; }
    },

    checkDisabled: function(){
     $('.playerwrapper button').each(function() {
      if($(this).hasClass('disabled')) $(this).css('opacity','0.5');
      else $(this).css('opacity','1');
    });
    },

    setButtonHover: function(elem){
      $(elem).bind('mouseover focus', function() {
        f2n.utils.changeImage(this,/_default./,"_hover.");
      }).bind('mouseout blur', function(){
        f2n.utils.changeImage(this,/_hover./,"_default.");
      });
    },

    changeImage: function(button,imgRE,newImg){
      try{
        if(!$(button).hasClass('disabled')){
          var hoversrc = String($(button).find("img").attr("src")).replace(imgRE,newImg);
          if(hoversrc != "undefined"){ $(button).find("img").attr("src",hoversrc);}
        }
      }catch(err){
        //alert(err);
      }
    },
    activateSlider: function(is_playing, slider){
      alert(is_playing);
     if(!is_playing) $(slider).slider('option', 'value', 0);;
    },
     /* little helpers */


  /* + + + + + + + + + + + + + + + + */
  /* loadPlayer */
    loadPlayer: function( options ){
      var tmp = $.extend(true, {}, f2n.defaults, options);
      var helper = f2n.utils.getSWFObject();
      if (!helper){
        f2n.utils.writeOptionsMessage('#'+tmp.pid, tmp.lang);
        return;
      }/* if */
      if( $('#'+tmp.pid+' .videoplayer' ).attr('id')=='' ){
        $('#'+tmp.pid+' .videoplayer').attr('id','zoom1');
      }
      $('#'+tmp.pid+' #zoom1 .inner').css({'width': function() { if(-1 == (tmp.width).indexOf('%')) return tmp.width+'px'; else return tmp.width; }, 'height': function() { if(-1 == (tmp.height).indexOf('%')) return tmp.height+'px'; else return tmp.height; }});
      $('#'+tmp.pid+' .inner').html('<div id="'+tmp.objid+'"></div>');
      swfobject.embedSWF(tmp.player,tmp.objid, '100%', '100%', tmp.version, false, tmp.flashvars, tmp.flashparams, tmp.flashattr);
      f2n.utils.checkDisabled();
    }, /* loadPlayer */

  /* + + + + + + + + + + + + + + + + */
   /*  getFlashvars */
    getFlashvars: function(objid, options, addoptions){
      var dplayer = documentgetElementById(objid);
      
    },  /* getFlashvars */
    
    get_target: function(t_url, t_width, t_height, is_popup){
      var args = '';
      if(is_popup){
        args = 'width='+t_width+',height='+t_height+',resizable,scrollbars'; 
      }
      ok = window.open(t_url,'',args);
      if(ok) ok.focus();
    },

  /* + + + + + + + + + + + + + + + + */
  /* controlset */
    controlset: function(currentsettings){
      var result = '';
      result += '<fieldset class="'+currentsettings.prefix+'s '+currentsettings.controlclass+'"><legend>'+currentsettings.intro+'</legend>';
      
      switch(currentsettings.controlclass){
        case 'basic':
          result += f2n.utils.build_buttonset(currentsettings);
          break;
        case 'help':
          result += f2n.utils.build_buttonset(currentsettings);
          break;
        case 'zoom':
          result += f2n.utils.build_buttonset(currentsettings);
          break;
        case 'sound':
          result += f2n.utils.build_spanset(currentsettings);
          result += f2n.utils.build_buttonset(currentsettings);
          result += f2n.utils.build_list(currentsettings);
          break;
        case 'playback':
          result += f2n.utils.build_buttonset(currentsettings);
          result += f2n.utils.build_slider(currentsettings);
          result += f2n.utils.build_spanset(currentsettings);
          break;
        case 'synch':
          result += f2n.utils.build_boxbuttonset(currentsettings);
        default:
          break;
      }
    
      result += '<div class="clearBoth"></div></fieldset>';
      return result;
    }, /* controlset */


    /* + + + + + + + + + + + + + + + + */
    /* build_buttonset */
    build_buttonset: function(currentsettings){
      var result = '';
      for (element in currentsettings.elements){
        result += '<div class="buttonwrapper wrapper'+element+'">';
        var style = ""; var inner = ""; var title=""; var attr =""; var pref=""
        for (attrElem in currentsettings.elements[element]){
          if(attrElem=='buttonprefix'){ pref += '<span class="buttonprefix">'+currentsettings.elements[element][attrElem]+'</span>'; }
          if(attrElem=='button'){ inner += currentsettings.elements[element][attrElem]; }
          else if(attrElem=='title'){ title += currentsettings.elements[element][attrElem]; }
          else if(attrElem=='attr'){ attr += currentsettings.elements[element][attrElem]; }
          else style += attrElem+":"+currentsettings.elements[element][attrElem]+";";
        }
        result += pref+'<button type="button" '+attr+' class="'+currentsettings.prefix+' '+element+' '+attr+'" style="'+style+'" title="'+title+'">'+inner+'</button>';
        result += '</div>';
      }
      return result;
    },/* build_buttonset */

    /* + + + + + + + + + + + + + + + + */
    /* build_boxbuttonset */
    build_boxbuttonset: function(currentsettings){
      var result = '<div class="buttonset">';
      result += f2n.utils.build_buttonset(currentsettings);
      result += '<div class="clearBoth"></div></div>';
      return result;
    },/* build_buttonset */

    /* + + + + + + + + + + + + + + + + */
    /* build_spanset */
    build_spanset: function(currentsettings){
      var result = '';
      for (element in currentsettings.selements){
        result += '<div class="wrapper'+element+'">';
        var label = ""; var value="";
        for (attrElem in currentsettings.selements[element]){
          if(attrElem=='label'){ label += currentsettings.selements[element][attrElem]; }
          else if(attrElem=='value'){ value += currentsettings.selements[element][attrElem]; }
        }
        result += '<span class="label">'+label+':&nbsp;</span><span class="'+currentsettings.prefix+' '+element+'">'+value+'</span>';
        result += '</div>';
      }
      return result;
    },/* build_spanset */


    /* + + + + + + + + + + + + + + + + */
    /* build_slider */
    build_slider: function(currentsettings){
      var result = '';
      for (element in currentsettings.slider){
        result += '<div class="wrapper'+element+'">';
        result += '<div class="'+currentsettings.prefix+' '+element+'"></div>';
        result += '</div>';
      } 
      return result;
    },/* build_slider */


    /* + + + + + + + + + + + + + + + + */
    /* build_select */
    build_select: function(currentsettings){
      var result = '';
      for (element in currentsettings.felements){
        result += '<div class="wrapper'+element+'">';
        var label = ""; var sid="";
        for (attrElem in currentsettings.felements[element]){
          if(attrElem=='label'){ label += currentsettings.felements[element][attrElem]; }
          else if(attrElem=='id'){ sid += currentsettings.felements[element][attrElem]; }
        }
        result += '<label for="'+sid+'"><span>'+label+'</span><select class="formElement" name="'+sid+'" id="'+sid+'"><optgroup label="Ton"><option value="5">5</option><option value="4">4</option><option value="3">3</option><option value="2">2</option><option value="1">1</option><option value="0">0</option></optgroup></select';
        result += '</div>';
      }
      return result;
    }, /* build_select */


    /* + + + + + + + + + + + + + + + + */
    /* build_list */
    build_list: function(currentsettings){
       var result = '';
       for (element in currentsettings.lelements){
        result += '<div class="wrapper'+element+'">';
        var label = ""; var sid=""; var prefix=""; 
        var vol = ["0","1", "2", "3"];
        for (attrElem in currentsettings.lelements[element]){
          if(attrElem=='label'){ label += currentsettings.lelements[element][attrElem]; }
          else if(attrElem=='id'){ sid += currentsettings.lelements[element][attrElem]; }
          else if(attrElem=='prefix'){ prefix += currentsettings.lelements[element][attrElem]; }
          else if(attrElem=='sound_volume'){ 
            for(var num=0; num<=3; num++){
              vol[num] = currentsettings.lelements[element][attrElem][num]; 
            }
          }
        }
        result += '<br class="out"><span>'+label+'</span><ul id="'+sid+'">';
        for(var i=0; i<=3; i++){
          result += '<li class="pvolume '+currentsettings.prefix+'" id="pvolume_'+i+'"><button title="'+vol[i]+'"><span class="out">'+prefix+': '+i+' '+ vol[i]+'</span></button></li>';
        }
        result += '</ul></div>';
      }
      return result;
    }/* build_list */

  }; /* f2n.utils  */

/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */

 })(jQuery); 





