//---------------------------------------
//    DL General JavaScript Routines
//        for DigiShop system
//---------------------------------------
//
//       Removal of this copyright
//           notice is illegal
//
//   (c)1999-2006 DigiLog multimedia
//         Saarbruecken, Germany
//         http://www.digilog.de
//
//          All rights reserved.
//
//---------------------------------------

// ----------------
// Immediate Inits:
// ----------------



// ----------------
// Functions
// ----------------


// ---------
// --- INSERT A FLASH MOVIE
// ---------

function InsertFlash(flashURL, w, h, version){
  if(version=='')  version='6,0,0,0';
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+w+'" height="'+h+'" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+version+'">');
  document.write('<param name="allowScriptAccess" value="sameDomain" />');
  document.write('<param name=movie value="'+flashURL+'" />');
  document.write('<param name="quality" value="high" />');
  document.write('<param name="wmode" value="opaque" />');  // this allows DHTML elements in front of Flash and prevents screenreaders (like JAWS) from getting stuck of Flash
  document.write('<embed src="'+flashURL+'" type="application/x-shockwave-flash" quality="high" width="'+w+'" height="'+h+'" wmode="opaque" allowScriptAccess="sameDomain" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
  document.write('</object>');
}

/*
function InsertFlashOrStatic(flashURL, staticURL, w, h){
  if(!useRedirect){
    if(hasRightVersion && flashURL!=''){
    // ----- Use Flash Animation -----
      document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+w+'" height="'+h+'">');
      document.write('<param name="allowScriptAccess" value="sameDomain" />');
      document.write('<param name=movie value="'+flashURL+'" />');
      document.write('<param name="quality" value="high" />');
      document.write('<param name="wmode" value="opaque" />');  // this allows DHTML elements in front of Flash and prevents screenreaders (like JAWS) from getting stuck of Flash
      document.write('<embed src="'+flashURL+'" type="application/x-shockwave-flash" quality="high" width="'+w+'" height="'+h+'" wmode="opaque" allowScriptAccess="sameDomain"></embed>');
      document.write('</object>');
    }else{
      // ----- Use Static Image -----
      document.write('<img src="'+staticURL+'" width="'+w+'" height="'+h+'">');
    }
  }
}
*/


// popup a window to show a Flash video file (.flv). 
// this function is similar to JS function popupWindow() in file product_info.php 
// and we use the same window name and similar JS sizing techniques.
function popupFlvWin(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}


// ---------
// --- INSERT A WINDOWS MEDIA FILE
// ---------

winMediaPlayerCount=0;

function InsertWinMedia(mediaURL, width, height, loops, showctrl, showstat) {
  // add height for navpanel and for the statusbar (if active)
  winMediaPlayerCount++;
  
  if(showctrl)  height+=45;
  if(showstat)  height+=24;

  var code='';
  code += '<object ' + '\n';
  code += '  width="' + width + '" ' + '\n';
  code += '  height="' + height + '" ' + '\n';
  code += '  classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" ' + '\n';
  code += '  codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ' + '\n';
  code += '  type="application/x-oleobject" ' + '\n';
  code += '  standby="Loading Microsoft® Windows® Media Player components..." ' + '\n';
  code += '  id="MediaPlayer' + winMediaPlayerCount + '">' + '\n';
  code += '    <param name="Filename" value="' + mediaURL + '" />' + '\n';
  code += '    <param name="AutoStart" value="True" />' + '\n';
  code += '    <param name="AutoRewind" value="True" />' + '\n';
  code += '    <param name="ShowControls" value="' + (showctrl?'True':'False') + '" />' + '\n';
  code += '    <param name="ShowStatusBar" value="' + (showstat?'True':'False') + '" />' + '\n';
  code += '    <param name="ShowDisplay" value="False" />' + '\n';
  code += '    <param name="playCount" value="' + loops + '" />' + '\n';
  code += '    <param name="Volume" value="-1" />' + '\n';
  code += '    <embed ' + '\n';
  code += '      type="application/x-mplayer2" ' + '\n';
  code += '      pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" ' + '\n';
  code += '      name="MediaPlayer' + winMediaPlayerCount + '" ' + '\n';
  code += '      width="' + width + '" ' + '\n';
  code += '      height="' + height + '" ' + '\n';
// src only works for http:// protokoll, not for mms:// where the filename attribute is needed. But filename works for both!!!
//  code += '      src="' + mediaURL + '" ' + '\n';
  code += '      filename="' + mediaURL + '" ' + '\n';
  code += '      autostart="1" ' + '\n';
  code += '      autorewind="1" ' + '\n';
  code += '      showcontrols="' + (showctrl?'1':'0') + '" ' + '\n';
  code += '      showstatusbar="' + (showstat?'1':'0') + '" ' + '\n';
  code += '      showdisplay="0" ' + '\n';
  code += '      playCount="' + loops + '" ' + '\n';
  code += '      volume="-1" ' + '\n';
  code += '      >' + '\n';
  code += '    </embed>' + '\n';
  code += '</object>' + '\n';
  
  document.write(code);
}


// ---------
