function JS_Refresh1() {
  if(SaveWindow.closed == true) location.reload();
  else window.setTimeout("JS_Refresh1()",500);
}
function JS_Refresh2() {
  if(cPicType=="jpegserverpush") {
    if(SaveWindow.closed == true) {
      window.document.view.src = cPicSizeName + ".push?sleep=20&camera="  + nCamNr + "newurl=" + Math.random();
    }
    else window.setTimeout("JS_Refresh2()",100);
  }
}
function ChangeTourPic() {
  if(nTourRunning == 0) {
    nTourRunning=1;
    window.document.tour.src = "/gif/camera_pic/tour_red.gif";
  }
  else {
    window.document.tour.src = "/gif/camera_pic/tour_black.gif";
    nTourRunning=0;
  }
}
function JS_SavePos() {
  var cFrame = "/config/setting/ccamera/vccname.htm?camera=" + nCamNr;
  SaveWindow = open(cFrame,"Window1","width=320,height=350,screenX=200,screenY=200,dependent=yes,resizable=no");
  JS_Refresh1();
}
function JS_SnapShot() {
  var cFrame = "/view/fullsize_view.htm?camera=" + nCamNr + "&newurl=" + Math.random();
  SaveWindow = open(cFrame,"Window2","width=450,height=354,screenX=200,screenY=200,dependent=yes,resizable=no");
  JS_Refresh2();
}
function JS_SnapShot2() {
  if(cPicSizeName == "hugesize") {
    var cFrame = "/view/hugesize_view.htm?camera=" + nCamNr + "&newurl=" + Math.random();
    SaveWindow = open(cFrame,"Window2","width=834,height=642,screenX=50,screenY=50,dependent=yes,resizable=no");
  }
  else {
    var cFrame = "/view/fullsize_view.htm?camera=" + nCamNr + "&newurl=" + Math.random();
    SaveWindow = open(cFrame,"Window2","width=450,height=354,screenX=200,screenY=200,dependent=yes,resizable=no");
  }
  JS_Refresh2();
}
function JS_Tour() {
  var cFrame = "/config/setting/ccamera/tour.htm?camera=" + nCamNr;
  SaveWindow = open(cFrame,"Window3","width=320,height=350,screenX=200,screenY=200,dependent=yes,resizable=no");
  JS_Refresh1();
}
function JS_ChangeValues() {
  var cFrame = "/config/setting/ccamera/delayvalues.htm";
  SaveWindow = open(cFrame,"Window","width=320,height=350,screenX=200,screenY=200,dependent=yes,resizable=no");
  JS_Refresh1();
}
function JS_PanoNewPic() {
  window.document.panpic1.src = "panorama.jpg?index=-2&camera=" + nCamNr + "newurl=" + Math.random();
  window.document.panpic2.src = "panorama.jpg?index=-1&camera=" + nCamNr + "newurl=" + Math.random();
  window.document.panpic3.src = "panorama.jpg?index=0&camera="  + nCamNr + "newurl=" + Math.random();
  window.document.panpic4.src = "panorama.jpg?index=1&camera="  + nCamNr + "newurl=" + Math.random();
  window.document.panpic5.src = "panorama.jpg?index=2&camera="  + nCamNr + "newurl=" + Math.random();
}
function JS_PanoNew() {
  if(nTourRunning == 0) {
    parent.down.location.href="panorama.jpg?index=NEW&camera=" + nCamNr;
    if(cPicType=="jpegserverpush") {
      window.document.view.src = "fullsize.push?sleep=20&camera="  + nCamNr + "newurl=" + Math.random();
    }
    window.setTimeout("JS_PanoNewPic()",30000);
  }
  else alert("No Function - Camera tour is running!");
}
function JS_CamReboot() {
  parent.down.location.href="/pantilt?camerareboot=1";
  if(cPicType=="jpegserverpush") {
    window.document.view.src = cPicSizeName + ".push?sleep=20&camera="  + nCamNr + "newurl=" + Math.random();
  }
}
function JS_ReloadJpeg() {
  window.document.view.src = "fullsize.jpg?camera=" + nCamNr + "newurl=" + Math.random();
  if(window.document.view.complete == true) window.setTimeout("JS_ReloadJpeg()",1000);
}
function JS_PtMuxCam(nNr) {
    window.document.ptmuxcampic.src = "/gif/buttons/8_" + nNr + ".gif";
    parent.down.location.href="/pantilt?ptmuxcam=" + nNr + "&camera=" + nCamNr;
}

function JS_PtMuxCam16(nNr) {
    window.document.ptmuxcampic.src = "/gif/buttons/16_" + nNr + ".gif";
    parent.down.location.href="/pantilt?ptmuxcam=" + nNr + "&camera=" + nCamNr;
}


