function StartDataLoadInPage(){
    startTime();

    if (document.getElementById('weatherbox')){
      t1=setTimeout('sndAction("wb")',500);
    }
    if (document.getElementById('sweather')){
      sndAction("one");
    }
    /*if (document.getElementById('tab-block-news')){
      t1=setTimeout('sndAction("nb")',600);
    } */
}

function createRequestObject() {
    var ro;
    var xmlHttp;
    var browser = navigator.appName;

    try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }


    //try {
      // Firefox, Opera 8.0+, Safari    xmlHttp=new XMLHttpRequest();
    //}
    //catch (e){
      // Internet Explorer
    //  try {
    //    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    //  }
    //  catch (e){
    //    try {
    //      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    //    }
    //    catch (e){
    //      alert("Your browser does not support AJAX!");
    //      return false;
    //    }
    //  }
    //}

    //if(browser == "Microsoft Internet Explorer"){
    //    ro = new ActiveXObject("Microsoft.XMLHTTP");
    //}else{
    //    ro = new XMLHttpRequest();
    //}
    //return ro;
    if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

    ro = xmlHttp;
    return ro;
}

var http = createRequestObject();

function sndAction(action) {
    http.open('get', 'rpcaction.php?action='+action);
    if (action == "one"){
      http.onreadystatechange = handleResponsesw;
    }
    if (action == "wb"){
      http.onreadystatechange = handleResponsewb;
    }
    if (action == "nb"){
      http.onreadystatechange = handleResponsenb;
    }

    http.send(null);
}

function handleResponsesw() {
    if(http.readyState == 4){
        var response = http.responseText;
        if (document.getElementById('sweather')){
          document.getElementById('sweather').innerHTML=response;
          t1=setTimeout('sndAction("one")',20000)
        }
    }
}

function handleResponsenb() {
    if(http.readyState == 4){
        var response = http.responseText;
        if (document.getElementById('tab-block-news')){
          document.getElementById('tab-block-news').innerHTML=response;
          t1=setTimeout('sndAction("nb")',10000)
        }
    }
}

function handleResponsewb() {
    if(http.readyState == 4){
        var response = http.responseText;
        if (document.getElementById('weatherbox')){
          document.getElementById('weatherbox').innerHTML=response;
          t1=setTimeout('sndAction("wb")',45000)
        }
    }
}

function startTime(){
    var today=new Date()
    var h=today.getHours()
    var m=today.getMinutes()
    var s=today.getSeconds()
    var dd=today.getDate()
    var mm=today.getMonth()
    var yy=today.getFullYear()
    // add a zero in front of numbers<10
    h=checkTime(h)
    m=checkTime(m)
    s=checkTime(s)
    mm=mm+1
    dd=checkTime(dd)
    mm=checkTime(mm)
    document.getElementById('timeonline').innerHTML=h+":"+m+":"+s+"&nbsp;&nbsp;"+dd+"-"+mm+"-"+yy
    t=setTimeout('startTime()',500)
}

function checkTime(i){
    if (i<10){
      i="0" + i
    }
    return i
}
