paulyb 0 Newbie Poster

Hi all
First post here
I'm trying to get a webpage to show an online or offline gif when the cam is live or not,
also i would like the on air.gif to be clickable to go to the webcam.
here is the script i'm using for the cam

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>2D0DRM</title>
</head>

<body background="cam_connect.gif">
<img src="http://2d0drm.dyndns.org:8080/loading.jpg" class="webcam" id="webcam1" onmousedown="PTZMouseDown1(event)" width="320" height="240" alt="Live Stream" />
<script type="text/javascript">
<!--
currentCamera1= 1;
errorimg1= 0;
document.images.webcam1.onload = DoIt1;
document.images.webcam1.onerror = ErrorImage1;
function LoadImage1()
{
        uniq1 = Math.random();
        document.images.webcam1.src = "http://2d0drm.dyndns.org:8080/cam_" + currentCamera1 + ".jpg?uniq="+uniq1;
        document.images.webcam1.onload = DoIt1;
}
function PTZMouseDown1(e)
{
        var IE = document.all?true:false;
        var x,y;
        var myx,myy;
        var myifr = document.getElementById("_iframe-ptz");
        tp = getElPos1();
        myx = tp[0];
        myy = tp[1];
        if(IE){
        x = event.clientX - myx + document.body.scrollLeft;
        y = event.clientY - myy + document.body.scrollTop;
        } else {
        x = e.pageX - myx;
        y = e.pageY - myy;
        }
        //alert(x + " :: " + y);
        if (width_array[currentCamera1] > 0) x = Math.round((x * 400) / width_array[currentCamera1]);
        if (height_array[currentCamera1] > 0) y = Math.round((y * 300) / height_array[currentCamera1]);
        //alert(x + " :: " + y);
        if (myifr != null) myifr.src = "http://2d0drm.dyndns.org:8080/ptz?src=" + currentCamera1 + "&moveto_x=" + x + "&moveto_y=" + y +"";
        return true;
}
function getElPos1()
{
            el = document.images.webcam1;
            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 ErrorImage1()
{
        errorimg1++;
        if (errorimg1>3){
              document.images.webcam1.onload = "";
              document.images.webcam1.onerror = "";
              document.images.webcam1.src = "http://www.qsl.net/2d0drm/bbctest.jpg";
              }else{
                uniq1 = Math.random();
            document.images.webcam1.src = "http://2d0drm.dyndns.org:8080/cam_" + currentCamera1 + ".jpg?uniq="+uniq1;
              }
}
function DoIt1()
{
        errorimg1=0;
        window.setTimeout("LoadImage1();", 40);
}
//-->
</script>


</body>

</html>

Thanks if you can help.
Be gentle, my knowledge of script is very minimal.
That'll put a few replies off :D