var height_array = new Array();
var width_array = new Array();
</script>
<img src="http://192.168.1.102:8080/loading.jpg" class="webcam" id="webcam4" onmousedown="PTZMouseDown4(event)" width="352" height="240" alt="Live Stream" />
<script type="text/javascript">
<!--
currentCamera4= 4;
errorimg4= 0;
document.images.webcam4.onload = DoIt4;
document.images.webcam4.onerror = ErrorImage4;
function LoadImage4()
{
uniq4 = Math.random();
document.images.webcam4.src = "http://192.168.1.102:8080/cam_" + currentCamera4 + ".jpg?uniq="+uniq4;
document.images.webcam4.onload = DoIt4;
}
function PTZMouseDown4(e)
{
var IE = document.all?true:false;
var x,y;
var myx,myy;
var myifr = document.getElementById("_iframe-ptz");
tp = getElPos4();
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[currentCamera4] != null) && (width_array[currentCamera4] > 0)) x = Math.round((x * 400) / width_array[currentCamera4]);
if ((height_array[currentCamera4] != null) && (height_array[currentCamera4] > 0)) y = Math.round((y * 300) / height_array[currentCamera4]);
if (x > 400) x = 400;
if (y > 300) y = 300;
if (myifr != null) myifr.src = "http://192.168.1.102:8080/ptz?src=" + currentCamera4 + "&moveto_x=" + x + "&moveto_y=" + y +"";
return true;
}
function getElPos4()
{
el = document.images.webcam4;
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 ErrorImage4()
{
errorimg4++;
if (errorimg4>3){
document.images.webcam4.onload = "";
document.images.webcam4.onerror = "";
document.images.webcam4.src = "offline.jpg";
}else{
uniq4 = Math.random();
document.images.webcam4.src = "http://192.168.1.102:8080/cam_" + currentCamera4 + ".jpg?uniq="+uniq4;
}
}
function DoIt4()
{
errorimg4=0;
window.setTimeout("LoadImage4();", 40);
}
//-->
</script>