var xmlHttp;
var curPane;

function getdetail(i,str,xmit_lat,xmit_lon,info){
  curPane = i;
  if(document.getElementById("detail-"+curPane).innerHTML.length > 10){
    str="";
    offsta(curPane);
    document.getElementById("detail-"+curPane).innerHTML="";
  } else {
    if (str.length==0) { 
      document.getElementById("detail-"+curPane).innerHTML="";
      offsta(curPane);
      return;
    }
    onsta(i,xmit_lat,xmit_lon,info); 
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null) {
      alert ("Your browser does not support AJAX!");
      return;
    } 
    var url="/cgi-bin/maps/detail.pl?"+str;
    xmlHttp.onreadystatechange=stateChangedDetail;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }
}


function getcoverage(str) {
  var waitext = "<img src='http://www.dtv.gov/imagesnew/ico_loading.gif'' alt='loading' title='loading...'> Calculating Signal Strength at:  " + str + "<span class='red'><p>Please "
                + "be patient.  We are calculating signal strength at your address.  This may " 
                + "take a while</p></span>";
  document.getElementById("contourdata").innerHTML=waitext;
  if (str.length==0) { 
    document.getElementById("contourdata").innerHTML="";
    return;
  }
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null) {
    alert ("Your browser does not support AJAX!");
    return;
  } 
  var url="/cgi-bin/maps/coverage.pl";
  url=url+"?startpoint="+str+"&expert=1";
  xmlHttp.onreadystatechange=stateChanged;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
} 

function resizeMap(){
  var lw = 300;
  var ww;
  if(window.self && self.innerWidth){
	ww = self.innerWidth;
  }else if(document.documentElement && document.documentElement.clientHeight){
	ww = document.documentElement.clientWidth;
  }else{
	ww = document.body.clientWidth;
  }
  
  document.getElementById("left").style.width=200; 
  document.getElementById("right").style.width = (ww - lw);
  
  //map.setCenter(marker.getLatLng());

}

function stateChanged() { 
  //resizeMap();
  if (xmlHttp.readyState==4) { 
    document.getElementById("contourdata").innerHTML=xmlHttp.responseText;
  }
}

function stateChangedDetail() { 
  if (xmlHttp.readyState==4) { 
    document.getElementById("detail-"+curPane).innerHTML=xmlHttp.responseText;
  }
}

function GetXmlHttpObject()
{
var xmlHttp=null;
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");
    }
  }
return xmlHttp;
}
