Cam3_code
(custom)
<script type="text/javascript">
var height_array = new Array();
var width_array = new Array();
width_array[3] = 100%;
height_array[3] = 100%;
</script>
<img src="http://192.168.1.111:8181/loading.jpg" class="webcam" id="webcam3" onmousedown="PTZMouseDown3(event)" width="100%" height="100%" alt="Live Stream" />
<script type="text/javascript">
<!--
currentCamera3= 3;
errorimg3= 0;
DoIt3();
document.images.webcam3.onload = DoIt3();
document.images.webcam3.onerror = ErrorImage3();
function LoadImage3()
{
uniq3 = Math.random();
document.images.webcam3.src = "http://192.168.1.111:8181/cam_" + currentCamera3 + ".jpg?uniq="+uniq3;
document.images.webcam3.onload = DoIt3;
}
function PTZMouseDown3(e)
{
var IE = document.all?true:false;
var x,y;
var myx,myy;
var myifr = document.getElementById("_iframe-ptz");
tp = getElPos3();
myx = tp[0];
myy = tp[1];
if(IE){
var scrollX = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft;
var scrollY = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
x = event.clientX - myx + scrollX;
y = event.clientY - myy + scrollY;
} else {
x = e.pageX - myx;
y = e.pageY - myy;
}
if ((width_array[currentCamera3] != null) && (width_array[currentCamera3] > 0)) x = Math.round((x * 400) / width_array[currentCamera3]);
if ((height_array[currentCamera3] != null) && (height_array[currentCamera3] > 0)) y = Math.round((y * 300) / height_array[currentCamera3]);
if (x > 400) x = 400;
if (y > 300) y = 300;
if (myifr != null) myifr.src = "http://192.168.1.111:8181/ptz?src=" + currentCamera3 + "&moveto_x=" + x + "&moveto_y=" + y +"";
return true;
}
function getElPos3()
{
el = document.images.webcam3;
x = el.offsetLeft;
y = el.offsetTop;
elp = el.offsetParent;
while(elp!=null)
{ x+=elp.offsetLeft;
y+=elp.offsetTop;
elp=elp.offsetParent;
}
return new Array(x,y);
}
function ErrorImage3()
{
errorimg3++;
if (errorimg3>3){
document.images.webcam3.onload = "";
document.images.webcam3.onerror = "";
document.images.webcam3.src = "offline.jpg";
}else{
uniq3 = Math.random();
document.images.webcam3.src = "http://192.168.1.111:8181/cam_" + currentCamera3 + ".jpg?uniq="+uniq3;
}
}
function DoIt3()
{
errorimg3=0;
window.setTimeout("LoadImage3();", 40);
}
//-->
</script>