jQuery(function(){

// Add an mp3 player
jQuery('a').each(function(){
  
  // Selection:
  if ( this.href.substr(-4).toLowerCase().indexOf('.mp3') < 0 ) return;

  // Definitions:
  var $this = jQuery(this);
  var flash_container_id;
  var flash_container;
  var player_swf;
  var flash_vars = {};
  var flash_param = { wmode: 'transparent' };
  var attributes = {};
  var width = 0;
  var height = 0;
  
  // create a new object
  // find a unique object name
  do {
    flash_container_id = 'flash_container_' + Math.round( Math.random() * 10000 );
  } while( jQuery('#' + flash_container_id).length > 0 );
  
  // generate an object code
  flash_container = '<span id="' + flash_container_id + '"></span>';
  
  // decide which player
  

  if ( $this.text() == $this.parent().text() && $this.find('img').length == 0){
    // the link is the only element in the paragraph / list item
    
    // Read the configuration
    height = 24;
        player_swf = 'http://www.disneyboekenclub.be/wp-content/plugins/audio-link-player/1pixelout/player-classic.swf';
    width = Math.round(height * 290 / 24);
        
    // Read the title of the mp3 link
    if ($this.attr('title') == '') $this.attr('title', $this.text());
    var caption = $this.attr('title');
    
    // Collect flash vars and parameters
    flash_vars.soundFile = escape(this.href.replace(/,/g, '%2C'));
    flash_vars.titles = ' ';
    flash_vars.artists = caption.replace(/,/g, ' ');
    flash_vars.autostart = 'no';
    flash_vars.width = width;
    flash_vars.height = height;
    flash_vars.bg = '0xcaf1ff';
    flash_vars.leftbg = '0x8fe0fe';
    flash_vars.lefticon = '0x1a2aa0';
    flash_vars.voltrack = '0x1a2aa0';
    flash_vars.volslider = '0x1a2aa0';
    flash_vars.rightbg = '0x8fe0fe';
    flash_vars.rightbghover = '0x8fe0fe';
    flash_vars.righticon = '0x1a2aa0';
    flash_vars.righticonhover = '0x1a2aa0';
    flash_vars.loader = '0x20a8e0';
    flash_vars.track = '0xcaf1ff';
    flash_vars.tracker = '0x5c71ca';
    flash_vars.border = '0x5c71ca';
    flash_vars.text = '0x1a2aa0';

    // Prepare the Flash Container for the player
        $this.replaceWith(flash_container);
    
    // Add the player:
    swfobject.embedSWF(player_swf, flash_container_id, width, height, "9.0.0", null, flash_vars, flash_param, attributes);
  }
    

  
}); // End of Each loop 
}); // End of DOM Ready Sequence
/* End of File */
