﻿function getimagetime(){

 xmlhttp.open("GET", "move/imagetime1.php",true);

 xmlhttp.onreadystatechange=function() {

  if (xmlhttp.readyState==4) {

   return xmlhttp.responseText

  }

 }

 xmlhttp.send(null)

 }


function updatelogtable(cam,stall){


     var xhReq;

        /** Special IE only code ... */
        /*@cc_on
          @if (@_jscript_version >= 5)
              try
              {
                  xhReq = new ActiveXObject("Msxml2.XMLHTTP");
              }
              catch (e)
              {
                  try
                  {
                      xhReq = new ActiveXObject("Microsoft.XMLHTTP");
                  }
                  catch (E)
                  {
                      xhReq = false;
                  }
             }
          @else
             xhReq = false;
        @end @*/

        /** Every other browser on the planet */
        if (!xhReq && typeof XMLHttpRequest != 'undefined')
        {
            try
            {
                xhReq = new XMLHttpRequest();
            }
            catch (e)
            {
                xhReq = false;
            }
        }


 
 //var xhReq = new XMLHttpRequest();
 xhReq.open("GET", "webcam/insert_cam_record.php?cam=" +cam+ "&stall=" +stall, false);
 xhReq.send(null);
 var serverResponse = xhReq.responseText;
 //alert(serverResponse); // Shows "15"

  }


function check_stall(img_src){
    var uniq = new Date();   
    uniq = uniq.getTime(); 


     var xhReq;

        /** Special IE only code ... */
        /*@cc_on
          @if (@_jscript_version >= 5)
              try
              {
                  xhReq = new ActiveXObject("Msxml2.XMLHTTP");
              }
              catch (e)
              {
                  try
                  {
                      xhReq = new ActiveXObject("Microsoft.XMLHTTP");
                  }
                  catch (E)
                  {
                      xhReq = false;
                  }
             }
          @else
             xhReq = false;
        @end @*/

        /** Every other browser on the planet */
        if (!xhReq && typeof XMLHttpRequest != 'undefined')
        {
            try
            {
                xhReq = new XMLHttpRequest();
            }
            catch (e)
            {
                xhReq = false;
            }
        }




switch(img_src)

{
   case "webcam/paddock.jpg":

     //var xhReq = new XMLHttpRequest();
 	  xhReq.open("GET", "webcam/check_cam_record.php?cam=paddock&new=" + uniq, false);
 	  xhReq.send(null);
 	  var stallResponse = xhReq.responseText;
 	document.all.stall_number_print.innerHTML = stallResponse;
    break;
 
  case "webcam/1_4_image.jpg.jpg":

     //var xhReq = new XMLHttpRequest();
 	  xhReq.open("GET", "webcam/check_cam_record.php?cam=1_2&new=" + uniq, false);
 	  xhReq.send(null);
 	  var stallResponse = xhReq.responseText;
 	document.all.stall_number_print.innerHTML = stallResponse;
 	break;

  case "webcam/image.jpg.jpg":

    // var xhReq = new XMLHttpRequest();
 	  xhReq.open("GET", "webcam/check_cam_record.php?cam=7_8&new=" + uniq, false);
 	  xhReq.send(null);
 	  var stallResponse = xhReq.responseText;
 	document.all.stall_number_print.innerHTML = stallResponse;
    break;

  case "webcam/2_6_image.jpg.jpg":

    // var xhReq = new XMLHttpRequest();
 	  xhReq.open("GET", "webcam/check_cam_record.php?cam=3_6&new=" + uniq, false);
 	  xhReq.send(null);
 	  var stallResponse = xhReq.responseText;
 	document.all.stall_number_print.innerHTML = stallResponse;
    break;

   default:
     document.all.stall_number_print.innerHTML = ""; 
	
  }
}


//configure refresh interval (in seconds)



var countDownInterval=60;

var countDownTime=countDownInterval+1;



function countDown(){

		countDownTime--;

		if (countDownTime <=0){

			countDownTime=countDownInterval;

			clearTimeout(counter);

			return;

			}

		

	document.all.countdowntimer.innerHTML = countDownTime;

	counter=setTimeout("countDown()", 1000);

}
