  function get_cddb (id, cddb){
    if( cddb == null ){
      document.getElementById('cont'+id).display = 'block';
      document.getElementById('cont'+id).innerHTML = '<br />Keine Daten vorhanden.';
    } else {
      var xmlHttp = null;
      try {
          // Mozilla, Opera, Safari sowie Internet Explorer (ab v7)
          xmlHttp = new XMLHttpRequest();
      } catch(e) {
          try {
              // MS Internet Explorer (ab v6)
              xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
          } catch(e) {
              try {
                  // MS Internet Explorer (ab v5)
                  xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
              } catch(e) {
                  xmlHttp  = null;
              }
          }
      }
    
      var cddbstr = '';
      var cddbarr = cddb.split( '|' );
      for( var i = 0; i<cddbarr.length; i++) {
        if( i > 0 ){
          cddbstr += '&';
        }
        cddbstr += 'id[]='+cddbarr[i];
      }
      //alert( cddbstr );
      if(xmlHttp) {
        xmlHttp.open( 'GET', '/media/cddb.php?'+cddbstr, true );
        xmlHttp.onreadystatechange = function () {
          if( xmlHttp.readyState == 4 && xmlHttp.status == 200 ){
            document.getElementById('cont'+id).display = 'block';
            document.getElementById('cont'+id).innerHTML = xmlHttp.responseText;
          } else if ( xmlHttp.readyState == 4 && xmlHttp.status != 200 ) {
            document.getElementById('cont'+id).display = 'block';
            document.getElementById('cont'+id).innerHTML = '<br />Konnte Daten nicht von CDDB abrufen. <a href="javascript:get_cddb(\''+id+'\',\''+cddb+'\');">Erneut versuchen</a>';
          } else {
            document.getElementById('cont'+id).display = 'block';
            document.getElementById('cont'+id).innerHTML = '<br />Lade...'
          }
        }
        xmlHttp.send( null );
      }
    }
  }
  
  function get_img (id, img){
    if( img != '' ){
      document.getElementById('img'+id).display = 'block';
      document.getElementById('img'+id).innerHTML = '<a href="http://www.amazon.de/gp/product/'+img+'?ie=UTF8&amp;tag=stephande-21&amp;linkCode=as2&amp;camp=1638&amp;creative=19454&amp;creativeASIN='+img+'"><img border="0" src="/img/amazon/'+img+'.jpg" alt="bei Amazon kaufen" title="bei Amazon kaufen"></a>';
    } else {
      document.getElementById('img'+id).display = 'block';
      document.getElementById('img'+id).innerHTML = '<br />Kein Bild';
    }
  }
  
  function link_hide(id, cddb, amazon){
    document.getElementById('link'+id).href = 'javascript:hide(\''+id+'\',\''+cddb+'\',\''+amazon+'\');';
  }
  
  function hide(id, cddb, amazon){
    document.getElementById('img'+id).innerHTML = '';
    document.getElementById('img'+id).display = 'none';
    document.getElementById('cont'+id).innerHTML = '';
    document.getElementById('cont'+id).display = 'none';
    document.getElementById('link'+id).href = 'javascript:get_cddb(\''+id+'\',\''+cddb+'\');get_img(\''+id+'\',\''+amazon+'\');link_hide(\''+id+'\',\''+cddb+'\',\''+amazon+'\');';
  }
  
  function show_movie(id, img){
    if( img != '' ){
      document.getElementById('img'+id).innerHTML = '<a href="http://www.amazon.de/gp/product/'+img+'?ie=UTF8&amp;tag=stephande-21&amp;linkCode=as2&amp;camp=1638&amp;creative=19454&amp;creativeASIN='+img+'"><img border="0" src="/img/amazon/'+img+'.jpg" alt="bei Amazon kaufen" title="bei Amazon kaufen"></a>';
    } else {
      document.getElementById('img'+id).innerHTML = '<br />Kein Bild';
    }
    document.getElementById('table'+id).style.display = 'block';
    document.getElementById('link'+id).href = 'javascript:hide_movie(\''+id+'\', \''+img+'\');';
  }
  
  function hide_movie(id, amazon){
    document.getElementById('table'+id).style.display = 'none';
    document.getElementById('img'+id).innerHTML = '';
    document.getElementById('link'+id).href = 'javascript:show_movie(\''+id+'\', \''+amazon+'\');';
  }
