function url_to_param(url)
{ url = url.replace(/&/g,'%26');
  url = url.replace(/=/g,'%3D');
  url = url.replace(/\?/g,'%3F');
  return url;
}

function x_open(url,name,derefer)
{ var x;
  var breite = screen.availWidth;
  var hoehe = screen.availHeight;
  if (breite > 1024) breite = 1024;
  if (hoehe > 768) hoehe = 768;
  if (derefer == 'derefer')
  { url = url_to_param(url);
    url = 'http://www.steffen-winkler.de/cgi-bin/wi_derefer.pl?url='+url;
  }
  x = open(url,name,"width="+(breite-40)+",height="+(hoehe-200)+",screenX=0,screenY=0,menubar=yes,toolbar=yes,location=yes,status=yes,scrollbars=yes,resizable=yes");
  //geht nur mit self?
  //x.moveTo(10,10);
  //x.resizeTo(breite-50,hoehe-50);
  if (name == "return") return x;
}

function go_url(url)
{ if (url != '') window.location.href = url;
}

function kopf(par_name)
{ var name = par_name ? par_name.toLowerCase() : '';
  var alt = name == 'ilona' ? 'Ilona Schmidt' : 'Steffen Winkler';
  var groesse = screen.availWidth > 905 ? '1024' : '800';
  document.writeln
  ( '<table border="0" cellpadding="0" cellspacing="0" width="100%">\n',
    '<tr>\n',
    '<td align="left"><img src="http://www.steffen-winkler.de/logo/l'+name+groesse+'.gif" alt="'+alt+'"></td>\n',
    '<td align="center"><img src="http://www.steffen-winkler.de/logo/m'+name+groesse+'.gif" onClick="window.location.href=\'http://www.steffen-winkler.de/external.htm\'"></td>\n',
    '<td align="right"><img src="http://www.steffen-winkler.de/logo/r'+name+groesse+'.gif" alt="Meine Homepage"></td>\n',
    '</tr>\n',
    '</table>\n',
    '<hr color="#00007f">'
  );
  /* Fenster aus Frame befreien und in den Vordergrund bringen */
  if (top.frames.length > 0) top.location.href = self.location;
}

function button(text,url,activation)
{ if (text == '')
  { document.write
    ( '<tr><td></td></tr>\n'
    );
    return;
  }
  var rahmen    = activation ? '#7f0000' : '#00007f';
  var hintergr  = activation ? '#ffe8cc' : '#fff8dc'; // cornsilk
  var textfarbe = activation ? '#7f0000' : '#00007f';
  var nodeco    = document.all ? ' class="nodeco"' : '';
  document.write
  ( '<tr>\n',
    ' <td bgcolor="'+rahmen+'">\n',
    '  <table border="1" width="100%">\n',
    '   <tr>\n',
    '    <th class="fs1" bgcolor="'+hintergr+'">\n',
    ( url != '' ?
    '     <a'+nodeco+' href="'+url+'">\n' : '' ),
    '      <span style="color:'+textfarbe+'">'+text+'</span>\n',
    ( url != '' ?
    '     </a>\n' : '' ),
    '    </th>\n',
    '   </tr>\n',
    '  </table>\n',
    ' </td>\n',
    '</tr>\n'
  );
}


function zufallszahl(kleinsteZahl,Varianten)
{ return(Math.round(Math.random()*(Varianten-1))+kleinsteZahl);
}

function music(page)
{ var bgmusic = new Array(
    'amazing.mid',
    'bluedan.mid',
    'cheers.mid',
    'country1.mid',
    'doggie.mid',
    'funiculi.mid',
    'gmasock.mid',
    'gmmozart.mid',
    'gmpolka.mid',
    'home.mid',
    'johnnyb.mid',
    'klezmer.mid',
    'latin.mid',
    'mag7.mid',
    'midi10.mid',
    'midi11.mid',
    'midi13.mid',
    'midi22.mid',
    'midi26.mid',
    'midi37.mid',
    'midi39.mid',
    'mineeyes.mid',
    'moonlight.mid',
    'mozflute.mid',
    'robinson.mid',
    'rock.mid',
    'rush.mid',
    'shepherd.mid',
    'thatthing.mid',
    'ygladtr.mid'
  );
  var bgmusic2 = new Array(
    '1sweetday.mid',
    'ag.mid',
    'ave.mid',
    'bright.mid',
    'caa.mid',
    'cocojam.mid',
    'dancing.mid',
    'dasb.mid',
    'diesonne.mid',
    'do.mid',
    'ee.mid',
    'eine.mid',
    'es_geht_mir_gut.mid',
    'ever.mid',
    'fallinginlovebyelvis.mid',
    'feelings.mid',
    'feelove.mid',
    'flash.mid',
    'funfunfu.mid',
    'ganzinweiss.mid',
    'georgia.mid',
    'gghome.mid',
    'had.mid',
    'hello.mid',
    'herzilein-wildeckerherzbuben.mid',
    'hope.mid',
    'idea21.mid',
    'idream.mid',
    'ifhappy1.mid',
    'imm.mid',
    'ineed.mid',
    'johnnyb.mid',
    'lea.mid',
    'lone.mid',
    'lou.mid',
    'lovesome.mid',
    'madonna.mid',
    'mam.mid',
    'manchmal.mid',
    'mandy.mid',
    'michaela.mid',
    'midi6.mid',
    'missing.mid',
    'mond.mid',
    'moonl.mid',
    'myway.mid',
    'nowomannocry.mid',
    'pa.mid',
    'powerlov.mid',
    'poweroflove.mid',
    'prett.mid',
    'rj.mid',
    'sentjou.mid',
    'song3.mid',
    'stand.mid',
    'standbyme.mid',
    'summer.mid',
    'sun.mid',
    'thep.mid',
    'unchained.mid',
    'vomwind.mid',
    'whitney.mid',
    'withoutyou.mid',
    'words.mid',
    'wunder.mid',
    'zorbasdance.mid'
  );
  var bgmusic3 = new Array(
  );
  var bgmusic_weihn = new Array(
    'allejahrewieder.mid',
    'jingle.mid',
    'jingle_bells_country.mid',
    'jingle_bells_jazz.mid',
    'klinggloeckchen.mid',
    'leiserieselt.mid',
    'merry_christmas.mid',
    'oh_du_froehliche_klavier.mid',
    'oh_tannenbaum.mid',
    'otannen.mid',
    'santas.mid',
    'silentnight.mid',
    'stille_nacht_orgel.mid',
    'wewishu.mid'
  );
  var titel = bgmusic[zufallszahl(0,bgmusic.length)];
  var path = 'http://home.arcor.de/steffen.winkler/music/';
  var loop = 'true';
  switch(page.toLowerCase())
  { case 'album':
    case 'anm82001':
    case 'db82001':
    case 'external':
    case 'expo00':
    case 'gb82001':
    case 'gbilona':
    case 'gbstd':
    case 'haus':
    case 'ilona_puppen':
    case 'info82001':
    case 'ise82001':
    case 'kennwort':
    case 'korea89':
    case 'mikrolux':
    case 'schweiz01':
    case 'sg82001':
    case 'sitemap':
    case 'swwald00':
      titel = zufallszahl(0,bgmusic2.length+bgmusic3.length);
      if (titel < bgmusic2.length)
      { titel = bgmusic2[titel];
        path = 'http://home.arcor.de/steffen.winkler/music2/';
      }
      else
      { titel = bgmusic3[titel-bgmusic2.length]
        path = 'http://home.arcor.de/steffen.winkler/music3/';
      }
      break;
    case 'album99':
      titel = 'amazinggrace.mid';
      break;
    case 'andruref':
      titel = 'andruref.mpg';
      break;
    case 'anfahrt':
      titel = 'willtell.mid';
      break;
    //case 'home':
    //  titel = 'friedenstaube.mpg';
    //  loop = 'false';
    //  break;
    case 'argentina':
      titel = 'argentina.mpg';
      break;
    case 'bthatway':
      titel = 'bthatway.mpg';
      break;
    case 'korea':
      titel = 'meatloaf.mid';
      break;
    case 'likeice':
      titel = 'likeice.mpg';
      break;
    case 'mikrolux32':
      titel = 'ave.mid';
      path = 'http://home.arcor.de/steffen.winkler/music2/';
      break;
    case 'start':
      if (zufallszahl(0,2) == 0)
       titel = 'midi36.mid';
      else
       titel = 'newsflash.mid';
       loop = 'false';
      break;
    case 'swwald':
      titel = 'argentina.mpg';
      break;
    case 'weihn':
      titel = bgmusic_weihn[zufallszahl(0,bgmusic_weihn.length)];
      path = 'http://home.arcor.de/steffen.winkler/music_weihn/';
      break;
  }
  if (loop == 'true')
  { temp = url_to_param(window.location.href);
    if (document.all) document.writeln
    ( // Start of wi_stat
      '<table width="100%" cellpadding="0" cellspacing="0" border="0">\n',
      '<tr>\n',
      '<td align="left">\n',
      '<img src="http://www.steffen-winkler.de/cgi-bin/wi_stat.pl?url='+temp+'" border="0" width="100%">\n',
      '</td>\n',
      '<td>'
      // End of wi_stat
    );
    if (page != '') document.writeln
    ( '<div class="fs1" align="right">aktueller Musiktitel: '+titel+'</div>\n'
    );
    if (document.all) document.writeln
    ( // Start of wi_stat
      '</td>\n',
      '</tr>\n',
      '</table>'
      // End of wi_stat
    );
    if (page != '') document.writeln
    ( '<noembed><bgsound src="'+path+titel+'" loop="infinite"></noembed>'
    );
  }
  else
  { if (page != '') document.writeln
    ( '<noembed><bgsound src="'+path+titel+'"></noembed>'
    );
  }
  if (page != '') document.writeln
  ( '<embed src="'+path+titel+'" width="0" height="0" hidden="true" autostart="true" loop="'+loop+'">'
  );
}
