// JavaScript Document
function ChangeImg (source) {
  setTimeout("LoadImg()", 0);
  if (!source) {source="cam1";}
  tmp = new Date();
  tmp = "?"+tmp.getTime();
  _uacct="UA-2384755-1";
  switch (source) {
   case "cam1":
    inner='<IMG src="http://basenode.homelinux.net/webcam1/'+tmp+'" width="640" height="480" border="1" name="WebCamImage"  onerror="ErrorImg()" alt="Loading..." />';
    imgsrc="http://basenode.homelinux.net/cam1/";
    urchinTracker('cam1');
    break;
    case "cam2":
    inner='<IMG src="http://basenode.homelinux.net/webcam2/'+tmp+'" width="640" height="480" border="1" name="WebCamImage"  onerror="ErrorImg()" alt="Loading..." />';
    imgsrc="http://basenode.homelinux.net/cam2/";
    urchinTracker('cam2');
    break;
    case "cam1java":
    inner='<iframe src="http://basenode.homelinux.net/cam1/example.html" style="width:640px;height:480px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0">Java</iframe>';
    urchinTracker('cam1-java');
    break;
    case "cam2java":
    inner='<iframe src="http://basenode.homelinux.net/cam2/example.html" style="width:640px;height:480px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0">Java</iframe>';
    urchinTracker('cam2-java');
    break;
  }
  
   picture= source;
   document.getElementById("picture").innerHTML=inner;
   setTimeout("LoadImg()", t*1000);
}
var t = 30 // interval in seconds
imgsrc = "";
picture="cam1";

function ErrorImg() {
  document.images.WebCamImage.src = "frame.jpg";
  setTimeout("LoadImg()", t*1000);
}

function LoadImg() {
  if (picture=="cam1" || picture=="cam2" ) {
    if (imgsrc == "") 
      {
        imgsrc = document.images.WebCamImage.src;
      }
    else
      {
        document.images.WebCamImage.onload = ""; 
        tmp = new Date();
        tmp = "?"+tmp.getTime();
        document.images.WebCamImage.src = imgsrc+tmp;
      }
    
    setTimeout("LoadImg()", t*1000);
  }
}
