// The AJAX function...

function AJAX(){
   try{
      xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari
      return xmlHttp;
   }
   catch (e){
      try{
         xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
         return xmlHttp;
      }
      catch (e){
         try{
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            return xmlHttp;
         }
         catch (e){
            alert("Your browser does not support AJAX.");
            return false;
         }
      }
   }
}

// Timestamp for preventing IE caching the GET request (common function)

function fetch_unix_timestamp()
{
   return parseInt(new Date().getTime().toString().substring(0, 10))
}

////////////////////////////////
//
// Refreshing the DIV TIMEDIV
//
////////////////////////////////

function refreshdiv_sc(id){

// Customise those settings
var id = id;
var seconds = 5;
var divid = 'ob'+id;
var url = "./files/addons/ip_symcon/get.scriptvalue.php?s=" + id;

// Create xmlHttp

var xmlHttp_one = AJAX();

// No cache

var timestamp = fetch_unix_timestamp();
var nocacheurl = url+"&t="+timestamp;

// The code...

      xmlHttp_one.onreadystatechange=function(){
         if(xmlHttp_one.readyState==4){
            var oElement;
            if (document.getElementById) {
               oElement = document.getElementById(divid);
               if (oElement) {
                  var newvalue = xmlHttp_one.responseText;
                  if(newvalue != "")  document.getElementById(divid).innerHTML = newvalue;
                  else document.getElementById(divid).innerHTML = document.getElementById(divid).innerHTML;
               }
                  
            }
            setTimeout('refreshdiv_sc('+id+')',seconds*1000);
         }
      }

xmlHttp_one.open("GET",nocacheurl,true);
xmlHttp_one.send(null);
}

