/*
 * This script is used to add the live view of a web camera to any web page.
 * It automatically detects if flash is installed and show an auto-refreshing
 * javascript based image if flash is not installed.
 *
 * Copyright (C) 2002 INDUNET GmbH
 *
 * http://www.indunet.it
 *
 * Version 1.0 (19.12.2002)
 *
 * by Udo Giacomozzi
 */

////////////// CONFIGURATION START ///////////////


// complete URL to webcam script
script_url = "http://webcam.rosskopf.com/webcam.asp";

// complete URL to Flash movie
flash_url = "http://webcam.rosskopf.com/view.swf?scripturl=http://webcam.rosskopf.com/webcam.asp&pluginurl=http://webcam.rosskopf.com/mwplugin.swf&ver=3";

// desired size of the image (pixels)
width = "100%";
height = "100%";

// size for non-flash version
swidth = 704;
sheight = 576;

// refresh time for JavaScript mode (seconds)
refresh_time = 60;


/////////////// CONFIGURATION END ////////////////

// TODO: This script does not check the version of the flash plugin installed.
//       The flash movie may be playable only by version 5 or higher players...


webcam_active = false;
function startwebcam() {

  if (!webcam_active) {
    webcam_active = true;

    webcam_init("webcam", script_url, refresh_time);
  }
}

// write code for Internet Explorer regardless whether Flash is installed or not
document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"');
document.write(' WIDTH='+width+' HEIGHT='+height+'>');
document.write(' <PARAM NAME=movie VALUE="'+flash_url+'"> ');
document.write(' <PARAM NAME=quality VALUE=high> ');

// NOTE: Everything inside the OBJECT Tag will be ignored when Flash is installed.
//       Netscape does not recognize this tag so it won't ignore the following code:

// detect Flash
flash_detected = false;
if (navigator.mimeTypes) {
  if (navigator.mimeTypes.length > 0) {
    if (navigator.mimeTypes["application/x-shockwave-flash"]) {
      flash_detected = true;
    }
  }
}

if (flash_detected) {

  // Flash detected (Netscape only) --> use EMBED tag

  document.write(' <EMBED src="'+flash_url+'" quality=high WIDTH='+width+' HEIGHT='+height+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
  document.write(' </EMBED>');
  

} else {

  // Flash not detected (start JavaScript mode)

  document.write('<img src="' + script_url + '" name="webcam" width="'+swidth+'" height="'+sheight+'" onLoad="startwebcam();">');

  // NOTE: We can't call webcam_init here directly because that way it would also be called
  // when flash is installed when the page is displayed by Internet Explorer.

  js_mode=true;

}

// close OBJECT tag
document.write('</OBJECT>');


// EOF
