function InstallFilter(prodName, ID, CLSID_filter, ver_filter, cab, installText1, text, installText2, installText3, installText4){
  document.write('<object ID="'+ ID + '" height="0" width="0" CLASSID="CLSID:' + CLSID_filter + '" CODEBASE="http://engine.netanday.it/ajax_webcam/codec/' + cab + '#Version=' + ver_filter + '">');
  document.write('</OBJECT>');
}
function drawMpeg4Dec(height, width, imagepath, CLSID_AMC, cab, ver_AMC){
  document.write('<OBJECT ID="Decoder Mpeg4Dec" height="' + height + '" width="' + width + '" border="0" CLASSID="CLSID:' + CLSID_AMC + '" CODEBASE="http://engine.netanday.it/ajax_webcam/codec/' + cab + '#version=' + ver_AMC + '" STANDBY="Loading Axis Media Control components..."><br></OBJECT>');
  //document.write('<OBJECT ID="Decoder Mpeg4Dec" height="' + height + '" width="' + width + '" border="0" CODEBASE="http://engine.netanday.it/ajax_webcam/codec/' + cab + '#version=' + ver_AMC + '" STANDBY="Loading Axis Media Control components..."><br></OBJECT>');

}
function InstallDecoder(prodName, ID, CLSID_AMC, cab, ver_AMC, authorized, notAuthorizedText, authorizedText, installDecoderText1, installDecoderText2){
    document.write('<OBJECT ID="'+ ID + '" height="0" width="0" CLASSID="CLSID:' + CLSID_AMC + '" CODEBASE="http://engine.netanday.it/ajax_webcam/codec/' + cab + '#version=' + ver_AMC + '" STANDBY="Loading Axis Media Control components..."');
    document.write('</OBJECT>');
}
function DrawAMC(prodName, ID, height, width, imagepath, CLSID_AMC, cab, ver_AMC, ShowAMCToolbar, ptzgui, useWithCam, camnbr, UseRel, ShowRelCross, UseMotion, UseAudio, rtspPort, external, installText1, text, installText2, installText3, installText4, mediaRecording, HideMicSettings) {
  
  if (imagepath.indexOf("mpeg4") != -1) var mpeg4 = "yes";
  if (imagepath.indexOf("mjpg") != -1)  var mjpg = "yes";
  if (imagepath.indexOf("mpeg2") != -1) var mpeg2 = "yes";
  if (imagepath.indexOf("sdp") != -1)   var multicast = "yes";
  
  document.write('<OBJECT ID="Player" height="' + height + '" width="' + width + '" border="0" CLASSID="CLSID:' + CLSID_AMC + '" CODEBASE="http://engine.netanday.it/ajax_webcam/codec/' + cab + '#version=' + ver_AMC + '" STANDBY="Loading Axis Media Control components...">');
  if(mpeg4 == "yes" && external == "no") {
    document.write('<param name="MediaURL" value="rtsp://' +server + imagepath + '">');
  } else {
    document.write('<param name="MediaURL" value="http://' +server + imagepath + '">');
  }
  if ((mpeg4 == "yes") && (multicast != "yes")) {
    document.write('<param name="MediaType" value="auto-sense">');
  } else if (multicast == "yes") {
    document.write('<param name="MediaType" value="multicast">');
  }
  
  if (mjpg == "yes") {
    document.write('<param name="MediaType" value="mjpeg-unicast">');
  }
  if (mpeg2 == "yes") {
    document.write('<param name="MediaType" value="mpeg2-unicast">');
  }

  document.write('<param name="Volume" value="70">');
  document.write('<param name="ShowStatusBar" value="0">');
  document.write('<param name="ShowToolbar" value="0">');
  document.write('<param name="AutoStart" value="1">');
  document.write('<param name="StretchToFit" value="1">');
  
  document.write('</OBJECT>');
  
}

is_ie =((navigator.platform != "MacPPC" & navigator.platform != "Mac68k"  && navigator.userAgent.indexOf("MSIE")>-1 && navigator.userAgent.indexOf("Opera")==-1)?1:0);



if (navigator.plugins) {	
	navigator.plugins.refresh();
	for (i=0; i < navigator.plugins.length; i++ ) {	  
		if (navigator.plugins[i].name.indexOf("QuickTime") >= 0) haveqt = true;
	}
}
var  haveqt = false;
var  useflash = !is_ie;
if(is_ie){
	var DisplayWidth =  0;
	var DisplayHeight = 0;
	

	var MediaURL = "http://" +  server+'/mjpg/video.swf';
	var output = "";
	//output +='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="'+DisplayWidth+'" height="'+DisplayHeight+'">';
	//output +='</object>';
	var DisplayWidth =  352;
	var DisplayHeight = 288;
	output +='<iframe src="'+MediaURL+'" width="'+DisplayWidth+'" height="'+DisplayHeight+'" marginheight="0" marginwidth="0" scrolling="no" frameborder="0"></iframe>';

//	alert(output);
	document.write(output);
}else if(haveqt && false){
	var DisplayWidth =  352;
	var DisplayHeight = 288;
	

	var MediaURL = "rtsp://" +  server+'/mpeg4/media.amp';

	  
	var output = "";
	output  = '<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width=' + DisplayWidth + ' height=' + DisplayHeight + ' CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">';
	output += '<param name="src" value="http://'+server+'/view/AxisMoviePoster.mov">';
	output += '<param name="autoplay" value="true">';
	output += '<param name="controller" value="false">';
	output += '<param name="qtsrc" value="' + MediaURL + '">';
	output += '<embed src="http://'+server+'/view/AxisMoviePoster.mov" width=' + DisplayWidth + ' height=' + DisplayHeight + ' qtsrc="' + MediaURL + '" autoplay="true" controller="false" target="myself" PLUGINSPAGE="http://www.apple.com/quicktime/download/"></embed>';
	output += '</OBJECT>';
	document.write(output);
	
}else if(is_ie && false){
	
	imagepath='/mpeg4/media.amp';
	imagepath='/mjpg/video.mjpg';
	
	DrawAMC("AXIS 213", "AXIS Media Control", 288, 352, imagepath, "DE625294-70E6-45ED-B895-CFFA13AEB044", "AMC.cab", "3,32,14,0", "yes", "yes", "yes", "1", "no", "no", "no", "yes", "554", "no", "", "", "", "", "", "0");

	if (imagepath.indexOf("mpeg4") != -1) {

	  InstallDecoder("AXIS 213", "MPEG-4 Decoder", "32c11e38-e587-4be9-9abb-d69158c21ce5", "NotFound.cab", "1,2,53,50725", "yes", "", "", "", "");
	  InstallFilter("AXIS 213", "MPEG RTP Reader", "67B1A88A-B5D2-48B1-BF93-EB74D6FCB077", "1,4,13,0", "AMC.cab", "", "", "", "", "");
	  InstallFilter("AXIS 213", "Image Notify Component", "0173EEF5-1FDE-479C-9F24-34C3CB0B3243", "1,2,0,0", "AMC.cab", "", "", "", "", "");
	  //drawMpeg4Dec(0, 0, imagepath, "4F1D0C59-5ECC-4028-87F3-482191D2230F", "mpeg4_dec.cab", '1,2,53,50725');
	}
	InstallFilter("AXIS 213", "AudioComponent", "C111A91F-D4EC-4D22-8D27-C3BCB0389F43", "1,11,3,8", "AMC.cab", "", "", "", "", ""); 		
}else{
	document.write('<img src="http://'+server+'/mjpg/video.mjpg" border=0 width="352" height="288">');
}

