{source}
<script type=”text/javascript”>
var height_array = new Array();
var width_array = new Array();
width_array[2] = 640;
height_array[2] = 480;
</script>
<img src=”http://77.173.219.105:8080/loading.jpg” id=”webcam2″ onmousedown=”PTZMouseDown2(event)” width=”640″ height=”480″ alt=”Live Stream” />
<script type=”text/javascript”>
<!–
currentCamera2= 2;
errorimg2= 0;
DoIt2();
document.images.webcam2.onload = DoIt2();
document.images.webcam2.onerror = ErrorImage2();
function LoadImage2()
{
uniq2 = Math.random();
document.images.webcam2.src = “http://77.173.219.105:8080/cam_” + currentCamera2 + “.jpg?uniq=”+uniq2;
document.images.webcam2.onload = DoIt2;
}
function PTZMouseDown2(e)
{
var IE = document.all?true:false;
var x,y;
var myx,myy;
var myifr = document.getElementById(“_iframe-ptz”);
tp = getElPos2();
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[currentCamera2] != null) && (width_array[currentCamera2] > 0)) x = Math.round((x * 400) / width_array[currentCamera2]);
if ((height_array[currentCamera2] != null) && (height_array[currentCamera2] > 0)) y = Math.round((y * 300) / height_array[currentCamera2]);
if (x > 400) x = 400;
if (y > 300) y = 300;
if (myifr != null) myifr.src = “http://77.173.219.105:8080/ptz?src=” + currentCamera2 + “&moveto_x=” + x + “&moveto_y=” + y +””;
return true;
}
function getElPos2()
{
el = document.images.webcam2;
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 ErrorImage2()
{
errorimg2++;
if (errorimg2>3){
document.images.webcam2.onload = “”;
document.images.webcam2.onerror = “”;
document.images.webcam2.src = “offline.jpg”;
}else{
uniq2 = Math.random();
document.images.webcam2.src = “http://VIDEO_PC:8080/cam_” + currentCamera2 + “.jpg?uniq=”+uniq2;
}
}
function DoIt2()
{
errorimg2=0;
window.setTimeout(“LoadImage2();”, 40);
}
//–>
</script>
{/source}
