function flvApear(id) {
  var bodyHeight = $('B0101000').getStyle('height');
  $('overlay').setStyle({
    height: bodyHeight,
    opacity: 0
    });
  var pos = getRect('posFlvDiv');
  var left = pos.left + 'px';
  var top = pos.top + 'px';
  $('flvDiv').setStyle({
    left: left,
    top: top,
    opacity: 0
    });
  $('overlay').show();
  $('flvVideo').innerHTML = '<img src="../../images/basics/progress_large.gif" width="54" height="55" alt="Loading" style="margin-top: 100px;" />';
  $('flvDiv').show();
  
  new Effect.Opacity('overlay',
    { duration: 0.3, 
      transition: Effect.Transitions.linear, 
      from: 0, to: 0.5 });
  new Effect.Opacity('flvDiv',
    { duration: 0.3, 
      transition: Effect.Transitions.linear, 
      from: 0, to: 1.0 });

  window.setTimeout('writeFlash(' + id + ')', 400);
  Event.observe(window, 'keypress', function(element) {
    var k = element.keyCode;
    if(k == 27) flvDisapear();
  } );
}
function flvDisapear() {
  $('flvVideo').innerHTML = ''; // Flashfilm löschen, ausblenden geht bei Flash nicht

  new Effect.Opacity('overlay',
    { duration: 0.3, 
      transition: Effect.Transitions.linear, 
      from: 0.5, to: 0.0 });
  new Effect.Opacity('flvDiv',
    { duration: 0.3, 
      transition: Effect.Transitions.linear, 
      from: 0.5, to: 0.0 });

  window.setTimeout("hideFlvDivs()", 310);  // Nach dem Ausblenden die DIVs verstecken 
}


function hideFlvDivs() {
  $('overlay').hide();
  $('flvDiv').hide();
}

function writeFlash(id) {
  /*
  new Ajax.Request('/include_php/ajax_video.php',
    {
      method:'get',
      onSuccess: function(transport) {
                 var response = transport.responseText || "no response text";
                 $('flvDiv').innerHTML = response;      
      },
      onFailure: function(){ alert('Something went wrong...') }
    });
  */
		var fo = new SWFObject("/flash/player_mit_copytext.swf?xmlFile=/flv_" + id + ".xml", "player_mit_copytext.swf", "490", "604", "8", "");
    fo.addParam("wmode", "opaque");
		fo.write("flvVideo");
}


/*
 *   Globale Funktionen
 */
function getRect (o)
{
    var r = { top:0, left:0, width:0, height:0 };

    if(!o) return r;
    else if(typeof o == 'string' ) o = document.getElementById(o);
    
    if( typeof o != 'object' ) return r;

    if(typeof o.offsetTop != 'undefined')
    {
         r.height = o.offsetHeight;
         r.width = o.offsetWidth;
         r.left = r.top = 0;
         while (o && o.tagName != 'BODY')
         {
              r.top  += parseInt( o.offsetTop );
              r.left += parseInt( o.offsetLeft );
              o = o.offsetParent;
         }
    }
    return r;
}
