
//function to load an axis webcam
function displayAxisCam(url, width, height){

 var BaseURL = url;
 var Camera = "1";

 var ImageResolution = ""+width+"x"+height;
 var DisplayWidth = ""+width;
 var DisplayHeight = ""+height;

 var File = "axis-cgi/mjpg/video.cgi?resolution="+ImageResolution; 
 if (Camera != "") {File += "&camera=" + Camera;}
 var output = "";
 if ((navigator.appName == "Microsoft Internet Explorer") && (navigator.platform != "MacPPC") && (navigator.platform != "Mac68k")){
	// If Internet Explorer under Windows then use ActiveX
	output = '<OBJECT ID="Player" width=';
	output += DisplayWidth;
	output += ' height=';
	output += DisplayHeight;
	output += ' CLASSID="CLSID:DE625294-70E6-45ED-B895-CFFA13AEB044" ';
	output += 'CODEBASE="';
	output += BaseURL;
	output += 'activex/AMC.cab">';
	output += '<PARAM NAME="MediaURL" VALUE="';
	output += BaseURL;
	output += File + '">';
	output += '<param name="MediaType" value="mjpeg-unicast">';
	output += '<param name="ShowStatusBar" value="0">';
	output += '<param name="ShowToolbar" value="0">';
	output += '<param name="AutoStart" value="1">';
	output += '<param name="StretchToFit" value="1">';
	output += '<BR><B>Axis Media Control</B><BR>';
	output += 'The AXIS Media Control, which enables you ';
	output += 'to view live image streams in Microsoft Internet';
	output += ' Explorer, could not be registered on your computer.';
	output += '<BR></OBJECT>';
 }  else {
	// If not IE for Windows use the browser itself to display
	theDate = new Date();
	output = '<IMG SRC="';
	output += BaseURL;
	output += File;
	output += '&dummy=' + theDate.getTime().toString(10);
	output += '" HEIGHT="';
	output += DisplayHeight;
	output += '" WIDTH="';
	output += DisplayWidth;
	output += '" ALT="WorldLiveStreaming.com - Live Cam" />';
 }
 document.write(output);
 document.Player.ToolbarConfiguration = "play,+snapshot,+fullscreen";
}
//-------------------------------------------------------------------------------
// load an axis image and reload image every 2s
var baseUrlImage ="";
function reload_webcam()
{
	document.getElementById('imagecam').src = ""+baseUrlImage+"?"+(new Date()).getTime();
	setTimeout('reload_webcam()',2000);
	
}

function displayImageCam(url, width, height){
	baseUrlImage = url;
	output = '<IMG id="imagecam" src="';
	output += url;
	output +='" ';
	output += 'width="'+width+'px" '+'height="'+height+'px" />';
	
	document.write(output);
	reload_webcam();
	
}
//---------------------------------------------------------------------------------
// load a media player object
function displayMediaPlayer(url, width, height){
	output =  '<object width="'+width+'" height="'+height+'">';
	output += '<param name="filename" value="'+url+'">';
	output += '<param name="Showcontrols" value="True">';
	output += '<param name="autoStart" value="True">';
	output += '<embed type="application/x-mplayer2" src="'+url+'" width='+width+' height='+height+'></embed>';
	output += '</object>';
	
	document.write(output);
}




