function setLotsInfo(rs){
  clearInterval(interval);
  var _movie = null;
  //alert(rs.length);
  for( var i = 0; i < rs.length; i++){
    _movie = getSWF("lot_" + rs[i][0] + "_1");
    //alert("lot_" + rs[i][0] + "_1 = " + _movie);
    if ( _movie != undefined ){
      try {
        _movie.sendData(rs[i][1]);
      }
      catch (e){
        //console.log("error1: " + e);
      }
    }
    _movie = getSWF("lot_" + rs[i][0] + "_2");
    //console.log("lot_" + rs[i][0] + "_2 = " + _movie);
    if ( _movie != undefined ){
      try {
        _movie.sendData(rs[i][1]);
      }
      catch (e){
        //console.log("error2: " + e);
      }
    }
  }
  interval = setInterval("sendQuery()", 3000);
}

function sendQuery(){
  url = lotIDS;
  var opt = {
    method: 'post',
    postBody: url,
    onSuccess: function(t) {
      try {
        eval(t.responseText);
        setLotsInfo(lots);
      }
      catch(e){
       //alert(e.message);
      }
    },
    on404: function(t) {
      alert('Error 404: location "' + t.statusText + '" was not found.');
    },
    onFailure: function(t) {
      //alert('Error ' + t.status + ' -- ' + t.statusText);
    }
  }
  new Ajax.Request('inc/handler.short.lot.info.v2.php', opt);
}



function getSWF(movieName) {
  try {
    if (navigator.appName.indexOf("Microsoft") != -1) {
      //alert("window[" + movieName + "] = " + window[movieName]);
      if ( window[movieName] == undefined ) {
          return document[movieName];
      }else
      {
          return window[movieName];
      }
    }
    else {
      if(document[movieName].length != undefined){
        return document[movieName][1];
      }
      return document[movieName];
    }
  }
  catch ( e ){
    return undefined;
    //console.log("getSWF:" + e + " _movieName=" + movieName);
  }
}
