function ShowFlash( url, width, height, ExtraParams ){
  html = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + width + '" height="' + height + '">';
  html += '<PARAM NAME=allowFlashAutoInstall VALUE=true>';
  html += '<param name="allowScriptAccess" value="sameDomain" />';
  html += '<PARAM NAME="loop" VALUE="true">';
  html += '<param name="movie" value="' + url + '" />';
  html += '<PARAM NAME="wmode" VALUE="transparent">';
  html += '<param name="quality" value="high" />';
  html += '<param name="bgcolor" value="#ffffff" />';
  if ( ExtraParams ){ 
    for( Prms in ExtraParams ){ 
      html += '<param name="' + Prms + '" value="' + ExtraParams[ Prms ] + '"/>';
    }
  }
  html += '<embed src="' + url + '" ';
  if ( ExtraParams ){
    for( Prms in ExtraParams ){
      html += Prms + '="' + ExtraParams[ Prms ] + '" ';
    }
  }
  html += ' wmode="transparent" swLiveConnect="true" loop="true" quality="high" bgcolor="#ffffff" width="' + width + '" height="' + height + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
  html += '</object>';
  document.write( html );
}


var SliderInfo = {
  Speed: 10,
  Direction: 1,
  Interval: null,
  IntervalTime: 30,
  Holder: { Width: 0, Left: 0, Element: null },
  Scroller: { Width: 0, Left: 0, Element: null }
};

function SliderRun( Direction )  {
  SliderInfo.Direction = Direction;
  SliderInfo.Holder.Element = document.getElementById( 'ProductHolder' );
  SliderInfo.Scroller.Element = document.getElementById( 'ProductScroller' );

  if ( SliderInfo.Interval ){
    SliderStop();
  }

  if ( SliderInfo.Holder.Element && SliderInfo.Scroller.Element ){
    SliderInfo.Holder.Width = SliderInfo.Holder.Element.offsetWidth;
    SliderInfo.Holder.Left = SliderInfo.Holder.Element.offsetLeft;
    SliderInfo.Scroller.Width = SliderInfo.Scroller.Element.offsetWidth;
    SliderInfo.Scroller.Left = SliderInfo.Scroller.Element.offsetLeft;
    SliderInfo.Interval = setInterval( 'SliderStep()', SliderInfo.IntervalTime );
  }
}

function SliderStep(){

  if ( SliderInfo.Direction < 0 ){
    var NewLeft = SliderInfo.Scroller.Left - ( SliderInfo.Direction * SliderInfo.Speed );
    if ( NewLeft > 0 ){
      NewLeft = 0;
      SliderStop();
    }
    SliderInfo.Scroller.Left = NewLeft;
    SliderInfo.Scroller.Element.style.left = NewLeft + 'px';
  } 
  if ( SliderInfo.Direction > 0 ){
    var NewLeft = SliderInfo.Scroller.Left - ( SliderInfo.Direction * SliderInfo.Speed );
    if ( NewLeft <= SliderInfo.Holder.Width - SliderInfo.Scroller.Width ){
      NewLeft = SliderInfo.Holder.Width - SliderInfo.Scroller.Width;
      SliderStop();
    }
    SliderInfo.Scroller.Left = NewLeft;
    SliderInfo.Scroller.Element.style.left = NewLeft + 'px';
  }
}

function SliderStop( )  {
  clearInterval( SliderInfo.Interval );
}

var GroteFotoFader = {
  Min: 0,
  Step: 2,
  Max: 100,
  Current: 0,
  Interval: null,
  IntervalTime: 30,
  Element: null
};

function OpenGroteFoto( ID, Url, Width, Height ){
  var FotoOmschrijving = document.getElementById( 'FotoOmschrijving' );
  var Omschrijving = document.getElementById( 'FO' + ID );
  var FotoDiv = document.getElementById( 'FotoDiv' );
  if ( FotoOmschrijving && Omschrijving && FotoDiv ){
    FotoOmschrijving.innerHTML = Omschrijving.innerHTML;
    FotoOmschrijving.style.display = 'block';
    FotoDiv.style.display = 'block';

    FotoDiv.style.width = Width + 'px';
    FotoDiv.style.height = Height + 'px';
    FotoDiv.style.left = Math.floor( 500 - Width / 2 ) + 'px';
    FotoDiv.style.top = Math.floor( 275 - Height / 2 ) + 'px';
    FotoDiv.style.backgroundImage = 'url(' + Url + ')';
    GroteFotoFader.Element = FotoDiv;
    GroteFotoStop();
    GroteFotoFader.Current = GroteFotoFader.Min;
    setOpacity( GroteFotoFader.Element, GroteFotoFader.Current );
    GroteFotoFader.Interval = setInterval( 'GroteFotoStep()', GroteFotoFader.IntervalTime );
  }
}

function GroteFotoStep(){
  GroteFotoFader.Current = GroteFotoFader.Current += GroteFotoFader.Step;
  if ( GroteFotoFader.Current >= GroteFotoFader.Max ){
    GroteFotoFader.Current = GroteFotoFader.Max;
    GroteFotoStop();
  }
  setOpacity( GroteFotoFader.Element, GroteFotoFader.Current );
}

function GroteFotoStop(){
  clearTimeout( GroteFotoFader.Interval );
}

function CloseGroteFoto(){
  var FotoDiv = document.getElementById( 'FotoDiv' );
  var FotoOmschrijving = document.getElementById( 'FotoOmschrijving' );
  if ( FotoDiv && FotoOmschrijving ){
    FotoOmschrijving.style.display = 'none';
    FotoDiv.style.display = 'none';
  }
}

function setOpacity(obj, opacity) {

  opacity = (opacity == 100)?99.999:opacity;

  // IE/Win
  obj.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="
+ opacity + ");";

  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;

  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;

  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}


