// map a list of mlsNumbers

var   mapWin = "toolbar=0,status=0,location=0,directories=0,menubar=0,scrollbars=1,resizable=1"  

if(typeof(debugMap)!="undefined" ) {
   mapWin = ""; // debug version
}


function MapMlsNum(uid, prp){
///alert('mapmlsnum')
	// I've replaced the original code for the mapping window with the following, which populates hidden
	// fields in a new form on the srh.asp page and then submits it to a new window. I did this because
	// the querystring created by the original code was too long if all properties were selected from
	// a quick search with more than 200 results. Please see srh.asp for more info. ~ MBS ~ 06/19/02
 
  top.mappingWindow = window.open("", "Mapping", mapWin  );
  top.mappingWindow.location.href = "http://armlslistings.marketlinx.com/search/mapping/mapSql.asp?prp=" +prp+"&where="+ escape("uid in("+uid+")");

/*
	if(typeof(document.frmMap) != "undefined") {
		document.frmMap.prp.value = prp;		
		document.frmMap.where.value = "uid in (" + uid + ")";
		document.frmMap.target= "Mapping";
		document.frmMap.submit();
	}
	else {
		top.mappingWindow.location.href = "http://armlslistings.marketlinx.com/search/mapping/mapSql.asp?prp=" +prp+"&where="+ escape("uid in("+uid+")");
	}
	*/
}



function ButtonInit() {
////nomapServer defined in http://armlslistings.marketlinx.com/SearchDetail/Scripts/DefaultUtl.asp
   if( ( parent.frames[0].nomapServer != 'undefined' ) && ( parent.frames[0].nomapServer == 'true') ) {
      return;
      }

	  
   var clearMap  =  ''

   if (document.all("LongitudeMax").value != "") {
      clearMap  = '<input TYPE="button" VALUE="Map Clear"  ONCLICK="clearMapBB()">'


     if (  document.all("latLong")!=null ) {
         // if we are on the custom search, then show latlong values
         document.all("latLong").innerHTML = 
         document.all("LongitudeMin").value  +"< longitude < " + document.all("LongitudeMax").value + "<br>"
        +document.all("LatitudeMin").value   +"< latitude < "  + document.all("LatitudeMax").value;
      }
   } else if (  document.all("latLong")!=null ) {
      // no lat/long so clear
      document.all("latLong").innerHTML = "";
   }

   if(document.all("mapClear")!=null) document.all("mapClear").innerHTML = clearMap;
   if(document.all("mapClear2")!=null) document.all("mapClear2").innerHTML = clearMap;
}


function clearMapBB() {
   top.main.SearchFrame.document.all("LongitudeMin").value = "";
   top.main.SearchFrame.document.all("LongitudeMax").value = "";
   top.main.SearchFrame.document.all("LatitudeMin").value  = "";
   top.main.SearchFrame.document.all("LatitudeMax").value  = "";

   ButtonInit();
}


function DoMap() {
   top.mappingWindow = window.open("", "Mapping", mapWin);
   document.SmallSub.target       = "Mapping";
   document.SmallSub.action       = "http://armlslistings.marketlinx.com/Search/mapping/MapSql.asp";
   x=GenSql(true); // Only needs bare minimum, x= need for mac to fource gensql to finish before continuing
   if ( typeof(document.FormOne.Search1) != "undefined") 
   {
   document.FormOne.Search1.value ="Search";  // allow Searching THIS LINE CAUSES AN ERROR WHERE Search1 not defined
   }
   if ( typeof(document.FormOne.Search2) != "undefined") 
   {
   document.FormOne.Search2.value ="Search"; //Allow bottom button to change back as well if it exists.
   }
   document.SmallSub.target       = "_self"; 
   window.setTimeout("ResetTargetToSelf()",  500); // try to set target value in 1/2 second.

}

function DoMap2() {
   top.mappingWindow = window.open("", "Mapping", mapWin);
   document.SmallSub.target       = "Mapping";
   document.SmallSub.action       = "http://armlslistings.marketlinx.com/Search/mapping/MapSql.asp";
   document.SmallSub.where.value  = "";
   document.SmallSub.submit();   ////This is the line that GenSql(true) causes 
   document.FormOne.Search1.value ="Search";  // allow Searching
   //document.SmallSub.target       = "_self";
   window.setTimeout("ResetTargetToSelf()",  500); // try to set target value in 1/2 second.
}

function ResetTargetToSelf() {
   document.SmallSub.target       = "_self";
}

function GenSqlDownload(){
   var thisAct = GetDownloadAction();
   if(thisAct.length>1) {
	  document.SmallSub.action = GetDownloadAction();
      GenSql(true); // Only needs bare minimum
   }
}


function GenSearch() {
   document.SmallSub.action = "/"+GetSearchPath() + "http://armlslistings.marketlinx.com/Scripts/Srh.asp";
   GenSql(true); // Only needs bare minimum
}

