  function VidIMGReload()
  {
		oEl=document.getElementById('imgx_1');		
		oEl2=document.getElementById('imgx_2');		
		
		if (iPocitadlo%2==0)
		{
	    image_view = new Image(oEl.width, oEl.height);
	    image_view.src = "http://90.178.76.132:4480/image.jpg?num=" + Math.random();
	    oEl.src=image_view.src;
	  }
		else
		{
	    image_view = new Image(oEl.width, oEl.height);
	    image_view.src = "http://90.178.76.132:4481/image.jpg?num=" + Math.random();
	    oEl2.src=image_view.src;
	  }
    iPocitadlo++;
    if (iPocitadlo>101)
    	iPocitadlo=0;
    setTimeout("VidIMGReload();", 500);
  }
  
	function  Camera()
	{
		resolution=profile_resolution[cookie_profile];
		switch(resolution) {
		case "1280x1024":
			obj_width = 1280; obj_height = 1024; break;
		case "1024x768":
			obj_width = 1024; obj_height = 768; break;
		case "4CIF":
			obj_width = 720; obj_height = 480; break;
		case "D1":
			obj_width = 720; obj_height = 480; break;
		case "VGA":
			obj_width = 640; obj_height = 480; break;
		case "CIF":
			obj_width = 320; obj_height = 240; break;
		case "QCIF":
			obj_width = 160; obj_height = 120; break;
		case "MINICIF":
			obj_width = 78; obj_height = 58; resolution="QCIF"; break;
			
		}
		if (isIE)
		{
			draw_activex('viewdiv','90.178.76.132:4480');
			draw_activex('viewdiv2','90.178.76.132:4481');
		}
		else if (isFF)
		{
			sSrc1='http://90.178.76.132:4480/video.cgi?resolution=' + resolution;
			sSrc2='http://90.178.76.132:4481/video.cgi?resolution=' + resolution;
	  }
	  else
	  {
			sSrc1='http://90.178.76.132:4480/image.jpg?num='+Math.random();
			sSrc2='http://90.178.76.132:4481/image.jpg?num='+Math.random();
	    setTimeout("VidIMGReload();", 5000);
		}

		if(!isIE)
		{
			oVid1=document.getElementById('imgx_1');		
			oVid2=document.getElementById('imgx_2');
			oVid1.width=obj_width;		
			oVid2.width=obj_width;		
			oVid1.height=obj_height;		
			oVid2.height=obj_height;
			oVid1.src=sSrc1;
			oVid2.src=sSrc2;
		}
	}
	
	function draw_activex(id,source)
	{
		var host = source;
		var host_ip = host.split(":");
	
		switch(profile_resolution[cookie_profile]) {
			case "1280x1024":
				table_width = 1280 + width_adj; table_height = 1024 + height_adj; obj_width = 1280 + width_adj; obj_height = 1024 + height_adj; break;
			case "1024x768":
				table_width = 1280 + width_adj; table_height = 1024 + height_adj; obj_width = 1024 + width_adj; obj_height = 768 + height_adj; break;
			case "4CIF":
				table_width = 720 + width_adj; table_height = 480 + height_adj; obj_width = 720 + width_adj; obj_height = 480 + height_adj; break;
			case "D1":
				table_width = 720 + width_adj; table_height = 480 + height_adj; obj_width = 720 + width_adj; obj_height = 480 + height_adj; break;
			case "VGA":
				table_width = 640 + width_adj; table_height = 480 + height_adj; obj_width = 640 + width_adj; obj_height = 480 + height_adj; break;
			case "CIF":
				table_width = 640 + width_adj; table_height = 480 + height_adj; obj_width = 320 + width_adj; obj_height = 240 + height_adj; break;
			case "QCIF":
				table_width = 640 + width_adj; table_height = 480 + height_adj; obj_width = 160 + width_adj; obj_height = 120 + height_adj + 20; break;
		}
	
		var deinterlacemode = 0;
		var audiomode = 0;
		var flipmode = 0;	
		if (sensor == "tw9910") {
			flipmode = 0;
		}
		if (sensor == "tw9910" && profile_resolution[cookie_profile] == "VGA")
		{
			deinterlacemode = 0;
		}
	
		var viewHTML = "";
		viewHTML += "<object classid='clsid:" + activex_clsid + "' id='CamV"+id+"' width='" + obj_width + "' height='" + obj_height + "' codebase='http://"+host+"/classes/" + activex_id + ".cab#Version=" + activex_version + "' style=\"width:360px;\">";
		viewHTML += "<PARAM NAME='Host' VALUE='"+ host_ip[0] +"'>";
		viewHTML += "<PARAM NAME='HttpPort' VALUE='" + host_ip[1] + "'>";
		viewHTML += "<PARAM NAME='RTSPPort' VALUE='" + rtsp_port + "'>";
		viewHTML += "<PARAM NAME='RTSPoverHTTP' VALUE='" + overHttp + "'>";
		viewHTML += "<PARAM NAME='RTSPoverTCP' VALUE='" + overTcp + "'>";
		viewHTML += "<PARAM NAME='url' VALUE='" + profile_path[parseInt(cookie_profile)] + "'>";
		viewHTML += "<PARAM NAME='Account' VALUE='" + parent.login_user + "'>";
		viewHTML += "<PARAM NAME='Password' VALUE='" + parent.login_pass + "'>";
		viewHTML += "<PARAM NAME='Properties' VALUE='0'>";
		viewHTML += "<PARAM NAME='MenuProp' VALUE='0'>";
		viewHTML += "<PARAM NAME='ImageProc' VALUE='1'>";
		viewHTML += "<PARAM NAME='MsgType' VALUE='0'>";
		viewHTML += "<PARAM NAME='Deinterlace' VALUE='" + deinterlacemode +"'>";	
		viewHTML += "<PARAM NAME='AudioMode' VALUE='" + audiomode + "'>";
		viewHTML += "<PARAM NAME='VerticalFlip' VALUE='" + flipmode + "'>";
		viewHTML += "<PARAM NAME='Timeout' VALUE='10'>";
		viewHTML += "<PARAM NAME='G72640PT' VALUE='98'>"; 
		viewHTML += "<PARAM NAME='G72632PT' VALUE='97'>"; 
		viewHTML += "<PARAM NAME='G72624PT' VALUE='99'>"; 
		viewHTML += "<PARAM NAME='G72616P' VALUE='100'>";
		viewHTML += "<PARAM NAME='AMRPT' VALUE='101'>";
		viewHTML += "</object></center>";
		viewHTML += "<br><span id='"+id+"MediaInfo' class='span_style'></span>";
		oEl=document.getElementById(id);
		oEl.innerHTML = viewHTML;
		update_media_info(id);
	}
	function update_media_info(id) {
		oObj=document.getElementById('CamV'+id);
		var vformat = (oObj.VFormat == "26") ? "JPEG" : "MPEG4";
		oEl=document.getElementById(id+"MediaInfo");
		oEl.innerHTML = "&nbsp;&nbsp;&nbsp;" +
			"Format : " + vformat + "&nbsp;&nbsp;&nbsp;" +
			"Resolution : " + oObj.VWidth + "x" + oObj.VHeight + "&nbsp;&nbsp;&nbsp;" +
			"FPS : " + oObj.VFPS  + "&nbsp;&nbsp;&nbsp;" +
			"Bitrate : " + oObj.VDRate + "&nbsp;&nbsp;&nbsp;";
		setTimeout("update_media_info('"+id+"');", 1000);
	}
	var iPocitadlo=0;
	var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;		
	var isFF =  (navigator.appName.toUpperCase() == 'NETSCAPE') ? true : false;
	
	var profile_path = new Array();
	var profile_resolution = new Array();
	var profile_quality = new Array();
	var profile_bitrate = new Array();
	var profile_fps = new Array();
	var profile_ratecontrol = new Array();
	profile_ratecontrol[0] = "vbr";
	profile_bitrate[0] = "512";
	profile_resolution[0] = "CIF";
	profile_fps[0] = "25";
	profile_quality[0] = "100";
	profile_path[0] = "/mjpg/1/video.mjpg?resolution=cif";
	profile_ratecontrol[1] = "vbr";
	profile_bitrate[1] = "2048";
	profile_resolution[1] = "VGA";
	profile_fps[1] = "30";
	profile_quality[1] = "90";
	profile_path[1] = "/mpeg4/1/media.amp?resolution=vga";
	profile_ratecontrol[2] = "vbr";
	profile_bitrate[2] = "512";
	profile_resolution[2] = "CIF";
	profile_fps[2] = "30";
	profile_quality[2] = "80";
	profile_path[2] = "/mpeg4/1/media.amp?resolution=cif";
	profile_ratecontrol[3] = "vbr";
	profile_bitrate[3] = "128";
	profile_resolution[3] = "QCIF";
	profile_fps[3] = "30";
	profile_quality[3] = "80";
	profile_path[3] = "/mpeg4/1/media.amp?resolution=qcif";
	profile_ratecontrol[4] = "vbr";
	profile_bitrate[4] = "512";
	profile_resolution[4] = "CIF";
	profile_fps[4] = "25";
	profile_quality[4] = "100";
	profile_path[4] = "/mjpg/1/video.mjpg?resolution=cif";
	profile_ratecontrol[5] = "vbr";
	profile_bitrate[5] = "2048";
	profile_resolution[5] = "1280x1024";
	profile_fps[5] = "5";
	profile_quality[5] = "90";
	profile_path[5] = "/mjpg/1/video.mjpg?resolution=1280x1024";
	profile_ratecontrol[6] = "vbr";
	profile_bitrate[6] = "2048";
	profile_resolution[6] = "1024x768";
	profile_fps[6] = "15";
	profile_quality[6] = "90";
	profile_path[6] = "/mpeg4/1/media.amp?resolution=1024x768";
	
	var ocx_operation = "";
	var width_adj = 260; 
	var height_adj = 70;
	var cookie_profile = 2;
	var cookie_stream = 2;		//0 tcp, 1 udp,2 http
	var overTcp = 0;
	var overHttp = 0;
	var obj_width;
	var obj_height;
	var table_width;
	var table_height;
	var sensor = "tw9910";
	var hw_audio = "yes";
	var audio_ena = "no";
	var audio_duplex = "get";
	var activex_clsid = "49CD73D5-CBE2-4FAA-B70F-0252C74809AB";
	var activex_id = "PLANETCamV";
	var activex_version = "2,0,0,2115";
	var rtsp_port = "554";
	var hw_version = "MPEG4";	
	var mega_mode = "no";
	var brand = "PLANET";
	var audio_encode = "g721";
	var lan_status = "1";
	var cgi_str = "";
