function NWLConfig() {
	this.resolution	  			= '384x288';
	this.refresh_rate			= '3';
	this.timeout				= 600;
	this.minflashver			= 7;
	this.type         			= 'advanced';
	this.context                = 'tb';
	this.allow_video = true;
  this.camera					= 'b8dff217942e4962b8ac1b4f2d1911a2';
		this.relay = false;
	this.address				= '77.43.75.101:2220';
	this.username				= '';
	this.password				= '';
	this.manufacturer           = 'Axis';
	this.model                  = '214PTZ';
	this.firmware     			= '4.40';
	this.apiversion   			= '2';
	 
		this.snapshot_url = 'http://77.43.75.101:2220/axis-cgi/jpg/image.cgi?camera=1&resolution=384x288&_nocache=1389535445';
		this.stream_url = 'http://77.43.75.101:2220/axis-cgi/mjpg/video.cgi?camera=1&resolution=384x288&_nocache=2056103815';
	var _regexp = new RegExp('^http://([^/]+)(/.*)$');
	var _strmre = _regexp.exec(this.stream_url);
	var _snpre  = _regexp.exec(this.snapshot_url);
	if (this.stream_url) {
	  _strmre = _regexp.exec(this.stream_url);
		this.stream_address = _strmre[1];
		this.stream_path = _strmre[2];
	}
	this.snapshot_address  = _snpre[1];
	this.snapshot_path 	   = _snpre[2];
  this.truestream = false;
	this.truestream_url = '';
	this.allow_relay_fallback_viewer = false;
}

var AxisViewer = Class.extend( NWLViewer, {
	
		initialize: function(options) {
			this.superInit(options);
			
			// 240x doesn't support normal applet viewer
			if (!this.browser.isIE 
					&& (this.model == '2400+' || this.model == '2401+')) {
				this.type = 'basic';
				this.allow_switch = 'false';
			}
					
		},
		
		_getAppletViewer: function() {
		
			str = '';
		
		if (this.firmware >= 4.40) {
		  
			// layer on top to prevent clicking on the image
			str = '<div style="position: absolute;  width: ' + this.width + 'px; height: ' + this.height + 'px; z-index: 255;">';
			str += '<img src="/en/common/img/pxl.gif" width="' + this.width + '" height="' + this.height + '" /></div>';
			str += '<applet id="nwlviewer_object" archive="ama.jar" codebase="http://' + this.stream_address + '/java/ama" code="ama.MediaApplet" width="' + this.width + '" height="' + this.height + '">'; 
   		str += '<param name="code" value="ama.MediaApplet">';
   		str += '<param name="archive" value="ama.jar">';
   		str += '<param name="ama_cgi-path" value="axis-cgi">';
   		str += '<param name="codebase" value="http://' + this.stream_address + '/java/ama">';
   		str += '<param name="cache_archive" value="ama.jar">';
   		str += '<param name="cache_version" value="1.0.0.0">';
   		str += '<param name="type" value="application/x-java-applet;version=1.4">';
   		str += '<param name="ama_url" value="'+ this.stream_url + '">';
   		str += '</applet>';
		
		} else if (this.firmware >= 4.35) {
				
				// layer on top to prevent clicking on the image
  				str = '<div style="position: absolute;  width: ' + this.width + 'px; height: ' + this.height + 'px; z-index: 255;">';
  				str += '<img src="/en/common/img/pxl.gif" width="' + this.width + '" height="' + this.height + '" /></div>';
  				str += '<applet id="nwlviewer_object" archive="ama.jar" codebase="http://' + this.stream_address + '/java/" code="MediaApplet" width="' + this.width + '" height="' + this.height + '">'; 
           		str += '<param name="code" value="MediaApplet">';
           		str += '<param name="archive" value="ama.jar">';
           		str += '<param name="codebase" value="http://' + this.stream_address + '/java/">';
           		str += '<param name="cache_archive" value="ama.jar">';
           		str += '<param name="cache_version" value="0.13.1.0">';
           		str += '<param name="type" value="application/x-java-applet;version=1.4">';
           		str += '<param name="ama_url" value="'+ this.stream_url + '">';
           		str += '</applet>';
			
			} else if (this.firmware >= 4.30 || this.model == '214PTZ') {
				
				// layer on top to prevent clicking on the image
  				str = '<div style="position: absolute;  width: ' + this.width + 'px; height: ' + this.height + 'px; z-index: 255;">';
  				str += '<img src="/en/common/img/pxl.gif" width="' + this.width + '" height="' + this.height + '" /></div>';
  				str += '<applet id="nwlviewer_object" archive="ama.jar" codebase="http://' + this.stream_address + '/java/" code="AxisMediaApplet" width="' + this.width + '" height="' + this.height + '">'; 
           		str += '<param name="code" value="AxisMediaApplet">';
           		str += '<param name="archive" value="ama.jar">';
           		str += '<param name="codebase" value="http://' + this.stream_address + '/java/">';
           		str += '<param name="cache_archive" value="ama.jar">';
           		str += '<param name="cache_version" value="0.12.0.0">';
           		str += '<param name="type" value="application/x-java-applet;version=1.4">';
           		str += '<param name="ama_url" value="'+ this.stream_url + '">';
           		str += '</applet>';
           	
			} else {
 				
 				str = '<applet id="nwlviewer_object" archive="AxisCamApplet.zip" codeBase="http://' + this.stream_address + '/java/" code="AxisCamApplet.class" width="' + this.width + '" height="' + this.height + '">'; 
	    		str += '<param NAME="StreamLocation" VALUE="' + this.stream_url + '" />'; 
	    		str += '</applet>';
			}
			
			return str;
		}
	
});

var myViewer = new AxisViewer(new NWLConfig());


// axis 214
if (myViewer) {
   // document.write('<pre>MJPEGRender is installed? ' + detectMJPEGRender() + '</pre>');
   Event.observe(window, 'load', function() { 
		setTimeout('myViewer.draw(myViewer.getHTML());', 200)
	 }, true);
	 	 
	 if(typeof renderPresetsArea == 'function') {
	   Event.observe(window, 'load', function() { 
		setTimeout(renderPresetsArea, 300)
	 }, true);
	 }
	 
} else {
	document.write("Sorry, there is currently no driver available for this camera");
}



