/****************************************************
 * JCam Javascript Document
 ****************************************************
 */
 
 // Browser Verification
 
 browserVer = parseInt(navigator.appVersion);
 if (navigator.appName == "Microsoft Internet Explorer" && browserVer < 4) {
	 alert("Internet Explorer 3 users need to hit 'Refesh' to update the image");
 }
 
 // Turn off JavaScript Errors
 onError = null;
 
 // The variables you need to change are: the filename of the picture,
 // the refresh rate, the expected time to download and further down,
 // the FORM ACTION (look for the ***).
 var picname = "http://windisgood.com/Webcams/Willowscam.jpg";  // set this to the filename of your campicture
 var speed = 60;  // "var speed" is the refresh rate adjustment in seconds
 var y = 10;      // expected time to download the picture file. It  MUST be
                  // set at a smaller number than the "speed" variable!

 var x = speed;   // current countdown
 var cachepic = new Image();
 
 function openremoteWindow() {
	 stopClock();
	 open ("http://windisgood.com/Webcams/Willowscam.jpg","JSCamRemote", "height=310,width=340,scrollbars=0,resizable=yes,status=0");
 }
 
 function stopClock() {
	 x = "00";
	 document.CamView.clock.value = x;
 }
 
 function startClock() {
	 if (x != "00") {
		 x = x - 1;
		 document.CamView.clock.value = x;
		 if (x == y) {
			 recache();
		 }
		 if (x <= 0) {
			 reload();
		 }
		 timerID = setTimeout("startClock()", 1000);
	 }
 }
 
 function recache() {
	 var now = new Date();
	 var camImg = picname + "?" + now.getTime();
	 cachepic.src = camImg;
 }
 
 function reload() {
	 document.images.campicture.src = cachepic.src;
	 x = speed;
	 document.CamView.clock.value = x;
 }