// *********************
// * kamera.czeladz.pl *
// *********************

function InstallFilter(prodName, ID, CLSID_filter, ver_filter, cab)
{
	document.write('<object ID="'+ ID + '" height="0" width="0" CLASSID="CLSID:' + CLSID_filter + '" CODEBASE="' + cab + '#Version=' + ver_filter + '">');
  document.write('<br>The ' + ID + ' that enables streaming video in Microsoft Internet Explorer, could not be registered on this computer. To install AXIS Media Control, you must have adminstration rights on this computer and you must answer Yes when asked if you wish to allow the installation. The ' + prodName + ' can also be configured to show still images.<BR></object>');  
}

function DrawAMC(height, width, imagepath, CLSID_AMC, ver_AMC, ShowAMCToolbar, ptzgui, useWithCam, camnbr, UseRel, UseMotion)
{
  document.write('<OBJECT ID="Player" height="' + height + '" width="' + width + '" border="1 #000000" CLASSID="CLSID:' + CLSID_AMC + '" CODEBASE="http://80.48.243.9/activex/AMC.cab#version=' + ver_AMC + '" STANDBY="Loading Axis Media Control components...">');
  document.write('<param name="MediaURL" value="' + imagepath + '">');
  document.write('<param name="MediaType" value="mjpeg-unicast">');
  document.write('<param name="ShowStatusBar" value="0">');
  document.write('<param name="ShowToolbar"');

	if(ShowAMCToolbar == "yes")
	{
	    document.write('value="1">');
	} else
    {
	    document.write('value="0">');
  	}

  document.write('<param name="AutoStart" value="1">');
  document.write('<param name="StretchToFit" value="1">');

	if(ShowAMCToolbar == "yes")
	{
  	document.write('<param name="ToolbarConfiguration" value="play,+snapshot,+fullscreen">');
	}

	if((ptzgui == "yes") && (useWithCam == "yes"))
	{
    document.write('<param name="PTZControlURL" value="/axis-cgi/com/ptz.cgi?camera=' + camnbr + '">');
    document.write('<param name="UIMode"');

		if(UseRel == "yes")
		{
		    document.write('value="ptz-relative">');
		} else
      {
		    document.write('value="ptz-absolute">');
  		}
	}

	if(UseMotion == "yes")
	{
	    document.write('<param name="UIMode" value="MDConfig">');
	    document.write('<param name="MotionConfigURL" value="/axis-cgi/operator/param.cgi?ImageSource=' + [camnbr - 1] + '">');
	    document.write('<param name="MotionDataURL" value="/axis-cgi/motion/motiondata.cgi">');
	}

  document.write('</OBJECT>');
}

function video(imagepath)
{
  var width = 640;
  var height = 480;

  if ((navigator.appName == "Microsoft Internet Explorer")&&(navigator.platform != "MacPPC")&&(navigator.platform != "Mac68k"))
  {
    DrawAMC(height, width, imagepath, "745395C8-D0E1-4227-8586-624CA9A10A8D", "3,11,0,1", "", "", "", "", "", "no");

    InstallFilter("AXIS 211", "MPEG RTP Reader", "4F1D0C59-5ECC-4028-87F3-482191D2230F", "1,2,26,0", "AMC.cab");
    InstallFilter("AXIS 211", "MPEG4 Video Decoder", "32c11e38-e587-4be9-9abb-d69158c21ce5", "1,1,20,40719",  "AMC.cab");
    InstallFilter("AXIS 211", "Image Notify Component", "833CAF80-A132-4FEF-8188-2A6004E3F239", "1,1,0,1", "AMC.cab");
  } else
    {
      var output = '<img SRC="' + imagepath + '" width="' + width + '" height="' + height +'" width="' + width + '" border="1 black" ALT="Jeżeli nie widać obrazu z kamery, znaczy to, że może być zbyt wielu oglądających, lub też będą konieczne pewne zmiany w konfiguracji przeglądarki.">';
      document.write(output);
    }
    
}

  
