﻿	
	/* JavaScript file for SIP webcams */

function writeSmallCam(baseURL, camWidth, camHeight) {
	
        var output = "";	
        // This is the filepath to the video generating file inside the camera itself
        var camFile = "axis-cgi/mjpg/video.cgi?resolution=320x240";
        
        //big preview
        var camFileBig = "axis-cgi/mjpg/video.cgi?resolution=640x480";          
        
		if ((navigator.appName == "Microsoft Internet Explorer")&&(navigator.platform != "MacPPC")&&(navigator.platform != "Mac68k"))
		{
			// If Internet Explorer for Windows then use ActiveX 
		    output = "<object id=\"CamImage\" width="
			output += camWidth;
			output += " height=";
			output += camHeight;
			output += " classid=CLSID:917623D1-D8E5-11D2-BE8B-00104B06BDE3 ";
			output += "codebase=\"";
			output += baseURL;
			output += "activex/AxisCamControl.cab#Version=1,0,2,15\">";
			output += "<param name=\"URL\" value=\"";
			output += baseURL;
			output += camFile;
			output += "\"> <br/><b>Axis ActiveX Camera Control</b><br/>";
			output += "The AXIS ActiveX Camera 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
		    output = "<a href='WebcamBig.aspx?baseURL=" + baseURL + "&camWidth=" + 640 + "&camHeight=" + 480 + "&dummy=garb' onclick=\"openWindow(WebcamBig.aspx?baseURL=" + baseURL + "&camWidth=" + 640 + "&camHeight=" + 480 + "&dummy=garb); return false;\"><img src=\"";
			output += baseURL;
			output += camFile;
			output += "&dummy=garb\" height=\"";
			// The above dummy cgi-parameter helps some versions of NS
			output += camHeight;
			output += "\" width=\"";
			output += camWidth;
			output += "\" border=\"0\"></a>";
		}
		document.write(output);
}

function openWindow(url) {
    newWindow = window.open(url, 'Zweitfenster2', 'width=640,height=480,location=yes');
}

    
